Tag other registries in push

Previously we were tagging for all registries as we built
the images and then pushing all registries blindly.

Now if an image hasn't changed it wouldn't tag with the other
registry tags, and then the push would fail as the gcr/quay
tags didn't exist.

Rather than taking care to tag in the case where the image
hasn't changed, instead change the pushall script to
only assume that `bitnami/minideb` tags are correct, and
tag the other registries based on that one before pushing.

This ensures that the tags will always exist, and also makes
sure we are pushing the same image to each registry (excluding
race conditions.)
This commit is contained in:
James Westby 2019-10-04 17:16:22 +01:00 committed by James Westby
parent 6309b17069
commit 9eea538c29
2 changed files with 3 additions and 7 deletions

View File

@ -34,8 +34,6 @@ set -u
set -o pipefail
BASENAME=bitnami/minideb
GCR_BASENAME=gcr.io/bitnami-containers/minideb
QUAY_BASENAME=quay.io/bitnami/minideb
LATEST=buster
@ -92,13 +90,9 @@ build() {
fi
fi
docker tag "$built_image_id" "$BASENAME:$DIST"
docker tag "$built_image_id" "$QUAY_BASENAME:$DIST"
docker tag "$built_image_id" "$GCR_BASENAME:$DIST"
log "Tagged $built_image_id as $BASENAME:$DIST $QUAY_BASENAME:$DIST $GCR_BASENAME:$DIST"
log "Tagged $built_image_id as $BASENAME:$DIST"
if [ "$DIST" == "$LATEST" ]; then
docker tag "$BASENAME:$DIST" "$BASENAME:latest"
docker tag "$QUAY_BASENAME:$DIST" "$QUAY_BASENAME:latest"
docker tag "$GCR_BASENAME:$DIST" "$GCR_BASENAME:latest"
fi
}

View File

@ -38,6 +38,8 @@ fi
for DIST in $DISTS; do
DOCKER_CONTENT_TRUST=${ENABLE_DOCKER_CONTENT_TRUST} docker push "${BASENAME}:${DIST}"
docker tag "${BASENAME}:${DIST}" "${QUAY_BASENAME}:${DIST}"
docker tag "${BASENAME}:${DIST}" "${GCR_BASENAME}:${DIST}"
docker push "${QUAY_BASENAME}:${DIST}"
gcloud docker -- push "${GCR_BASENAME}:${DIST}"
done