Skip to content

Commit

Permalink
Preparing buildx cache is allowed without --push-image flag (#24028)
Browse files Browse the repository at this point in the history
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 8f3a9b8)
  • Loading branch information
potiuk authored and ephraimbuddy committed Jun 1, 2022
1 parent 871915c commit 8ddd7ac
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
9 changes: 7 additions & 2 deletions dev/breeze/src/airflow_breeze/commands/ci_image_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 8ddd7ac

Please sign in to comment.