From 39a6242b54208a460453c23a3ada713ee7e44627 Mon Sep 17 00:00:00 2001 From: Jing Chen Date: Fri, 15 Nov 2024 02:59:23 -0800 Subject: [PATCH] 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 --- tools/images.mk | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/images.mk b/tools/images.mk index 6607b4ab4..001144dd1 100644 --- a/tools/images.mk +++ b/tools/images.mk @@ -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 || \