From 405940e9e5b0ff36a0a37c99aec4a7e2681cfa53 Mon Sep 17 00:00:00 2001 From: Anna Mager <78752267+twelvemo@users.noreply.github.com> Date: Tue, 26 Nov 2024 15:18:06 +0100 Subject: [PATCH] fix(publish): copy image from registry if it has been pushed directly after build (#6681) --- core/src/plugins/kubernetes/container/publish.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/src/plugins/kubernetes/container/publish.ts b/core/src/plugins/kubernetes/container/publish.ts index 2e74559680..f7533b51bc 100644 --- a/core/src/plugins/kubernetes/container/publish.ts +++ b/core/src/plugins/kubernetes/container/publish.ts @@ -23,10 +23,15 @@ export const k8sPublishContainerBuild: BuildActionHandler<"publish", ContainerBu const localImageId = action.getOutput("localImageId") const deploymentRegistryImageId = action.getOutput("deploymentImageId") const remoteImageId = containerHelpers.getPublicImageId(action, tagOverride) + const dockerBuildExtraFlags = action.getSpec("extraFlags") // For in-cluster building or cloud builder, use regctl to copy the image. // This does not require to pull the image locally. - if (provider.config.buildMode !== "local-docker" || cloudBuilderConfigured) { + if ( + provider.config.buildMode !== "local-docker" || + cloudBuilderConfigured || + dockerBuildExtraFlags?.includes("--push") + ) { const regctlCopyCommand = ["image", "copy", deploymentRegistryImageId, remoteImageId] log.info({ msg: `Publishing image ${remoteImageId}` }) await containerHelpers.regctlCli({ cwd: action.getBuildPath(), args: regctlCopyCommand, log, ctx })