This is an automated email from the ASF dual-hosted git repository.
shahar1 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 383a9a87a98 Stop wiping the uv cache before every CI image build
(#74052)
383a9a87a98 is described below
commit 383a9a87a98a8999171766b2e8e91a7d4f6e29fe
Author: Yossi Eliaz <[email protected]>
AuthorDate: Fri Oct 2 08:51:14 2026 +0300
Stop wiping the uv cache before every CI image build (#74052)
Every CI image build restores the uv cache saved from main and imports it
into
the BuildKit cache mount, then ran `docker system prune -f`, which also
removes
unused build cache, including that freshly filled mount. Each build
therefore
recompiled lxml, xmlsec, krb5 and gssapi from source, about four minutes on
amd64 and three on arm64, before any test job could start.
---
.../src/airflow_breeze/commands/ci_image_commands.py | 4 +++-
dev/breeze/tests/test_ci_image_commands.py | 20 ++++++++++++++++++++
2 files changed, 23 insertions(+), 1 deletion(-)
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 38dd2c7e52d..fb7f175cac1 100644
--- a/dev/breeze/src/airflow_breeze/commands/ci_image_commands.py
+++ b/dev/breeze/src/airflow_breeze/commands/ci_image_commands.py
@@ -1106,7 +1106,9 @@ def import_mount_cache(
console_print("[info]Built temporary image and copied cache[/]")
console_print("[info]Removing temporary image[/]")
run_command(["docker", "rmi", "airflow-import-cache"], check=True)
- run_command(["docker", "system", "prune", "-f"], check=True)
+ # Not `docker system prune`: it also removes unused build cache, which
includes the cache
+ # mount that was just filled, so the next build would start with an empty
uv cache.
+ run_command(["docker", "image", "prune", "-f"], check=True)
console_print("[info]Built temporary image and copying context[/]")
console_print(f"[info]Removing context: {context}[/]")
context_cache_file.unlink()
diff --git a/dev/breeze/tests/test_ci_image_commands.py
b/dev/breeze/tests/test_ci_image_commands.py
index 492385b71de..47b66889227 100644
--- a/dev/breeze/tests/test_ci_image_commands.py
+++ b/dev/breeze/tests/test_ci_image_commands.py
@@ -26,6 +26,7 @@ from airflow_breeze.commands.ci_image_commands import (
build_ci_image_if_needed,
confirm_build_if_sources_changed,
get_ci_image_sources_hash_label,
+ import_mount_cache,
is_ci_image_built_from_current_sources,
)
from airflow_breeze.global_constants import CI_IMAGE_SOURCES_HASH_LABEL
@@ -186,3 +187,22 @@ def
test_build_ci_image_if_needed_does_not_query_docker_when_marker_present(
mock_check_if_image_building_is_needed.return_value = False
build_ci_image_if_needed(command_params=command_params)
mock_is_ci_image_built_from_current_sources.assert_not_called()
+
+
[email protected]("airflow_breeze.commands.ci_image_commands.run_command",
autospec=True)
[email protected]("airflow_breeze.commands.ci_image_commands.make_sure_builder_configured",
autospec=True)
[email protected]("airflow_breeze.commands.ci_image_commands.perform_environment_checks",
autospec=True)
+def test_import_mount_cache_does_not_prune_the_imported_cache_mount(
+ mock_perform_environment_checks,
+ mock_make_sure_builder_configured,
+ mock_run_command,
+ tmp_path,
+):
+ cache_file = tmp_path / "ci-cache-mount-save-v3-3.10.tar.gz"
+ cache_file.write_bytes(b"")
+ import_mount_cache.callback(builder="autodetect", cache_file=cache_file)
+ commands = [call.args[0] for call in mock_run_command.call_args_list]
+ assert commands[-2:] == [
+ ["docker", "rmi", "airflow-import-cache"],
+ ["docker", "image", "prune", "-f"],
+ ]