Skip to content

Commit

Permalink
Check all tags before pushing
Browse files Browse the repository at this point in the history
This check was placed incorrectly in 7d4daa9.

Two tags can point to the same image and if one of them is pushed first,
the other will error even though both were "new" at the start of the
script.
  • Loading branch information
victorlin authored Aug 24, 2022
1 parent 5c222de commit 7e647e5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions devel/push
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# By default this publishes the "latest" tag, but you can provide other tags in
# addition to or instead of "latest".
#
# Errors if a tagged image has already been pushed.
# Errors if any of the tagged images have already been pushed.
#
set -euo pipefail

Expand All @@ -18,12 +18,13 @@ BASE_IMAGE="nextstrain/base"
BASE_BUILDER_IMAGE="nextstrain/base-builder"

for tag in "$@"; do

if [[ $(docker image inspect --format "{{.RepoDigests}}" $BASE_IMAGE:$tag) != '[]' || $(docker image inspect --format "{{.RepoDigests}}" $BASE_BUILDER_IMAGE:$tag) != '[]' ]]; then
echo "At least one of the tagged images has already been pushed. This can happen if the newly built image is not available in the local registry." >&2
echo "At least one of $BASE_IMAGE:$tag and $BASE_BUILDER_IMAGE:$tag has already been pushed. This can happen if the newly built image is not available in the local registry." >&2
exit 1
fi
done

for tag in "$@"; do
docker push $BASE_BUILDER_IMAGE:$tag
docker push $BASE_IMAGE:$tag
done

0 comments on commit 7e647e5

Please sign in to comment.