This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch v3-0-test
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/v3-0-test by this push:
     new 6baf9dd1c44 [v3-0-test] Fix building PROD images with uv (#51277) 
(#51289)
6baf9dd1c44 is described below

commit 6baf9dd1c4419e770ce0de23185a5303b1279c8b
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Mon Jun 2 11:05:08 2025 +0200

    [v3-0-test] Fix building PROD images with uv (#51277) (#51289)
    
    When we are building PROD image we use `pip` rather than `uv`, however
    we should be able to use `uv` to do it. Recently we had a bug that
    broke it - by using `--group dev` unconditionally - even if
    we used airflow packages to build airflow.
    
    So far we always run the PROD build with `pip` that's why it worked
    fine, but once fix building with both uv and pip we can build the
    images with uv by default and run a pip build separately in extra
    checks.
    (cherry picked from commit 92a4d601c91a2188f184c7579f92786de286b8d2)
    
    
    Fixes: #50134
    
    Co-authored-by: Jarek Potiuk <[email protected]>
---
 .github/workflows/additional-prod-image-tests.yml | 2 --
 .github/workflows/prod-image-build.yml            | 1 +
 .github/workflows/prod-image-extra-checks.yml     | 6 +-----
 Dockerfile                                        | 7 ++++++-
 Dockerfile.ci                                     | 7 ++++++-
 scripts/docker/common.sh                          | 7 ++++++-
 6 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/.github/workflows/additional-prod-image-tests.yml 
b/.github/workflows/additional-prod-image-tests.yml
index f8a5d7cb4ec..a2e9deed6df 100644
--- a/.github/workflows/additional-prod-image-tests.yml
+++ b/.github/workflows/additional-prod-image-tests.yml
@@ -72,7 +72,6 @@ jobs:
       python-versions: "[ '${{ inputs.default-python-version }}' ]"
       default-python-version: ${{ inputs.default-python-version }}
       branch: ${{ inputs.default-branch }}
-      use-uv: "false"
       upgrade-to-newer-dependencies: ${{ inputs.upgrade-to-newer-dependencies 
}}
       constraints-branch: ${{ inputs.constraints-branch }}
       docker-cache: ${{ inputs.docker-cache }}
@@ -88,7 +87,6 @@ jobs:
       python-versions: "[ '${{ inputs.default-python-version }}' ]"
       default-python-version: ${{ inputs.default-python-version }}
       branch: ${{ inputs.default-branch }}
-      use-uv: "false"
       upgrade-to-newer-dependencies: ${{ inputs.upgrade-to-newer-dependencies 
}}
       constraints-branch: ${{ inputs.constraints-branch }}
       docker-cache: ${{ inputs.docker-cache }}
diff --git a/.github/workflows/prod-image-build.yml 
b/.github/workflows/prod-image-build.yml
index 4b0ff29714f..c5cf5cd5cef 100644
--- a/.github/workflows/prod-image-build.yml
+++ b/.github/workflows/prod-image-build.yml
@@ -267,6 +267,7 @@ jobs:
           INSTALL_MYSQL_CLIENT_TYPE: ${{ inputs.install-mysql-client-type }}
           UPGRADE_TO_NEWER_DEPENDENCIES: ${{ 
inputs.upgrade-to-newer-dependencies }}
           INCLUDE_NOT_READY_PROVIDERS: "true"
+          USE_UV: ${{ inputs.use-uv }}
       - name: "Verify PROD image ${{ env.PYTHON_MAJOR_MINOR_VERSION }}"
         run: breeze prod-image verify
       - name: "Export PROD docker image ${{ env.PYTHON_MAJOR_MINOR_VERSION }}"
diff --git a/.github/workflows/prod-image-extra-checks.yml 
b/.github/workflows/prod-image-extra-checks.yml
index 4f6ce6c7629..c72bef7003b 100644
--- a/.github/workflows/prod-image-extra-checks.yml
+++ b/.github/workflows/prod-image-extra-checks.yml
@@ -40,10 +40,6 @@ on:  # yamllint disable-line rule:truthy
         description: "Branch used to run the CI jobs in (main/v*_*_test)."
         required: true
         type: string
-      use-uv:
-        description: "Whether to use uv to build the image (true/false)"
-        required: true
-        type: string
       upgrade-to-newer-dependencies:
         description: "Whether to attempt to upgrade image to newer 
dependencies (false/RANDOM_VALUE)"
         required: true
@@ -77,7 +73,7 @@ jobs:
       branch: ${{ inputs.branch }}
       # Always build images during the extra checks and never push them
       push-image: "false"
-      use-uv: ${{ inputs.use-uv }}
+      use-uv: "true"
       upgrade-to-newer-dependencies: ${{ inputs.upgrade-to-newer-dependencies 
}}
       constraints-branch: ${{ inputs.constraints-branch }}
       docker-cache: ${{ inputs.docker-cache }}
diff --git a/Dockerfile b/Dockerfile
index 9815e4748f2..0ca2986087d 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -455,7 +455,12 @@ function common::get_packaging_tool() {
         echo
         export PACKAGING_TOOL="uv"
         export PACKAGING_TOOL_CMD="uv pip"
-        export EXTRA_INSTALL_FLAGS="--group=dev"
+        if [[ ${AIRFLOW_INSTALLATION_METHOD=} == "." && -f "./pyproject.toml" 
]]; then
+            # for uv only install dev group when we install from sources
+            export EXTRA_INSTALL_FLAGS="--group=dev"
+        else
+            export EXTRA_INSTALL_FLAGS=""
+        fi
         export EXTRA_UNINSTALL_FLAGS=""
         export UPGRADE_TO_HIGHEST_RESOLUTION="--upgrade --resolution highest"
         export UPGRADE_IF_NEEDED="--upgrade"
diff --git a/Dockerfile.ci b/Dockerfile.ci
index f7631df1575..4c46efbf2dc 100644
--- a/Dockerfile.ci
+++ b/Dockerfile.ci
@@ -394,7 +394,12 @@ function common::get_packaging_tool() {
         echo
         export PACKAGING_TOOL="uv"
         export PACKAGING_TOOL_CMD="uv pip"
-        export EXTRA_INSTALL_FLAGS="--group=dev"
+        if [[ ${AIRFLOW_INSTALLATION_METHOD=} == "." && -f "./pyproject.toml" 
]]; then
+            # for uv only install dev group when we install from sources
+            export EXTRA_INSTALL_FLAGS="--group=dev"
+        else
+            export EXTRA_INSTALL_FLAGS=""
+        fi
         export EXTRA_UNINSTALL_FLAGS=""
         export UPGRADE_TO_HIGHEST_RESOLUTION="--upgrade --resolution highest"
         export UPGRADE_IF_NEEDED="--upgrade"
diff --git a/scripts/docker/common.sh b/scripts/docker/common.sh
index a90c1cdcd27..4568aa2183b 100644
--- a/scripts/docker/common.sh
+++ b/scripts/docker/common.sh
@@ -42,7 +42,12 @@ function common::get_packaging_tool() {
         echo
         export PACKAGING_TOOL="uv"
         export PACKAGING_TOOL_CMD="uv pip"
-        export EXTRA_INSTALL_FLAGS="--group=dev"
+        if [[ ${AIRFLOW_INSTALLATION_METHOD=} == "." && -f "./pyproject.toml" 
]]; then
+            # for uv only install dev group when we install from sources
+            export EXTRA_INSTALL_FLAGS="--group=dev"
+        else
+            export EXTRA_INSTALL_FLAGS=""
+        fi
         export EXTRA_UNINSTALL_FLAGS=""
         export UPGRADE_TO_HIGHEST_RESOLUTION="--upgrade --resolution highest"
         export UPGRADE_IF_NEEDED="--upgrade"

Reply via email to