You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ep...@apache.org on 2023/08/27 15:12:28 UTC

[airflow] branch main updated: Use PyPI constraints for PROD image in non-main branch (#33789)

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

ephraimanierobi 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 f9276f0597 Use PyPI constraints for PROD image in non-main branch (#33789)
f9276f0597 is described below

commit f9276f0597d5ad91c98d0db36d16d799ee2d4f21
Author: Jarek Potiuk <ja...@potiuk.com>
AuthorDate: Sun Aug 27 17:12:20 2023 +0200

    Use PyPI constraints for PROD image in non-main branch (#33789)
    
    When we are building PROD image in CI for non main branch, we are
    installing providers from PyPI rather than building them locally
    from sources. Therefore we should use `PyPI` constraints for
    such builds not the "source" constraints (they might differ).
    
    This PR adds two steps:
    
    * In the CI build, when we do not build providers we generate
      PyPI constraints additionally to source constraints
    * In the PROD build we use the PyPI constraints in case we
      do not build providers locally
---
 .github/actions/build-ci-images/action.yml   |  8 +++++++-
 .github/actions/build-prod-images/action.yml | 12 +++++++++++-
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/.github/actions/build-ci-images/action.yml b/.github/actions/build-ci-images/action.yml
index d43a425284..415819008c 100644
--- a/.github/actions/build-ci-images/action.yml
+++ b/.github/actions/build-ci-images/action.yml
@@ -34,12 +34,18 @@ runs:
     - name: "Build & Push AMD64 CI images ${{ env.IMAGE_TAG }} ${{ env.PYTHON_VERSIONS }}"
       shell: bash
       run: breeze ci-image build --push --tag-as-latest --run-in-parallel --upgrade-on-failure
-    - name: "Show dependencies to be upgraded"
+    - name: "Generate source constraints"
       shell: bash
       run: >
         breeze release-management generate-constraints --run-in-parallel
         --airflow-constraints-mode constraints-source-providers
       if: env.UPGRADE_TO_NEWER_DEPENDENCIES != 'false'
+    - name: "Generate PyPI constraints"
+      shell: bash
+      run: >
+        breeze release-management generate-constraints --run-in-parallel
+        --airflow-constraints-mode constraints
+      if: env.UPGRADE_TO_NEWER_DEPENDENCIES != 'false' and ${{ inputs.build-provider-packages != 'true' }}
     - name: "Print dependency upgrade summary"
       shell: bash
       run: |
diff --git a/.github/actions/build-prod-images/action.yml b/.github/actions/build-prod-images/action.yml
index feac8c2ef2..1223b5a7f1 100644
--- a/.github/actions/build-prod-images/action.yml
+++ b/.github/actions/build-prod-images/action.yml
@@ -62,7 +62,7 @@ runs:
         name: constraints
         path: ./docker-context-files
       if: env.UPGRADE_TO_NEWER_DEPENDENCIES != 'false'
-    - name: "Build & Push PROD images ${{ env.IMAGE_TAG }}:${{ env.PYTHON_VERSIONS }}"
+    - name: "Build & Push PROD images with source providers ${{ env.IMAGE_TAG }}:${{ env.PYTHON_VERSIONS }}"
       shell: bash
       run: >
         breeze prod-image build --tag-as-latest --run-in-parallel --push
@@ -70,6 +70,16 @@ runs:
         --use-constraints-for-context-packages
       env:
         COMMIT_SHA: ${{ github.sha }}
+      if: ${{ inputs.build-provider-packages == 'true' }}
+    - name: "Build & Push PROD images with PyPi providers ${{ env.IMAGE_TAG }}:${{ env.PYTHON_VERSIONS }}"
+      shell: bash
+      run: >
+        breeze prod-image build --tag-as-latest --run-in-parallel --push
+        --install-packages-from-context --airflow-constraints-mode constraints
+        --use-constraints-for-context-packages
+      env:
+        COMMIT_SHA: ${{ github.sha }}
+      if: ${{ inputs.build-provider-packages != 'true' }}
     - name: "Fix ownership"
       shell: bash
       run: breeze ci fix-ownership