From 7ab6175cf4488fbefd71d0bfa5c1b0ccc5e6d52a Mon Sep 17 00:00:00 2001 From: Amir Zarrinkafsh Date: Sat, 18 Sep 2021 18:09:19 +1000 Subject: [PATCH] ci(buildkite): fix post-manifest tag cleanup (#2395) --- .buildkite/hooks/post-command | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.buildkite/hooks/post-command b/.buildkite/hooks/post-command index f3ece613a..18b5faefb 100755 --- a/.buildkite/hooks/post-command +++ b/.buildkite/hooks/post-command @@ -51,7 +51,7 @@ if [[ "${BUILDKITE_LABEL}" == ":docker: Deploy Manifest" ]] && [[ "${BUILDKITE_B echo "Removing tag ${BRANCH_TAG} from docker.io" curl -fsL --retry 3 -o /dev/null -X "DELETE" -H "Authorization: JWT ${authtoken}" https://hub.docker.com/v2/repositories/authelia/authelia/tags/${BRANCH_TAG}/ for i in {1..5}; do - for GHCR_VERSION in $(curl -fsL --retry 3 -H "Authorization: Bearer ${GHCR_PASSWORD}" -H "Accept: application/vnd.github.v3+json" "https://api.github.com/orgs/authelia/packages/container/authelia/versions?page=${i}&per_page=100" | jq --arg tag ${BRANCH_TAG} '.[] | select(.metadata.container.tags[] | contains($tag)) | "\(.metadata.container.tags[]),\(.id)"'); do + for GHCR_VERSION in $(curl -fsL --retry 3 -H "Authorization: Bearer ${GHCR_PASSWORD}" -H "Accept: application/vnd.github.v3+json" "https://api.github.com/orgs/authelia/packages/container/authelia/versions?page=${i}&per_page=100" | jq -j --arg tag ${BRANCH_TAG} '.[] | select(.metadata.container.tags[] | contains($tag)) | .metadata.container.tags[], ",", .id, "\n"'); do IFS=',' read -a TAGID <<< ${GHCR_VERSION} echo "Removing tag ${TAGID[0]} with id ${TAGID[1]} from ghcr.io" @@ -66,7 +66,7 @@ if [[ "${BUILDKITE_LABEL}" == ":docker: Deploy Manifest" ]] && [[ "${BUILDKITE_B echo "Removing tag ${PR_TAG} from docker.io" curl -fsL --retry 3 -o /dev/null -X "DELETE" -H "Authorization: JWT ${authtoken}" https://hub.docker.com/v2/repositories/authelia/authelia/tags/${PR_TAG}/ for i in {1..5}; do - for GHCR_VERSION in $(curl -fsL --retry 3 -H "Authorization: Bearer ${GHCR_PASSWORD}" -H "Accept: application/vnd.github.v3+json" "https://api.github.com/orgs/authelia/packages/container/authelia/versions?page=${i}&per_page=100" | jq --arg tag ${PR_TAG} '.[] | select(.metadata.container.tags[] | contains($tag)) | "\(.metadata.container.tags[]),\(.id)"'); do + for GHCR_VERSION in $(curl -fsL --retry 3 -H "Authorization: Bearer ${GHCR_PASSWORD}" -H "Accept: application/vnd.github.v3+json" "https://api.github.com/orgs/authelia/packages/container/authelia/versions?page=${i}&per_page=100" | jq -j --arg tag ${PR_TAG} '.[] | select(.metadata.container.tags[] | contains($tag)) | .metadata.container.tags[], ",", .id, "\n"'); do IFS=',' read -a TAGID <<< ${GHCR_VERSION} echo "Removing tag ${TAGID[0]} with id ${TAGID[1]} from ghcr.io"