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 367d619c756 Build published slim images with constraints without 
providers (#76798)
367d619c756 is described below

commit 367d619c756dfeebd93e654b588fcda6ea843688
Author: Jarek Potiuk <[email protected]>
AuthorDate: Tue Nov 10 09:46:32 2026 +0100

    Build published slim images with constraints without providers (#76798)
    
    The image release passed the constraints mode as AIRFLOW_CONSTRAINTS, which 
the
    Dockerfile does not read - it reads AIRFLOW_CONSTRAINTS_MODE. Docker ignores
    unknown build arguments, so slim images were silently built with the full
    constraints. Those pin the core dependencies to versions resolved together 
with
    every provider, rather than the constraints without providers that slim 
images
    are meant to use, and the constraints file stored in the image did not match
    what the docs say. Regular images were unaffected, as they rely on the 
default
    mode.
    
    Generated-by: Claude Opus 5
---
 .../commands/release_management_commands.py        |  3 +-
 .../tests/test_release_management_commands.py      | 46 ++++++++++++++++++++++
 2 files changed, 48 insertions(+), 1 deletion(-)

diff --git 
a/dev/breeze/src/airflow_breeze/commands/release_management_commands.py 
b/dev/breeze/src/airflow_breeze/commands/release_management_commands.py
index fc60a02a258..add447f80d3 100644
--- a/dev/breeze/src/airflow_breeze/commands/release_management_commands.py
+++ b/dev/breeze/src/airflow_breeze/commands/release_management_commands.py
@@ -100,6 +100,7 @@ from airflow_breeze.global_constants import (
     ALLOWED_PLATFORMS,
     APACHE_AIRFLOW_GITHUB_REPOSITORY,
     CONSTRAINTS,
+    CONSTRAINTS_NO_PROVIDERS,
     CURRENT_PYTHON_MAJOR_MINOR_VERSIONS,
     DEBIAN_VERSION_TO_HARDENED_IMAGE_DISTRO,
     DEFAULT_PYTHON_MAJOR_MINOR_VERSION,
@@ -2497,7 +2498,6 @@ def release_prod_images(
         image_type = "regular"
     for python in python_versions:
         build_args = {
-            "AIRFLOW_CONSTRAINTS": "constraints-no-providers",
             "BASE_IMAGE": get_hardened_python_base_image(python),
             "AIRFLOW_PYTHON_VERSION": 
ALL_PYTHON_VERSION_TO_PATCHLEVEL_VERSION.get(python, python),
             "AIRFLOW_VERSION": airflow_version,
@@ -2514,6 +2514,7 @@ def release_prod_images(
             build_args["COMMIT_SHA"] = commit_sha
         if slim_images:
             build_args["AIRFLOW_EXTRAS"] = ""
+            build_args["AIRFLOW_CONSTRAINTS_MODE"] = CONSTRAINTS_NO_PROVIDERS
         console_print(f"[info]Building {image_type} {airflow_version} image 
for Python {python}[/]")
         python_build_args = deepcopy(build_args)
         image_name = 
f"{dockerhub_repo}:{image_prefix}{airflow_version}-python{python}"
diff --git a/dev/breeze/tests/test_release_management_commands.py 
b/dev/breeze/tests/test_release_management_commands.py
index 37bfabdfcb5..118b52526b0 100644
--- a/dev/breeze/tests/test_release_management_commands.py
+++ b/dev/breeze/tests/test_release_management_commands.py
@@ -511,3 +511,49 @@ def test_publish_docs_to_s3_rejects_invalid_options(
     mock_generate_packages_metadata.assert_not_called()
     mock_publish_all.assert_not_called()
     mock_publish_stable.assert_not_called()
+
+
[email protected](
+    ("slim_flag", "expected_constraints_mode"),
+    [
+        pytest.param([], None, id="regular-uses-dockerfile-default"),
+        pytest.param(["--slim-images"], "constraints-no-providers", 
id="slim-without-providers"),
+    ],
+)
[email protected](release_management_commands, "check_docker_buildx_plugin", 
autospec=True)
[email protected](release_management_commands, "perform_environment_checks", 
autospec=True)
[email protected](release_management_commands, 
"check_remote_ghcr_io_commands", autospec=True)
[email protected](release_management_commands, 
"check_airflow_cache_builder_configured", autospec=True)
[email protected](release_management_commands, "run_command", autospec=True)
+def test_release_prod_images_constraints_mode(
+    mock_run_command,
+    mock_builder,
+    mock_ghcr,
+    mock_environment,
+    mock_buildx,
+    slim_flag,
+    expected_constraints_mode,
+    tmp_path,
+):
+    result = CliRunner().invoke(
+        release_management_commands.release_prod_images,
+        [
+            "--airflow-version",
+            "3.2.0",
+            "--python",
+            "3.12",
+            "--platform",
+            "linux/amd64",
+            "--metadata-folder",
+            str(tmp_path),
+            "--skip-latest",
+            *slim_flag,
+        ],
+        catch_exceptions=False,
+    )
+
+    assert result.exit_code == 0
+    command = mock_run_command.call_args.args[0]
+    build_args = dict(command[i + 1].split("=", 1) for i, arg in 
enumerate(command) if arg == "--build-arg")
+    assert build_args.get("AIRFLOW_CONSTRAINTS_MODE") == 
expected_constraints_mode
+    assert "AIRFLOW_CONSTRAINTS" not in build_args

Reply via email to