Skip to content

Commit

Permalink
create-repos: ignore "Repository already exists"
Browse files Browse the repository at this point in the history
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 <acmiel@redhat.com>
  • Loading branch information
chmeliik committed Jan 9, 2025
1 parent 1276b36 commit ce7d35f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions .tekton/scripts/create-task-pipeline-bundle-repos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ce7d35f

Please sign in to comment.