You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2021/03/25 19:31:43 UTC

[airflow] branch master updated: Skips provider package builds and provider tests for non-master (#14996)

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

potiuk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/master by this push:
     new db9febd  Skips provider package builds and provider tests for non-master (#14996)
db9febd is described below

commit db9febdb3be97832679d2ced8028fd7f1c21cd4e
Author: Jarek Potiuk <ja...@potiuk.com>
AuthorDate: Thu Mar 25 20:31:20 2021 +0100

    Skips provider package builds and provider tests for non-master (#14996)
    
    This PR skips building Provider packages for branches different
    than master. Provider packages are always released from master
    but never from any other branch so there is no point in running
    the package building and tests there
---
 .github/workflows/ci.yml          |  8 ++++----
 PULL_REQUEST_WORKFLOW.rst         |  9 ++++++---
 scripts/ci/selective_ci_checks.sh | 26 +++++++++++++++++++++-----
 3 files changed, 31 insertions(+), 12 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 79eb7fb..a70632c 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -154,6 +154,7 @@ jobs:
       needs-helm-tests: ${{ steps.selective-checks.outputs.needs-helm-tests }}
       needs-api-tests: ${{ steps.selective-checks.outputs.needs-api-tests }}
       needs-api-codegen: ${{ steps.selective-checks.outputs.needs-api-codegen }}
+      default-branch: ${{ steps.selective-checks.outputs.default-branch }}
       pullRequestNumber: ${{ steps.source-run-info.outputs.pullRequestNumber }}
       pullRequestLabels: ${{ steps.source-run-info.outputs.pullRequestLabels }}
       runsOn: ${{ steps.set-runs-on.outputs.runsOn }}
@@ -504,12 +505,13 @@ ${{ hashFiles('.pre-commit-config.yaml') }}"
     strategy:
       matrix:
         package-format: ['wheel', 'sdist']
-    if: needs.build-info.outputs.image-build == 'true'
+    if: needs.build-info.outputs.image-build == 'true' && needs.build-info.outputs.default-branch == 'master'
     steps:
       - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
         uses: actions/checkout@v2
         with:
           persist-credentials: false
+        if: needs.build-info.outputs.default-branch == 'master'
       - name: "Setup python"
         uses: actions/setup-python@v2
         with:
@@ -551,7 +553,7 @@ ${{ hashFiles('.pre-commit-config.yaml') }}"
     strategy:
       matrix:
         package-format: ['wheel', 'sdist']
-    if: needs.build-info.outputs.image-build == 'true'
+    if: needs.build-info.outputs.image-build == 'true' && needs.build-info.outputs.default-branch == 'master'
     steps:
       - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
         uses: actions/checkout@v2
@@ -1033,8 +1035,6 @@ ${{ hashFiles('.pre-commit-config.yaml') }}"
       - tests-postgres
       - tests-mysql
       - tests-kubernetes
-      - prepare-provider-packages
-      - test-provider-packages-released-airflow
       - prod-images
       - docs
     if: >
diff --git a/PULL_REQUEST_WORKFLOW.rst b/PULL_REQUEST_WORKFLOW.rst
index 291750b..dcf3319 100644
--- a/PULL_REQUEST_WORKFLOW.rst
+++ b/PULL_REQUEST_WORKFLOW.rst
@@ -125,7 +125,8 @@ The logic implemented for the changes works as follows:
 
 1) In case of direct push (so when PR gets merged) or scheduled run, we always run all tests and checks.
    This is in order to make sure that the merge did not miss anything important. The remainder of the logic
-   is executed only in case of Pull Requests.
+   is executed only in case of Pull Requests. We do not add providers tests in case DEFAULT_BRANCH is
+   different than master, because providers are only important in master branch and PRs to master branch.
 
 2) We retrieve which files have changed in the incoming Merge Commit (github.sha is a merge commit
    automatically prepared by GitHub in case of Pull Request, so we can retrieve the list of changed
@@ -133,7 +134,9 @@ The logic implemented for the changes works as follows:
 
 3) If any of the important, environment files changed (Dockerfile, ci scripts, setup.py, GitHub workflow
    files), then we again run all tests and checks. Those are cases where the logic of the checks changed
-   or the environment for the checks changed so we want to make sure to check everything.
+   or the environment for the checks changed so we want to make sure to check everything. We do not add
+   providers tests in case DEFAULT_BRANCH is different than master, because providers are only
+   important in master branch and PRs to master branch.
 
 4) If any of py files changed: we need to have CI image and run full static checks so we enable image building
 
@@ -157,7 +160,7 @@ The logic implemented for the changes works as follows:
    b) if any of the Airflow API files changed we enable ``API`` test type
    c) if any of the Airflow CLI files changed we enable ``CLI`` test type and Kubernetes tests (the
       K8S tests depend on CLI changes as helm chart uses CLI to run Airflow).
-   d) if any of the Provider files changed we enable ``Providers`` test type
+   d) if this is a master branch and if any of the Provider files changed we enable ``Providers`` test type
    e) if any of the WWW files changed we enable ``WWW`` test type
    f) if any of the Kubernetes files changed we enable ``Kubernetes`` test type
    g) Then we subtract count of all the ``specific`` above per-type changed files from the count of
diff --git a/scripts/ci/selective_ci_checks.sh b/scripts/ci/selective_ci_checks.sh
index e1ca0be..cf81b33 100755
--- a/scripts/ci/selective_ci_checks.sh
+++ b/scripts/ci/selective_ci_checks.sh
@@ -122,7 +122,12 @@ function output_all_basic_variables() {
         initialization::ga_output sqlite-exclude '[]'
     fi
 
+
+    initialization::ga_output default-helm-version "${HELM_VERSION}"
     initialization::ga_output kubernetes-exclude '[]'
+
+    initialization::ga_output default-branch "${DEFAULT_BRANCH}"
+
 }
 
 function get_changed_files() {
@@ -198,8 +203,12 @@ function set_upgrade_to_newer_dependencies() {
     initialization::ga_output upgrade-to-newer-dependencies "${@}"
 }
 
-
-ALL_TESTS="Always API Core Other CLI Providers WWW Integration"
+if [[ ${DEFAULT_BRANCH} == "master" ]]; then
+    ALL_TESTS="Always API Core Other CLI Providers WWW Integration"
+else
+    # Skips Provider tests in case current default branch is not master
+    ALL_TESTS="Always API Core Other CLI WWW Integration"
+fi
 readonly ALL_TESTS
 
 function set_outputs_run_everything_and_exit() {
@@ -588,11 +597,18 @@ function calculate_test_types_to_run() {
             SELECTED_TESTS="${SELECTED_TESTS} CLI"
             kubernetes_tests_needed="true"
         fi
-        if [[ ${COUNT_PROVIDERS_CHANGED_FILES} != "0" ]]; then
+
+        if [[ ${DEFAULT_BRANCH} == "master" ]]; then
+            if [[ ${COUNT_PROVIDERS_CHANGED_FILES} != "0" ]]; then
+                echo
+                echo "Adding Providers to selected files as ${COUNT_PROVIDERS_CHANGED_FILES} Provider files changed"
+                echo
+                SELECTED_TESTS="${SELECTED_TESTS} Providers"
+            fi
+        else
             echo
-            echo "Adding Providers to selected files as ${COUNT_PROVIDERS_CHANGED_FILES} Provider files changed"
+            echo "Providers tests are not added because they are only run in case of master branch."
             echo
-            SELECTED_TESTS="${SELECTED_TESTS} Providers"
         fi
         if [[ ${COUNT_WWW_CHANGED_FILES} != "0" ]]; then
             echo