Skip to content

Commit

Permalink
Avoid extra questions in breeze build image command. (#23898)
Browse files Browse the repository at this point in the history
Fixes: #23867
  • Loading branch information
potiuk authored May 24, 2022
1 parent cac7ab5 commit 90940b5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
11 changes: 4 additions & 7 deletions dev/breeze/src/airflow_breeze/commands/ci_image_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
option_docker_cache,
option_dry_run,
option_empty_image,
option_force_build,
option_github_repository,
option_github_token,
option_github_username,
Expand Down Expand Up @@ -219,7 +218,6 @@
@option_dev_apt_deps
@option_runtime_apt_command
@option_runtime_apt_deps
@option_force_build
@option_airflow_constraints_mode_ci
@option_airflow_constraints_reference_build
@option_tag_as_latest
Expand All @@ -241,6 +239,7 @@ def run_build(ci_image_params: BuildCiParams) -> None:

perform_environment_checks(verbose=verbose)
parameters_passed = filter_out_none(**kwargs)
parameters_passed['force_build'] = True
if build_multiple_images:
python_version_list = get_python_version_list(python_versions)
for python in python_version_list:
Expand Down Expand Up @@ -362,7 +361,7 @@ def verify_image(
sys.exit(return_code)


def should_we_run_the_build(build_ci_params: BuildCiParams, verbose: bool) -> bool:
def should_we_run_the_build(build_ci_params: BuildCiParams) -> bool:
"""
Check if we should run the build based on what files have been modified since last build and answer from
the user.
Expand All @@ -377,9 +376,7 @@ def should_we_run_the_build(build_ci_params: BuildCiParams, verbose: bool) -> bo
# We import those locally so that click autocomplete works
from inputimeout import TimeoutOccurred

if not md5sum_check_if_build_is_needed(
md5sum_cache_dir=build_ci_params.md5sum_cache_dir, verbose=verbose
):
if not md5sum_check_if_build_is_needed(md5sum_cache_dir=build_ci_params.md5sum_cache_dir):
return False
try:
answer = user_confirm(
Expand Down Expand Up @@ -456,7 +453,7 @@ def build_ci_image(verbose: bool, dry_run: bool, ci_image_params: BuildCiParams)
f"python version: {ci_image_params.python}[/]\n"
)
if not ci_image_params.force_build and not ci_image_params.upgrade_to_newer_dependencies:
if not should_we_run_the_build(build_ci_params=ci_image_params, verbose=verbose):
if not should_we_run_the_build(build_ci_params=ci_image_params):
return 0, f"Image build: {ci_image_params.python}"
if ci_image_params.prepare_buildx_cache or ci_image_params.push_image:
login_to_github_docker_registry(image_params=ci_image_params, dry_run=dry_run, verbose=verbose)
Expand Down
2 changes: 1 addition & 1 deletion dev/breeze/src/airflow_breeze/utils/md5_build_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def calculate_md5_checksum_for_files(
return modified_files, not_modified_files


def md5sum_check_if_build_is_needed(md5sum_cache_dir: Path, verbose: bool) -> bool:
def md5sum_check_if_build_is_needed(md5sum_cache_dir: Path) -> bool:
"""
Checks if build is needed based on whether important files were modified.
Expand Down
2 changes: 1 addition & 1 deletion images/breeze/output-commands-hash.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
aa34cfc99f60649fea3b808ef225981e
55e304e1e39d2750c5a67a127493cd96

0 comments on commit 90940b5

Please sign in to comment.