File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,9 +9,22 @@ RELEASE_TAG="${5:-}"
99: " ${GITHUB_OUTPUT:? GitHub output file required} "
1010SCRIPT_DIR=$( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd)
1111PREVIOUS=$( bash " $SCRIPT_DIR /get-ecr-image-digest.sh" " $REPOSITORY " " $DEPLOY_TAG " --allow-missing)
12+ # A tag read straight after the move can still return the previous image, which
13+ # reports a moved tag as unchanged. The dry run prints the exact manifest the
14+ # move pushes (plus a trailing newline), so its hash is the digest the tag will
15+ # point at, known before the move.
16+ MANIFEST=$( docker buildx imagetools create --dry-run -t " $REGISTRY /$REPOSITORY :$DEPLOY_TAG " " $REGISTRY /$REPOSITORY :$SOURCE_TAG " )
17+ DIGEST=" sha256:$( printf ' %s' " $MANIFEST " | sha256sum | cut -d' ' -f1) "
1218EPOCH=$( date +%s)
1319bash " $SCRIPT_DIR /promote-image.sh" " $REGISTRY " " $REPOSITORY " " $SOURCE_TAG " " $DEPLOY_TAG " " $RELEASE_TAG "
14- DIGEST=$( bash " $SCRIPT_DIR /get-ecr-image-digest.sh" " $REPOSITORY " " $DEPLOY_TAG " )
20+ for attempt in $( seq 1 20) ; do
21+ [ " $( bash " $SCRIPT_DIR /get-ecr-image-digest.sh" " $REPOSITORY " " $DEPLOY_TAG " --allow-missing) " = " $DIGEST " ] && break
22+ if [ " $attempt " -eq 20 ]; then
23+ echo " ERROR: $DEPLOY_TAG never resolved to the pushed $DIGEST ; cutover cannot be correlated" >&2
24+ exit 1
25+ fi
26+ sleep 3
27+ done
1528CHANGED=true
1629if [ " $DIGEST " = " $PREVIOUS " ]; then CHANGED=false; fi
1730{
You can’t perform that action at this time.
0 commit comments