You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/05/20 12:23:13 UTC

[GitHub] [airflow] potiuk commented on a change in pull request #15944: Streamline Build Images workflow using new GitHub Actions features

potiuk commented on a change in pull request #15944:
URL: https://github.com/apache/airflow/pull/15944#discussion_r636050674



##########
File path: .github/workflows/build-images-workflow-run.yml
##########
@@ -1,561 +0,0 @@
-# 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.
-#
----
-name: "Build Images"
-on:  # yamllint disable-line rule:truthy
-  workflow_run:
-    workflows: ["CI Build"]
-    types: ['requested']
-env:
-  MOUNT_SELECTED_LOCAL_SOURCES: "false"
-  FORCE_ANSWER_TO_QUESTIONS: "yes"
-  FORCE_PULL_IMAGES: "false"
-  CHECK_IMAGE_FOR_REBUILD: "true"
-  SKIP_CHECK_REMOTE_IMAGE: "true"
-  DB_RESET: "true"
-  VERBOSE: "true"
-  USE_GITHUB_REGISTRY: "true"
-  GITHUB_REPOSITORY: ${{ github.repository }}
-  GITHUB_USERNAME: ${{ github.actor }}
-  # You can override CONSTRAINTS_GITHUB_REPOSITORY by setting secret in your repo but by default the
-  # Airflow one is going to be used
-  CONSTRAINTS_GITHUB_REPOSITORY: >-
-    ${{ secrets.CONSTRAINTS_GITHUB_REPOSITORY != '' &&
-        secrets.CONSTRAINTS_GITHUB_REPOSITORY || 'apache/airflow' }}
-  # This token is WRITE one - workflow_run type of events always have the WRITE token
-  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-  # This token should not be empty in workflow_run type of event.
-  CONTAINER_REGISTRY_TOKEN: ${{ secrets.PAT_CR }}
-  GITHUB_REGISTRY_PULL_IMAGE_TAG: "latest"
-  GITHUB_REGISTRY_WAIT_FOR_IMAGE: "false"
-  BUILD_IMAGES: ${{ secrets.AIRFLOW_GITHUB_REGISTRY_WAIT_FOR_IMAGE != 'false' }}
-  INSTALL_PROVIDERS_FROM_SOURCES: "true"
-  GITHUB_REGISTRY: ${{ secrets.OVERRIDE_GITHUB_REGISTRY }}
-
-jobs:
-
-  cancel-workflow-runs:
-    timeout-minutes: 10
-    name: "Cancel workflow runs"
-    runs-on: ${{ github.repository == 'apache/airflow' && 'self-hosted' || 'ubuntu-20.04' }}
-    outputs:
-      sourceHeadRepo: ${{ steps.source-run-info.outputs.sourceHeadRepo }}
-      sourceHeadBranch: ${{ steps.source-run-info.outputs.sourceHeadBranch }}
-      sourceHeadSha: ${{ steps.source-run-info.outputs.sourceHeadSha }}
-      mergeCommitSha: ${{ steps.source-run-info.outputs.mergeCommitSha }}
-      targetCommitSha: ${{ steps.source-run-info.outputs.targetCommitSha }}
-      pullRequestNumber: ${{ steps.source-run-info.outputs.pullRequestNumber }}
-      pullRequestLabels: ${{ steps.source-run-info.outputs.pullRequestLabels }}
-      targetBranch: ${{ steps.source-run-info.outputs.targetBranch }}
-      sourceEvent: ${{ steps.source-run-info.outputs.sourceEvent }}
-      cacheDirective: ${{ steps.cache-directive.outputs.docker-cache }}
-      buildImages: ${{ steps.build-images.outputs.buildImages }}
-      runsOn: ${{ github.repository == 'apache/airflow' && '["self-hosted"]' || '["ubuntu-20.04"]' }}
-    steps:
-      - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
-        uses: actions/checkout@v2
-        with:
-          persist-credentials: false
-          submodules: recursive
-      - name: "Get information about the original trigger of the run"
-        uses: ./.github/actions/get-workflow-origin
-        id: source-run-info
-        with:
-          token: ${{ secrets.GITHUB_TOKEN }}
-          sourceRunId: ${{ github.event.workflow_run.id }}
-      - name: "Cancel duplicated 'CI Build' runs"
-        uses: ./.github/actions/cancel-workflow-runs
-        with:
-          token: ${{ secrets.GITHUB_TOKEN }}
-          cancelMode: allDuplicates
-          sourceRunId: ${{ github.event.workflow_run.id }}
-      - name: "Output BUILD_IMAGES"
-        id: build-images
-        run: |
-          # Workaround - jobs cannot access env variable in "ifs"
-          # https://github.community/t/how-to-set-and-access-a-workflow-variable/17335/16
-          echo "::set-output name=buildImages::${BUILD_IMAGES}"
-      - name: "Cancel duplicated 'Build Image' runs"
-        # We find duplicates of our own "Build Image" runs - due to a missing feature
-        # in GitHub Actions, we have to use Job names to match Event/Repo/Branch matching
-        # trick ¯\_(ツ)_/¯. We name the build-info job appropriately
-        # and then we try to find and cancel all the jobs with the same Event + Repo + Branch as the
-        # current Event/Repo/Branch combination.
-        uses: ./.github/actions/cancel-workflow-runs
-        with:
-          cancelMode: namedJobs
-          token: ${{ secrets.GITHUB_TOKEN }}
-          notifyPRCancel: true
-          jobNameRegexps: >
-            [".*Event: ${{ steps.source-run-info.outputs.sourceEvent }}
-            Repo: ${{ steps.source-run-info.outputs.sourceHeadRepo }}
-            Branch: ${{ steps.source-run-info.outputs.sourceHeadBranch }}.*"]
-        if: env.BUILD_IMAGES == 'true'
-      - name: "Cancel all 'CI Build' runs where some jobs failed"
-        # We find any of the "CI Build" workflow runs, where any of the important jobs
-        # failed. The important jobs are selected by the regexp array below.
-        # We also produce list of canceled "CI Build' runs as output, so that we
-        # can cancel all the matching "Build Images" workflow runs in the two following steps.
-        # Yeah. Adding to the complexity ¯\_(ツ)_/¯.
-        uses: ./.github/actions/cancel-workflow-runs
-        id: cancel-failed
-        with:
-          token: ${{ secrets.GITHUB_TOKEN }}
-          cancelMode: failedJobs
-          sourceRunId: ${{ github.event.workflow_run.id }}
-          notifyPRCancel: true
-          jobNameRegexps: >
-            ["^Pylint$", "^Static checks", "^Build docs$", "^Spell check docs$",
-             "^Provider packages", "^Checks: Helm tests$", "^Test OpenAPI*"]

Review comment:
       It's an optimisation only, and I am not sure if thats' so much needed after we sped up most of the builds.




-- 
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.

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