You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "potiuk (via GitHub)" <gi...@apache.org> on 2025/05/04 14:44:19 UTC

[PR] Separate building release images to separate hardware [airflow]

potiuk opened a new pull request, #50176:
URL: https://github.com/apache/airflow/pull/50176

   So far, when we built release images in CI or locally we relied on either the emulation or having a builder configured that could handle having docker engines running at the same time on different hardware.
   
   That had some disadvantages:
   
   * for emulation, it was terribly slow.It was 10/15 times slower than building appropriate platform on appropriate hardware - making our image relase process taking more than hour. Also build output from both runs was interleaved which made it rather difficult to diagnose problems sometimes.
   
   * for using local builder, you needed to setup and authenticate with another docker engine, which required SSH connectivity and port forwarding and it was really not feasible for GitHub Actions where you cannot easily authenticate between separate runners and make sure they are reachable from each other.
   
   This PR implements different appreach - merging build images. Instead of building them together, the images are built as ``digest-only`` images and pushed to the registry and their metadata with digest is uploaded as artifacts. Then a separate merge step downloads the metadata and creates merged manifest where both images are referred to.
   
   This allows to build each image separately on a separate hardware - way faster in general (providing that we have an appropriate hypervisor capable hardware for each platform that we can build the images on.
   
   Part of #41935
   
   <!--
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at
   
      http://www.apache.org/licenses/LICENSE-2.0
   
    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.
    -->
   
   <!--
   Thank you for contributing! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   In case of an existing issue, reference it using one of the following:
   
   closes: #ISSUE
   related: #ISSUE
   
   How to write a good git commit message:
   http://chris.beams.io/posts/git-commit/
   -->
   
   
   
   <!-- Please keep an empty line above the dashes. -->
   ---
   **^ Add meaningful description above**
   Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)** for more information.
   In case of fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in a newsfragment file, named `{pr_number}.significant.rst` or `{issue_number}.significant.rst`, in [airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Separate building release images to separate hardware [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #50176:
URL: https://github.com/apache/airflow/pull/50176#discussion_r2072649294


##########
.github/workflows/release_dockerhub_image.yml:
##########
@@ -82,26 +93,27 @@ jobs:
         env:
           VERBOSE: "false"
         run: breeze ci selective-check 2>> ${GITHUB_OUTPUT}
+      - name: "Determine build matrix"
+        shell: bash
+        id: determine-matrix
+        run: |
+          if [[ "${AMD_ONLY}" = "true" ]]; then
+             echo 'platform-matrix=["linux/amd64"]' >> "${GITHUB_OUTPUT}"
+          else
+                echo 'platform-matrix=["linux/amd64", "linux/arm64"]' >> "${GITHUB_OUTPUT}"
+          fi
 
-  release-images:
-    timeout-minutes: 120
-    name: "Release images: ${{ github.event.inputs.airflowVersion }}, ${{ matrix.python-version }}"
-    runs-on: ["ubuntu-22.04"]
+  build-images:
+    timeout-minutes: 50
+    # yamllint disable rule:line-length
+    name: "Build: ${{ github.event.inputs.airflowVersion }}, ${{ matrix.python-version }}, ${{ matrix.platform }}"
+    runs-on: ${{ matrix.platform == 'linux/amd64' && fromJSON('["ubuntu-22.04"]') || fromJSON('["asf-arm"]') }}

Review Comment:
   Actually.. It turns out that we can :). Seems that public `ubuntu-22.04-arm` runners work well.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Separate building release images to separate hardware [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk merged PR #50176:
URL: https://github.com/apache/airflow/pull/50176


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Separate building release images to separate hardware [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #50176:
URL: https://github.com/apache/airflow/pull/50176#discussion_r2072704336


##########
.github/workflows/release_dockerhub_image.yml:
##########
@@ -145,90 +172,124 @@ jobs:
           sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
           sudo apt-get update
           sudo apt install docker-buildx-plugin
-      - name: "Install emulation support"
-        run: docker run --privileged --rm tonistiigi/binfmt --install all
-      - name: "Install regctl"
-        # yamllint disable rule:line-length
-        run: |
-          mkdir -p ~/bin
-          curl -L https://github.com/regclient/regclient/releases/latest/download/regctl-linux-amd64 >${HOME}/bin/regctl
-          chmod 755 ${HOME}/bin/regctl
-          echo "${HOME}/bin" >>${GITHUB_PATH}
       - name: "Create airflow_cache builder"
-        run: docker buildx create --name airflow_cache
+        run: docker buildx create --name airflow_cache --driver docker-container
       - name: >
-          Release regular images AMD64 first: ${{ github.event.inputs.airflowVersion }}, ${{ matrix.python-version }}
-        env:
-          COMMIT_SHA: ${{ github.sha }}
-          REPOSITORY: ${{ github.repository }}
-          PYTHON_VERSION: ${{ matrix.python-version }}
-          AIRFLOW_VERSION: ${{ github.event.inputs.airflowVersion }}
-          SKIP_LATEST: ${{ needs.build-info.outputs.skipLatest == 'true' && '--skip-latest' || '' }}
+          Build regular images: ${{ github.event.inputs.airflowVersion }}, ${{ matrix.python-version }}, ${{ matrix.platform }}
         run: >
           breeze release-management release-prod-images --dockerhub-repo "${REPOSITORY}"
           --airflow-version "${AIRFLOW_VERSION}" ${SKIP_LATEST}
-          --limit-python ${PYTHON_VERSION} --limit-platform linux/amd64
+          --python ${PYTHON_MAJOR_MINOR_VERSION}
+          --metadata-folder dist
       - name: >
-          Verify regular AMD64 image: ${{ github.event.inputs.airflowVersion }}, ${{ matrix.python-version }}
-        env:
-          PYTHON_VERSION: ${{ matrix.python-version }}
-          AIRFLOW_VERSION: ${{ github.event.inputs.airflowVersion }}
-          REPOSITORY: ${{ github.repository }}
+          Verify regular image: ${{ github.event.inputs.airflowVersion }}, ${{ matrix.python-version }}, ${{ matrix.platform }}
         run: >
-          breeze prod-image verify
-          --pull
-          --image-name
-          ${REPOSITORY}:${AIRFLOW_VERSION}-python${PYTHON_VERSION}
+          breeze prod-image verify --pull --manifest-file dist/${MANIFEST_FILE_NAME}
       - name: >
-          Release slim images AMD64 first: ${{ github.event.inputs.airflowVersion }}, ${{ matrix.python-version }}
-        env:
-          COMMIT_SHA: ${{ github.sha }}
-          REPOSITORY: ${{ github.repository }}
-          PYTHON_VERSION: ${{ matrix.python-version }}
-          AIRFLOW_VERSION: ${{ github.event.inputs.airflowVersion }}
-          SKIP_LATEST: ${{ needs.build-info.outputs.skipLatest == 'true' && '--skip-latest' || '' }}
+          Release slim images: ${{ github.event.inputs.airflowVersion }}, ${{ matrix.python-version }}, ${{ matrix.platform }}
         run: >
           breeze release-management release-prod-images --dockerhub-repo "${REPOSITORY}"
           --airflow-version "${AIRFLOW_VERSION}" ${SKIP_LATEST}
-          --limit-python ${PYTHON_VERSION} --slim-images --limit-platform linux/amd64
+          --python ${PYTHON_MAJOR_MINOR_VERSION} --slim-images
+          --metadata-folder dist
       - name: >
-          Verify slim AMD64 image: ${{ github.event.inputs.airflowVersion }}, ${{ matrix.python-version }}
-        env:
-          PYTHON_VERSION: ${{ matrix.python-version }}
-          AIRFLOW_VERSION: ${{ github.event.inputs.airflowVersion }}
-          REPOSITORY: ${{ github.repository }}
+          Verify slim image: ${{ github.event.inputs.airflowVersion }}, ${{ matrix.python-version }}, ${{ matrix.platform }}
         run: >
-          breeze prod-image verify
-          --pull
-          --slim-image
-          --image-name
-          ${REPOSITORY}:slim-${AIRFLOW_VERSION}-python${PYTHON_VERSION}
-      - name: >
-          Release regular images for both AMD / ARM: ${{ github.event.inputs.airflowVersion }}, ${{ matrix.python-version }}
+          breeze prod-image verify --pull --slim-image --manifest-file dist/${MANIFEST_SLIM_FILE_NAME}
+      - name: "Upload metadata artifacts"

Review Comment:
   Yep....



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Separate building release images to separate hardware [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #50176:
URL: https://github.com/apache/airflow/pull/50176#discussion_r2072636524


##########
.github/workflows/release_dockerhub_image.yml:
##########
@@ -82,26 +93,27 @@ jobs:
         env:
           VERBOSE: "false"
         run: breeze ci selective-check 2>> ${GITHUB_OUTPUT}
+      - name: "Determine build matrix"
+        shell: bash
+        id: determine-matrix
+        run: |
+          if [[ "${AMD_ONLY}" = "true" ]]; then
+             echo 'platform-matrix=["linux/amd64"]' >> "${GITHUB_OUTPUT}"
+          else
+                echo 'platform-matrix=["linux/amd64", "linux/arm64"]' >> "${GITHUB_OUTPUT}"
+          fi
 
-  release-images:
-    timeout-minutes: 120
-    name: "Release images: ${{ github.event.inputs.airflowVersion }}, ${{ matrix.python-version }}"
-    runs-on: ["ubuntu-22.04"]
+  build-images:
+    timeout-minutes: 50
+    # yamllint disable rule:line-length
+    name: "Build: ${{ github.event.inputs.airflowVersion }}, ${{ matrix.python-version }}, ${{ matrix.platform }}"
+    runs-on: ${{ matrix.platform == 'linux/amd64' && fromJSON('["ubuntu-22.04"]') || fromJSON('["asf-arm"]') }}

Review Comment:
   Unfortunately - we cannot merge that one yet. The Arm self-hosted images we have available from INFRA do not have hypervisors and we cannot really start docker on them and build the images. We might maybe want to do it with Podman (I will try) but I'd strongly prefer to have our K8S-ARC controlled ARM runners for those.
   
   cc: @hussein-awala 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Separate building release images to separate hardware [airflow]

Posted by "gopidesupavan (via GitHub)" <gi...@apache.org>.
gopidesupavan commented on code in PR #50176:
URL: https://github.com/apache/airflow/pull/50176#discussion_r2072687970


##########
.github/workflows/release_dockerhub_image.yml:
##########
@@ -145,90 +172,124 @@ jobs:
           sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
           sudo apt-get update
           sudo apt install docker-buildx-plugin
-      - name: "Install emulation support"
-        run: docker run --privileged --rm tonistiigi/binfmt --install all
-      - name: "Install regctl"
-        # yamllint disable rule:line-length
-        run: |
-          mkdir -p ~/bin
-          curl -L https://github.com/regclient/regclient/releases/latest/download/regctl-linux-amd64 >${HOME}/bin/regctl
-          chmod 755 ${HOME}/bin/regctl
-          echo "${HOME}/bin" >>${GITHUB_PATH}
       - name: "Create airflow_cache builder"
-        run: docker buildx create --name airflow_cache
+        run: docker buildx create --name airflow_cache --driver docker-container
       - name: >
-          Release regular images AMD64 first: ${{ github.event.inputs.airflowVersion }}, ${{ matrix.python-version }}
-        env:
-          COMMIT_SHA: ${{ github.sha }}
-          REPOSITORY: ${{ github.repository }}
-          PYTHON_VERSION: ${{ matrix.python-version }}
-          AIRFLOW_VERSION: ${{ github.event.inputs.airflowVersion }}
-          SKIP_LATEST: ${{ needs.build-info.outputs.skipLatest == 'true' && '--skip-latest' || '' }}
+          Build regular images: ${{ github.event.inputs.airflowVersion }}, ${{ matrix.python-version }}, ${{ matrix.platform }}
         run: >
           breeze release-management release-prod-images --dockerhub-repo "${REPOSITORY}"
           --airflow-version "${AIRFLOW_VERSION}" ${SKIP_LATEST}
-          --limit-python ${PYTHON_VERSION} --limit-platform linux/amd64
+          --python ${PYTHON_MAJOR_MINOR_VERSION}
+          --metadata-folder dist
       - name: >
-          Verify regular AMD64 image: ${{ github.event.inputs.airflowVersion }}, ${{ matrix.python-version }}
-        env:
-          PYTHON_VERSION: ${{ matrix.python-version }}
-          AIRFLOW_VERSION: ${{ github.event.inputs.airflowVersion }}
-          REPOSITORY: ${{ github.repository }}
+          Verify regular image: ${{ github.event.inputs.airflowVersion }}, ${{ matrix.python-version }}, ${{ matrix.platform }}
         run: >
-          breeze prod-image verify
-          --pull
-          --image-name
-          ${REPOSITORY}:${AIRFLOW_VERSION}-python${PYTHON_VERSION}
+          breeze prod-image verify --pull --manifest-file dist/${MANIFEST_FILE_NAME}
       - name: >
-          Release slim images AMD64 first: ${{ github.event.inputs.airflowVersion }}, ${{ matrix.python-version }}
-        env:
-          COMMIT_SHA: ${{ github.sha }}
-          REPOSITORY: ${{ github.repository }}
-          PYTHON_VERSION: ${{ matrix.python-version }}
-          AIRFLOW_VERSION: ${{ github.event.inputs.airflowVersion }}
-          SKIP_LATEST: ${{ needs.build-info.outputs.skipLatest == 'true' && '--skip-latest' || '' }}
+          Release slim images: ${{ github.event.inputs.airflowVersion }}, ${{ matrix.python-version }}, ${{ matrix.platform }}
         run: >
           breeze release-management release-prod-images --dockerhub-repo "${REPOSITORY}"
           --airflow-version "${AIRFLOW_VERSION}" ${SKIP_LATEST}
-          --limit-python ${PYTHON_VERSION} --slim-images --limit-platform linux/amd64
+          --python ${PYTHON_MAJOR_MINOR_VERSION} --slim-images
+          --metadata-folder dist
       - name: >
-          Verify slim AMD64 image: ${{ github.event.inputs.airflowVersion }}, ${{ matrix.python-version }}
-        env:
-          PYTHON_VERSION: ${{ matrix.python-version }}
-          AIRFLOW_VERSION: ${{ github.event.inputs.airflowVersion }}
-          REPOSITORY: ${{ github.repository }}
+          Verify slim image: ${{ github.event.inputs.airflowVersion }}, ${{ matrix.python-version }}, ${{ matrix.platform }}
         run: >
-          breeze prod-image verify
-          --pull
-          --slim-image
-          --image-name
-          ${REPOSITORY}:slim-${AIRFLOW_VERSION}-python${PYTHON_VERSION}
-      - name: >
-          Release regular images for both AMD / ARM: ${{ github.event.inputs.airflowVersion }}, ${{ matrix.python-version }}
+          breeze prod-image verify --pull --slim-image --manifest-file dist/${MANIFEST_SLIM_FILE_NAME}
+      - name: "Upload metadata artifacts"

Review Comment:
   ```suggestion
         - name: "Upload metadata artifacts: ${{ env.ARTIFACT_NAME }}"
   ```
   
   Just to see step name with artifact that uploaded :)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Separate building release images to separate hardware [airflow]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #50176:
URL: https://github.com/apache/airflow/pull/50176#issuecomment-2849410004

   ### Backport failed to create: v3-0-test. View the failure log <a href='https://github.com/apache/airflow/actions/runs/14825039383'> Run details </a>
   
   <table>
       <tr>
           <th>Status</th>
           <th>Branch</th>
           <th>Result</th>
       </tr>
       <tr>
           <td>❌</td>
           <td>v3-0-test</td>
           <td><a href="https://github.com/apache/airflow/commit/bc44a329e9e2f46eba591e084c443f94aa5dde08"><img src='https://img.shields.io/badge/Commit-bc44a32-red' alt='Commit Link'></a></td>
       </tr>
   </table>
   
   You can attempt to backport this manually by running:
   
   ```bash
   cherry_picker bc44a32 v3-0-test
   ```
   
   This should apply the commit to the v3-0-test branch and leave the commit in conflict state marking
   the files that need manual conflict resolution.
   
   After you have resolved the conflicts, you can continue the backport process by running:
   
   ```bash
   cherry_picker --continue
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org