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 90940b5293 Avoid extra questions in `breeze build image` command.
(#23898)
90940b5293 is described below
commit 90940b529340ef7f9b8c51d5c7d9b6a848617dea
Author: Jarek Potiuk <[email protected]>
AuthorDate: Tue May 24 17:27:25 2022 +0100
Avoid extra questions in `breeze build image` command. (#23898)
Fixes: #23867
---
dev/breeze/src/airflow_breeze/commands/ci_image_commands.py | 11 ++++-------
dev/breeze/src/airflow_breeze/utils/md5_build_check.py | 2 +-
images/breeze/output-commands-hash.txt | 2 +-
3 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/dev/breeze/src/airflow_breeze/commands/ci_image_commands.py
b/dev/breeze/src/airflow_breeze/commands/ci_image_commands.py
index 020cd30698..08c39adb45 100644
--- a/dev/breeze/src/airflow_breeze/commands/ci_image_commands.py
+++ b/dev/breeze/src/airflow_breeze/commands/ci_image_commands.py
@@ -44,7 +44,6 @@ from airflow_breeze.utils.common_options import (
option_docker_cache,
option_dry_run,
option_empty_image,
- option_force_build,
option_github_repository,
option_github_token,
option_github_username,
@@ -219,7 +218,6 @@ CI_IMAGE_TOOLS_PARAMETERS = {
@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
@@ -241,6 +239,7 @@ def build_image(
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:
@@ -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.
@@ -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(
@@ -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)
diff --git a/dev/breeze/src/airflow_breeze/utils/md5_build_check.py
b/dev/breeze/src/airflow_breeze/utils/md5_build_check.py
index 0900793a48..e572c5c373 100644
--- a/dev/breeze/src/airflow_breeze/utils/md5_build_check.py
+++ b/dev/breeze/src/airflow_breeze/utils/md5_build_check.py
@@ -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.
diff --git a/images/breeze/output-commands-hash.txt
b/images/breeze/output-commands-hash.txt
index f75b6cba57..df68ae3727 100644
--- a/images/breeze/output-commands-hash.txt
+++ b/images/breeze/output-commands-hash.txt
@@ -1 +1 @@
-aa34cfc99f60649fea3b808ef225981e
+55e304e1e39d2750c5a67a127493cd96