Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions scripts/build_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,14 @@ if [[ -z "${SKIP_BUILD_RACE}" ]]; then
"$AVALANCHE_PATH" -f "$AVALANCHE_PATH/Dockerfile"
fi

# Only tag the latest image for the master branch when images are pushed to a registry
if [[ "${DOCKER_IMAGE}" == *"/"* && ($image_tag == "master" || -n "${FORCE_TAG_LATEST}") ]]; then
# Tag latest when pushing to a registry and the tag is a release (vMAJOR.MINOR.PATCH), or when forced
if [[ "${DOCKER_IMAGE}" == *"/"* && ( "$image_tag" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ || -n "${FORCE_TAG_LATEST}" ) ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@StephenButtolph This change appears to assume that we only ever tag new releases. Do we ever tag for a previous release (e.g. a bugfix release) such that latest could end up pointing to a previous release?

echo "Tagging current avalanchego images as $DOCKER_IMAGE:latest"
docker buildx imagetools create -t "$DOCKER_IMAGE:latest" "$DOCKER_IMAGE:$commit_hash"
fi

# Also tag master builds as latest-unstable when images are pushed to a registry
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per #4490, I'm going to just use the master tag so this can be left out for now.

if [[ "${DOCKER_IMAGE}" == *"/"* && "$image_tag" == "master" ]]; then
echo "Tagging current avalanchego images as $DOCKER_IMAGE:latest-unstable"
docker buildx imagetools create -t "$DOCKER_IMAGE:latest-unstable" "$DOCKER_IMAGE:$commit_hash"
fi