Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid extra questions in breeze build image command. #23898

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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