This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 4f6fe727a1 Fix empty image preparation (#23304)
4f6fe727a1 is described below
commit 4f6fe727a1af609595523bec4d1e6943f5e9075f
Author: Jarek Potiuk <[email protected]>
AuthorDate: Wed Apr 27 23:33:52 2022 +0200
Fix empty image preparation (#23304)
Empty image preparation failed in CI because it was impossible to
build an empty image without buildkit. This change sets DOCKER_BUILDKIT
variable for empty image build which make it always use the buildkit.
---
dev/breeze/src/airflow_breeze/build_image/ci/build_ci_image.py | 4 ++++
dev/breeze/src/airflow_breeze/build_image/prod/build_prod_image.py | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/dev/breeze/src/airflow_breeze/build_image/ci/build_ci_image.py
b/dev/breeze/src/airflow_breeze/build_image/ci/build_ci_image.py
index b1922521d3..7c1bca1eb1 100644
--- a/dev/breeze/src/airflow_breeze/build_image/ci/build_ci_image.py
+++ b/dev/breeze/src/airflow_breeze/build_image/ci/build_ci_image.py
@@ -16,6 +16,7 @@
# under the License.
import multiprocessing as mp
+import os
import sys
from typing import List, Tuple
@@ -155,6 +156,8 @@ def build_ci_image(
production_image=False,
)
if ci_image_params.empty_image:
+ env = os.environ.copy()
+ env['DOCKER_BUILDKIT'] = "1"
console.print(f"\n[blue]Building empty CI Image for Python
{ci_image_params.python}\n")
cmd =
construct_empty_docker_build_command(image_params=ci_image_params)
build_result = run_command(
@@ -164,6 +167,7 @@ def build_ci_image(
dry_run=dry_run,
cwd=AIRFLOW_SOURCES_ROOT,
text=True,
+ env=env,
)
else:
console.print(f"\n[blue]Building CI Image for Python
{ci_image_params.python}\n")
diff --git a/dev/breeze/src/airflow_breeze/build_image/prod/build_prod_image.py
b/dev/breeze/src/airflow_breeze/build_image/prod/build_prod_image.py
index 3323ff0f5f..2caeeb7ef5 100644
--- a/dev/breeze/src/airflow_breeze/build_image/prod/build_prod_image.py
+++ b/dev/breeze/src/airflow_breeze/build_image/prod/build_prod_image.py
@@ -16,6 +16,7 @@
# under the License.
"""Command to build PROD image."""
import contextlib
+import os
import sys
from typing import Tuple
@@ -169,6 +170,8 @@ def build_production_image(
)
console.print(f"\n[blue]Building PROD Image for Python
{prod_image_params.python}\n")
if prod_image_params.empty_image:
+ env = os.environ.copy()
+ env['DOCKER_BUILDKIT'] = "1"
console.print(f"\n[blue]Building empty PROD Image for Python
{prod_image_params.python}\n")
cmd =
construct_empty_docker_build_command(image_params=prod_image_params)
build_command_result = run_command(
@@ -179,6 +182,7 @@ def build_production_image(
cwd=AIRFLOW_SOURCES_ROOT,
check=False,
text=True,
+ env=env,
)
else:
cmd = construct_docker_build_command(