Skip to content

Commit

Permalink
Merge pull request #79: Check all tags before pushing
Browse files Browse the repository at this point in the history
  • Loading branch information
victorlin authored Aug 24, 2022
2 parents 5c222de + 7e647e5 commit c3857f5
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 c3857f5

Please sign in to comment.