You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ep...@apache.org on 2023/03/08 14:44:35 UTC

[airflow] 20/20: Make sure DOCKER_BUILDKIT=1 variable is set for all builds (#29928)

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

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

commit b87990dc9d68553e05eafc75201045b0e1447445
Author: Jarek Potiuk <ja...@potiuk.com>
AuthorDate: Sun Mar 5 11:24:34 2023 +0100

    Make sure DOCKER_BUILDKIT=1 variable is set for all builds (#29928)
    
    The DOCKER_BUILDKIT=1 was only set in some specific cases, but since
    our images are using buildkit features, we should always use
    buildkit when building the images.
    
    (cherry picked from commit 0f6e0ee611a81046838ecc852bdc84155e335ecf)
---
 dev/breeze/src/airflow_breeze/commands/ci_image_commands.py         | 6 ++++--
 dev/breeze/src/airflow_breeze/commands/production_image_commands.py | 6 ++++--
 2 files changed, 8 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 6b72895952..d37c3e313b 100644
--- a/dev/breeze/src/airflow_breeze/commands/ci_image_commands.py
+++ b/dev/breeze/src/airflow_breeze/commands/ci_image_commands.py
@@ -464,9 +464,9 @@ def run_build_ci_image(
             output=output,
         )
     else:
+        env = os.environ.copy()
+        env["DOCKER_BUILDKIT"] = "1"
         if ci_image_params.empty_image:
-            env = os.environ.copy()
-            env["DOCKER_BUILDKIT"] = "1"
             get_console(output=output).print(
                 f"\n[info]Building empty CI Image for Python {ci_image_params.python}\n"
             )
@@ -502,6 +502,7 @@ def run_build_ci_image(
                 cwd=AIRFLOW_SOURCES_ROOT,
                 text=True,
                 check=False,
+                env=env,
                 output=output,
             )
             if build_command_result.returncode != 0 and not ci_image_params.upgrade_to_newer_dependencies:
@@ -515,6 +516,7 @@ def run_build_ci_image(
                             image_params=ci_image_params,
                         ),
                         cwd=AIRFLOW_SOURCES_ROOT,
+                        env=env,
                         text=True,
                         check=False,
                         output=output,
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 8cc058741b..66256b7e9e 100644
--- a/dev/breeze/src/airflow_breeze/commands/production_image_commands.py
+++ b/dev/breeze/src/airflow_breeze/commands/production_image_commands.py
@@ -482,9 +482,9 @@ def run_build_production_image(
     if prod_image_params.prepare_buildx_cache:
         build_command_result = build_cache(image_params=prod_image_params, output=output)
     else:
+        env = os.environ.copy()
+        env["DOCKER_BUILDKIT"] = "1"
         if prod_image_params.empty_image:
-            env = os.environ.copy()
-            env["DOCKER_BUILDKIT"] = "1"
             get_console(output=output).print(
                 f"\n[info]Building empty PROD Image for Python {prod_image_params.python}\n"
             )
@@ -504,6 +504,7 @@ def run_build_production_image(
                 ),
                 cwd=AIRFLOW_SOURCES_ROOT,
                 check=False,
+                env=env,
                 text=True,
                 output=output,
             )
@@ -523,6 +524,7 @@ def run_build_production_image(
                     cwd=AIRFLOW_SOURCES_ROOT,
                     check=False,
                     text=True,
+                    env=env,
                     output=output,
                 )
             if build_command_result.returncode == 0: