Skip to content

Commit

Permalink
Fix empty image preparation (#23304)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
potiuk committed Apr 27, 2022
1 parent c26796e commit 4f6fe72
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# under the License.

import multiprocessing as mp
import os
import sys
from typing import List, Tuple

Expand Down Expand Up @@ -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(
Expand All @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# under the License.
"""Command to build PROD image."""
import contextlib
import os
import sys
from typing import Tuple

Expand Down Expand Up @@ -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(
Expand All @@ -179,6 +182,7 @@ def build_production_image(
cwd=AIRFLOW_SOURCES_ROOT,
check=False,
text=True,
env=env,
)
else:
cmd = construct_docker_build_command(
Expand Down

0 comments on commit 4f6fe72

Please sign in to comment.