Allow DOCKER_FORCE_PUSH for test images.

The push-* command skips rebuild and image push w/ `latest` tag when a image
tag exists remotely. Most of gVisor test images have never got a chance to be
tagged because they already exist when `DOCKER_PUSH_AS_LATEST` was introduced.

We shouldn't enable DOCKER_FORCE_PUSH in our pipelines, it is better to be a
one off tool when the `latest` tag of an image is missing from remote repos.

PiperOrigin-RevId: 696823576
This commit is contained in:
Jing Chen
2024-11-15 03:02:36 -08:00
committed by gVisor bot
parent cf5841ba66
commit 39a6242b54
+4 -1
View File
@@ -183,9 +183,12 @@ test-%: register-cross ## Build an image locally if the remote doesn't exist.
# tag.
# If DOCKER_PUSH_AS_LATEST is set to true, this also marks this image as being
# the latest one on the remote repository.
# When DOCKER_FORCE_PUSH is true, it always pushes the image regardless of
# whether the image already exists on the remote.
DOCKER_PUSH_AS_LATEST ?= false
DOCKER_FORCE_PUSH ?= false
push-%:
$(call image_manifest,$*) >&2 || \
($(call image_manifest,$*) >&2 && test $(DOCKER_FORCE_PUSH) '!=' true) || \
( $(call rebuild,$*) && \
docker image push $(call remote_image,$*):$(call tag,$*) >&2 && \
( test $(DOCKER_PUSH_AS_LATEST) '!=' true || \