From 460a1789d097d622e14ff4eef2bb6f6f570dad92 Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Thu, 7 Mar 2024 09:37:24 -0800 Subject: [PATCH] Don't pull an image to validate that it exists PiperOrigin-RevId: 613612492 --- tools/images.mk | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/images.mk b/tools/images.mk index dcd45c629..237399174 100644 --- a/tools/images.mk +++ b/tools/images.mk @@ -163,11 +163,12 @@ rebuild-%: register-cross ## Force rebuild an image locally. load-%: register-cross ## Pull or build an image locally. @($(call pull,$*)) || ($(call rebuild,$*)) -# push pushes the remote image, after either pulling (to validate that the tag -# already exists) or building manually. Note that this generic rule will match -# the fully-expanded remote image tag. -push-%: load-% ## Push a given image. - @docker image push -q $(call remote_image,$*):$(call tag,$*) >&2 +# push pushes the remote image, after validating that the tag doesn't exist +# yet. Note that this generic rule will match the fully-expanded remote image +# tag. +push-%: + gcloud artifacts docker images describe $(call remote_image,$*):$(call tag,$*) >&2 || \ + docker image push $(call remote_image,$*):$(call tag,$*) >&2 # register-cross registers the necessary qemu binaries for cross-compilation. # This may be used by any target that may execute containers that are not the