From cbba3cbdebbb32d1819204bc1a1f7a421e727240 Mon Sep 17 00:00:00 2001
From: Ioannis Canellos <iocanel@gmail.com>
Date: Fri, 30 Jun 2023 11:05:15 +0300
Subject: [PATCH] fix:no implicit push when build explicitly disabled

---
 .../container/image/deployment/util/EnablementUtil.java       | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/extensions/container-image/deployment/src/main/java/io/quarkus/container/image/deployment/util/EnablementUtil.java b/extensions/container-image/deployment/src/main/java/io/quarkus/container/image/deployment/util/EnablementUtil.java
index 525a191af411a..d37be2436298c 100644
--- a/extensions/container-image/deployment/src/main/java/io/quarkus/container/image/deployment/util/EnablementUtil.java
+++ b/extensions/container-image/deployment/src/main/java/io/quarkus/container/image/deployment/util/EnablementUtil.java
@@ -17,7 +17,9 @@ public static boolean buildContainerImageNeeded(ContainerImageConfig containerIm
     public static boolean pushContainerImageNeeded(ContainerImageConfig containerImageConfig,
             Optional<ContainerImagePushRequestBuildItem> pushRequest) {
         return containerImageConfig.isPushExplicitlyEnabled()
-                || (pushRequest.isPresent() && !containerImageConfig.isPushExplicitlyDisabled());
+                // Never push an image when build is disabled (it may not even exist).
+                || (pushRequest.isPresent() && !containerImageConfig.isBuildExplicitlyDisabled()
+                        && !containerImageConfig.isPushExplicitlyDisabled());
     }
 
     public static boolean buildOrPushContainerImageNeeded(ContainerImageConfig containerImageConfig,