Skip to content

Commit

Permalink
Update tag deletion to v2 url
Browse files Browse the repository at this point in the history
  • Loading branch information
joshwlewis committed Feb 21, 2024
1 parent f1b1915 commit 09143d1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion bin/publish-to-registries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ push_group() {
done
}

tempTagSuffix=".temp_${GITHUB_RUN_ID}"
tempTagSuffix=".temp-${GITHUB_RUN_ID}"
# build+push to a temporary tag (e.g. heroku/heroku:22.temp_12345678)
bin/build.sh "${STACK_VERSION}" "${tempTagSuffix}"

Expand Down
8 changes: 4 additions & 4 deletions bin/unpublish-temp-tags.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env bash

set -euo pipefail
set -x

dockerhub_token=$(curl -s -f -H "Content-Type: application/json" -X POST -d "{\"username\": \"${DOCKER_HUB_USERNAME}\", \"password\": \"${DOCKER_HUB_TOKEN}\"}" https://hub.docker.com/v2/users/login/ | jq -r .token)

Expand All @@ -16,16 +15,17 @@ unpublish_group() {
echo "Deleting heroku/heroku:${stackVersion}${variant}${targetTagSuffix}"
code=$(curl -s -f -X DELETE \
-H "Authorization: JWT ${dockerhub_token}" --write-out "%{http_code}" \
"https://hub.docker.com/v2/repositories/heroku/heroku/tags/${stackVersion}${variant}${targetTagSuffix}/"
"https://hub.docker.com/v2/namespaces/heroku/repositories/heroku/tags/${stackVersion}${variant}${targetTagSuffix}"
)

echo "status: ${code}"
if (( code != 404 )) || (( code != 200 )) || (( code != 201 )); then
echo "Couldn't delete heroku/heroku:${stackVersion}${variant}${targetTagSuffix}: ${code}"
echo "Couldn't delete heroku/heroku:${stackVersion}${variant}${targetTagSuffix}"
fi
done
}

stackVersion="${1:-$STACK_VERSION}"
tempTagSuffix="${2:-".temp_$GITHUB_RUN_ID"}"
tempTagSuffix="${2:-".temp-$GITHUB_RUN_ID"}"
# delete each tag in a group on Docker Hub.
unpublish_group "${stackVersion}" "${tempTagSuffix}"

0 comments on commit 09143d1

Please sign in to comment.