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 6844cce95e1 Fix --from-pr feature for image load and stabilize help
(#45575)
6844cce95e1 is described below
commit 6844cce95e1d02b06a2de7159db9eb2ea48ac74b
Author: Jarek Potiuk <[email protected]>
AuthorDate: Sat Jan 11 11:16:57 2025 +0100
Fix --from-pr feature for image load and stabilize help (#45575)
This is a follow-up after #45564 - it fixes the `--from-pr` and
`--from-run` to work (it was failing with file does not exist).
Also found out that gettempdir might return different directory
depending on which is your designated tmp directory (for example
in MacOS this is is a longer path in /var/.....) - so we have
to force the default during help generation to always return
"/tmp" so that the --help images do not change depending on which
system you are and what your tmp directory is.
---
dev/breeze/src/airflow_breeze/commands/ci_image_commands.py | 8 +++++---
dev/breeze/src/airflow_breeze/commands/common_image_options.py | 2 +-
2 files changed, 6 insertions(+), 4 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 772922d0e16..70d94e425bb 100644
--- a/dev/breeze/src/airflow_breeze/commands/ci_image_commands.py
+++ b/dev/breeze/src/airflow_breeze/commands/ci_image_commands.py
@@ -679,9 +679,6 @@ def load(
else:
image_file_to_load = image_file_dir / image_file
- if not image_file_to_load.exists():
- get_console().print(f"[error]The image {image_file_to_load} does not
exist.[/]")
- sys.exit(1)
if not image_file_to_load.name.endswith(f"-{python}.tar"):
get_console().print(
f"[error]The image file {image_file_to_load} does not end with
'-{python}.tar'. Exiting.[/]"
@@ -698,6 +695,11 @@ def load(
download_artifact_from_run_id(from_run, image_file_to_load,
github_repository, github_token)
elif from_pr:
download_artifact_from_pr(from_pr, image_file_to_load,
github_repository, github_token)
+
+ if not image_file_to_load.exists():
+ get_console().print(f"[error]The image {image_file_to_load} does not
exist.[/]")
+ sys.exit(1)
+
get_console().print(f"[info]Loading Python CI image from
{image_file_to_load}[/]")
result = run_command(["docker", "image", "load", "-i",
image_file_to_load.as_posix()], check=False)
if result.returncode != 0:
diff --git a/dev/breeze/src/airflow_breeze/commands/common_image_options.py
b/dev/breeze/src/airflow_breeze/commands/common_image_options.py
index ebab00c8e18..3c1e9ed0e82 100644
--- a/dev/breeze/src/airflow_breeze/commands/common_image_options.py
+++ b/dev/breeze/src/airflow_breeze/commands/common_image_options.py
@@ -227,6 +227,6 @@ option_image_file_dir = click.option(
readable=True,
path_type=Path,
),
- default=tempfile.gettempdir(),
+ default=tempfile.gettempdir() if not generating_command_images() else
"/tmp",
show_default=True,
)