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 25256792a58 Move setting common arguments to common_build_params
(#49375)
25256792a58 is described below
commit 25256792a5818ae54e443795c45c467e5e148125
Author: GPK <[email protected]>
AuthorDate: Fri Apr 18 11:39:45 2025 +0100
Move setting common arguments to common_build_params (#49375)
---
.../src/airflow_breeze/params/build_ci_params.py | 20 ++-----------------
.../src/airflow_breeze/params/build_prod_params.py | 23 +++++-----------------
.../airflow_breeze/params/common_build_params.py | 23 +++++++++++++++++++++-
dev/breeze/src/airflow_breeze/utils/recording.py | 4 ++--
4 files changed, 31 insertions(+), 39 deletions(-)
diff --git a/dev/breeze/src/airflow_breeze/params/build_ci_params.py
b/dev/breeze/src/airflow_breeze/params/build_ci_params.py
index 6a814bbbefc..e95286b94e1 100644
--- a/dev/breeze/src/airflow_breeze/params/build_ci_params.py
+++ b/dev/breeze/src/airflow_breeze/params/build_ci_params.py
@@ -57,38 +57,22 @@ class BuildCiParams(CommonBuildParams):
def prepare_arguments_for_docker_build_command(self) -> list[str]:
self.build_arg_values: list[str] = []
# Required build args
- self._req_arg("AIRFLOW_BRANCH", self.airflow_branch)
+ self._set_common_req_args()
self._req_arg("AIRFLOW_CONSTRAINTS_MODE",
self.airflow_constraints_mode)
self._req_arg("AIRFLOW_CONSTRAINTS_REFERENCE",
self.airflow_constraints_reference)
self._req_arg("AIRFLOW_EXTRAS", self.airflow_extras)
- self._req_arg("AIRFLOW_IMAGE_DATE_CREATED",
self.airflow_image_date_created)
- self._req_arg("AIRFLOW_IMAGE_REPOSITORY",
self.airflow_image_repository)
self._req_arg("AIRFLOW_USE_UV", self.use_uv)
if self.use_uv:
from airflow_breeze.utils.uv_utils import get_uv_timeout
self._opt_arg("UV_HTTP_TIMEOUT", get_uv_timeout(self))
self._req_arg("AIRFLOW_VERSION", self.airflow_version)
- self._req_arg("BUILD_ID", self.build_id)
- self._req_arg("CONSTRAINTS_GITHUB_REPOSITORY",
self.constraints_github_repository)
self._req_arg("PYTHON_BASE_IMAGE", self.python_base_image)
if self.upgrade_to_newer_dependencies:
self._opt_arg("UPGRADE_RANDOM_INDICATOR_STRING",
f"{random.randrange(2**32):x}")
# optional build args
- self._opt_arg("AIRFLOW_CONSTRAINTS_LOCATION",
self.airflow_constraints_location)
- self._opt_arg("ADDITIONAL_AIRFLOW_EXTRAS",
self.additional_airflow_extras)
- self._opt_arg("ADDITIONAL_DEV_APT_COMMAND",
self.additional_dev_apt_command)
- self._opt_arg("ADDITIONAL_DEV_APT_DEPS", self.additional_dev_apt_deps)
- self._opt_arg("ADDITIONAL_DEV_APT_ENV", self.additional_dev_apt_env)
- self._opt_arg("ADDITIONAL_PIP_INSTALL_FLAGS",
self.additional_pip_install_flags)
- self._opt_arg("ADDITIONAL_PYTHON_DEPS", self.additional_python_deps)
- self._opt_arg("BUILD_PROGRESS", self.build_progress)
- self._opt_arg("COMMIT_SHA", self.commit_sha)
- self._opt_arg("DEV_APT_COMMAND", self.dev_apt_command)
- self._opt_arg("DEV_APT_DEPS", self.dev_apt_deps)
- self._opt_arg("DOCKER_HOST", self.docker_host)
+ self._set_common_opt_args()
self._opt_arg("INSTALL_MYSQL_CLIENT_TYPE",
self.install_mysql_client_type)
- self._opt_arg("VERSION_SUFFIX_FOR_PYPI", self.version_suffix_for_pypi)
# Convert to build args
build_args = self._to_build_args()
# Add cache directive
diff --git a/dev/breeze/src/airflow_breeze/params/build_prod_params.py
b/dev/breeze/src/airflow_breeze/params/build_prod_params.py
index 2663a0aac4b..94d70ae508e 100644
--- a/dev/breeze/src/airflow_breeze/params/build_prod_params.py
+++ b/dev/breeze/src/airflow_breeze/params/build_prod_params.py
@@ -181,7 +181,9 @@ class BuildProdParams(CommonBuildParams):
)
maintainers = json.dumps([{"name": "Apache Airflow PMC", "email":
"[email protected]"}])
logo_url =
"https://github.com/apache/airflow/raw/main/airflow-core/docs/img/logos/wordmark_1.png"
- readme_url =
"https://raw.githubusercontent.com/apache/airflow/main/docs/docker-stack/README.md"
+ readme_url = (
+
"https://raw.githubusercontent.com/apache/airflow/refs/heads/main/docker-stack-docs/README.md"
+ )
extra_build_flags.extend(
[
"--label",
@@ -219,40 +221,26 @@ class BuildProdParams(CommonBuildParams):
def prepare_arguments_for_docker_build_command(self) -> list[str]:
self.build_arg_values: list[str] = []
# Required build args
- self._req_arg("AIRFLOW_BRANCH", self.airflow_branch)
+ self._set_common_req_args()
self._req_arg("AIRFLOW_CONSTRAINTS_MODE",
self.airflow_constraints_mode)
self._req_arg("AIRFLOW_EXTRAS", self.airflow_extras)
- self._req_arg("AIRFLOW_IMAGE_DATE_CREATED",
self.airflow_image_date_created)
self._req_arg("AIRFLOW_IMAGE_README_URL",
self.airflow_image_readme_url)
- self._req_arg("AIRFLOW_IMAGE_REPOSITORY",
self.airflow_image_repository)
self._opt_arg("AIRFLOW_USE_UV", self.use_uv)
if self.use_uv:
from airflow_breeze.utils.uv_utils import get_uv_timeout
self._req_arg("UV_HTTP_TIMEOUT", get_uv_timeout(self))
self._req_arg("AIRFLOW_VERSION", self.airflow_version)
- self._req_arg("BUILD_ID", self.build_id)
- self._req_arg("CONSTRAINTS_GITHUB_REPOSITORY",
self.constraints_github_repository)
self._req_arg("DOCKER_CONTEXT_FILES", self.docker_context_files)
self._req_arg("INSTALL_DISTRIBUTIONS_FROM_CONTEXT",
self.install_distributions_from_context)
self._req_arg("INSTALL_POSTGRES_CLIENT", self.install_postgres_client)
self._req_arg("PYTHON_BASE_IMAGE", self.python_base_image)
# optional build args
- self._opt_arg("AIRFLOW_CONSTRAINTS_LOCATION",
self.airflow_constraints_location)
- self._opt_arg("ADDITIONAL_AIRFLOW_EXTRAS",
self.additional_airflow_extras)
- self._opt_arg("ADDITIONAL_DEV_APT_COMMAND",
self.additional_dev_apt_command)
- self._opt_arg("ADDITIONAL_DEV_APT_DEPS", self.additional_dev_apt_deps)
- self._opt_arg("ADDITIONAL_DEV_APT_ENV", self.additional_dev_apt_env)
- self._opt_arg("ADDITIONAL_PIP_INSTALL_FLAGS",
self.additional_pip_install_flags)
- self._opt_arg("ADDITIONAL_PYTHON_DEPS", self.additional_python_deps)
+ self._set_common_opt_args()
self._opt_arg("ADDITIONAL_RUNTIME_APT_COMMAND",
self.additional_runtime_apt_command)
self._opt_arg("ADDITIONAL_RUNTIME_APT_DEPS",
self.additional_runtime_apt_deps)
self._opt_arg("ADDITIONAL_RUNTIME_APT_ENV",
self.additional_runtime_apt_env)
self._opt_arg("BUILD_PROGRESS", self.build_progress)
- self._opt_arg("COMMIT_SHA", self.commit_sha)
- self._opt_arg("DEV_APT_COMMAND", self.dev_apt_command)
- self._opt_arg("DEV_APT_DEPS", self.dev_apt_deps)
- self._opt_arg("DOCKER_HOST", self.docker_host)
self._req_arg("INSTALL_MSSQL_CLIENT", self.install_mssql_client)
self._opt_arg("INSTALL_MYSQL_CLIENT", self.install_mysql_client)
self._req_arg("INSTALL_MYSQL_CLIENT_TYPE",
self.install_mysql_client_type)
@@ -261,7 +249,6 @@ class BuildProdParams(CommonBuildParams):
self._opt_arg(
"USE_CONSTRAINTS_FOR_CONTEXT_DISTRIBUTIONS",
self.use_constraints_for_context_distributions
)
- self._opt_arg("VERSION_SUFFIX_FOR_PYPI", self.version_suffix_for_pypi)
build_args = self._to_build_args()
build_args.extend(self._extra_prod_docker_build_flags())
return build_args
diff --git a/dev/breeze/src/airflow_breeze/params/common_build_params.py
b/dev/breeze/src/airflow_breeze/params/common_build_params.py
index 711448cd680..d78426c7355 100644
--- a/dev/breeze/src/airflow_breeze/params/common_build_params.py
+++ b/dev/breeze/src/airflow_breeze/params/common_build_params.py
@@ -129,7 +129,7 @@ class CommonBuildParams:
@property
def airflow_image_readme_url(self):
- return
"https://raw.githubusercontent.com/apache/airflow/main/docs/docker-stack/README.md"
+ return
"https://raw.githubusercontent.com/apache/airflow/refs/heads/main/docker-stack-docs/README.md"
def get_cache(self, single_platform: str) -> str:
if "," in single_platform:
@@ -188,3 +188,24 @@ class CommonBuildParams:
# in case of any failure just fall back to the original version set
pass
return airflow_version
+
+ def _set_common_opt_args(self):
+ self._opt_arg("AIRFLOW_CONSTRAINTS_LOCATION",
self.airflow_constraints_location)
+ self._opt_arg("ADDITIONAL_AIRFLOW_EXTRAS",
self.additional_airflow_extras)
+ self._opt_arg("ADDITIONAL_DEV_APT_COMMAND",
self.additional_dev_apt_command)
+ self._opt_arg("ADDITIONAL_DEV_APT_DEPS", self.additional_dev_apt_deps)
+ self._opt_arg("ADDITIONAL_DEV_APT_ENV", self.additional_dev_apt_env)
+ self._opt_arg("ADDITIONAL_PIP_INSTALL_FLAGS",
self.additional_pip_install_flags)
+ self._opt_arg("ADDITIONAL_PYTHON_DEPS", self.additional_python_deps)
+ self._opt_arg("COMMIT_SHA", self.commit_sha)
+ self._opt_arg("DEV_APT_COMMAND", self.dev_apt_command)
+ self._opt_arg("DEV_APT_DEPS", self.dev_apt_deps)
+ self._opt_arg("DOCKER_HOST", self.docker_host)
+ self._opt_arg("VERSION_SUFFIX_FOR_PYPI", self.version_suffix_for_pypi)
+
+ def _set_common_req_args(self):
+ self._req_arg("AIRFLOW_BRANCH", self.airflow_branch)
+ self._req_arg("AIRFLOW_IMAGE_DATE_CREATED",
self.airflow_image_date_created)
+ self._req_arg("AIRFLOW_IMAGE_REPOSITORY",
self.airflow_image_repository)
+ self._req_arg("BUILD_ID", self.build_id)
+ self._req_arg("CONSTRAINTS_GITHUB_REPOSITORY",
self.constraints_github_repository)
diff --git a/dev/breeze/src/airflow_breeze/utils/recording.py
b/dev/breeze/src/airflow_breeze/utils/recording.py
index 879f20f3460..1138d27e87d 100644
--- a/dev/breeze/src/airflow_breeze/utils/recording.py
+++ b/dev/breeze/src/airflow_breeze/utils/recording.py
@@ -46,11 +46,11 @@ def enable_recording_of_help_output(path: str, title: str |
None, width: str | N
else:
width_int = int(width)
- def save_ouput_as_svg():
+ def save_output_as_svg():
if help_console:
help_console.save_svg(path=path, title=title, unique_id=unique_id)
- atexit.register(save_ouput_as_svg)
+ atexit.register(save_output_as_svg)
click.rich_click.MAX_WIDTH = width_int
click.formatting.FORCED_WIDTH = width_int - 2 # type: ignore[attr-defined]
click.rich_click.COLOR_SYSTEM = "standard"