From ce7d35f04090901481bf5985594fa2d9300fc781 Mon Sep 17 00:00:00 2001 From: Adam Cmiel Date: Wed, 8 Jan 2025 16:56:08 +0100 Subject: [PATCH] create-repos: ignore "Repository already exists" Inexplicably, for some task repos, quay.io returns 401 in response to the initial request but then returns "Repository already exists" when we try to create the repo. Ignore these errors. Example: Checking konflux-ci/tekton-catalog/task-fips-operator-bundle-check, http code: 401 Missing task bundle repo: tekton-catalog/task-fips-operator-bundle-check in konflux-ci, creating... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 362 100 218 100 144 323 213 --:--:-- --:--:-- --:--:-- 537 WARNING: repository creation failed, but the error message was 'Repository already exists'. Assuming that's fine. Signed-off-by: Adam Cmiel --- .tekton/scripts/create-task-pipeline-bundle-repos.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.tekton/scripts/create-task-pipeline-bundle-repos.sh b/.tekton/scripts/create-task-pipeline-bundle-repos.sh index 9894d89db4..bef2269791 100755 --- a/.tekton/scripts/create-task-pipeline-bundle-repos.sh +++ b/.tekton/scripts/create-task-pipeline-bundle-repos.sh @@ -47,13 +47,15 @@ locate_in_all_namespaces() { --arg description "" \ '$ARGS.named' ) - if ! err_msg=$(curl --oauth2-bearer "${QUAY_TOKEN}" "https://quay.io/api/v1/repository" --data-binary "$payload" -H "Content-Type: application/json" -H "Accept: application/json" | jq '.error_message // empty'); + if ! err_msg=$(curl --oauth2-bearer "${QUAY_TOKEN}" "https://quay.io/api/v1/repository" --data-binary "$payload" -H "Content-Type: application/json" -H "Accept: application/json" | jq -r '.error_message // empty'); then echo "curl returned an error when creating the repository. See the error above." exit 1 fi - if [ -n "$err_msg" ]; then + if [[ "$err_msg" == "Repository already exists" ]]; then + echo "WARNING: repository creation failed, but the error message was '$err_msg'. Assuming that's fine." + elif [[ -n "$err_msg" ]]; then echo "Quay returned an error when creating the repository: ${err_msg}" exit 1 fi