This is an automated email from the ASF dual-hosted git repository.

ephraimanierobi pushed a commit to branch v2-3-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit 8ddd7ac474332d41c2775dbd5534598b6bce67e2
Author: Jarek Potiuk <jarek.pot...@polidea.com>
AuthorDate: Mon May 30 17:09:35 2022 +0200

    Preparing buildx cache is allowed without --push-image flag (#24028)
    
    The previous version of buildx cache preparation implied --push-image
    flag, but now this is completely separated (we do not push image,
    we just prepare cache), so when mutli-platform buildx preparation is
    run we should also allow the cache to run without --push-image flag.
    
    (cherry picked from commit 8f3a9b8542346c35712cba373baaafb518503562)
---
 dev/breeze/src/airflow_breeze/commands/ci_image_commands.py      | 9 +++++++--
 .../src/airflow_breeze/commands/production_image_commands.py     | 9 +++++++--
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/dev/breeze/src/airflow_breeze/commands/ci_image_commands.py 
b/dev/breeze/src/airflow_breeze/commands/ci_image_commands.py
index c27e5cc25d..b9e0288540 100644
--- a/dev/breeze/src/airflow_breeze/commands/ci_image_commands.py
+++ b/dev/breeze/src/airflow_breeze/commands/ci_image_commands.py
@@ -444,9 +444,14 @@ def build_ci_image(verbose: bool, dry_run: bool, 
ci_image_params: BuildCiParams)
     :param dry_run: do not execute "write" commands - just print what would 
happen
     :param ci_image_params: CI image parameters
     """
-    if not ci_image_params.push_image and ci_image_params.is_multi_platform():
+    if (
+        ci_image_params.is_multi_platform()
+        and not ci_image_params.push_image
+        and not ci_image_params.prepare_buildx_cache
+    ):
         get_console().print(
-            "\n[red]You cannot use multi-platform build without using 
--push-image flag![/]\n"
+            "\n[red]You cannot use multi-platform build without using 
--push-image flag or "
+            "preparing buildx cache![/]\n"
         )
         return 1, "Error: building multi-platform image without --push-image."
     fix_group_permissions(verbose=verbose)
diff --git 
a/dev/breeze/src/airflow_breeze/commands/production_image_commands.py 
b/dev/breeze/src/airflow_breeze/commands/production_image_commands.py
index e10d46cda4..544095f0b2 100644
--- a/dev/breeze/src/airflow_breeze/commands/production_image_commands.py
+++ b/dev/breeze/src/airflow_breeze/commands/production_image_commands.py
@@ -480,9 +480,14 @@ def build_production_image(
     :param dry_run: do not execute "write" commands - just print what would 
happen
     :param prod_image_params: PROD image parameters
     """
-    if not prod_image_params.push_image and 
prod_image_params.is_multi_platform():
+    if (
+        prod_image_params.is_multi_platform()
+        and not prod_image_params.push_image
+        and not prod_image_params.prepare_buildx_cache
+    ):
         get_console().print(
-            "\n[red]You cannot use multi-platform build without using 
--push-image flag![/]\n"
+            "\n[red]You cannot use multi-platform build without using 
--push-image flag"
+            " or preparing buildx cache![/]\n"
         )
         return 1, "Error: building multi-platform image without --push-image."
     fix_group_permissions(verbose=verbose)

Reply via email to