You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ka...@apache.org on 2020/11/12 21:11:02 UTC

[airflow] 07/08: Enforce strict rules for yamllint (#11709)

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

kaxilnaik pushed a commit to branch v1-10-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit 79bc6c550f1c22626799239014a0a0be638fe998
Author: Kamil Breguła <mi...@users.noreply.github.com>
AuthorDate: Wed Oct 21 12:24:32 2020 +0200

    Enforce strict rules for yamllint (#11709)
---
 .github/workflows/build-images-workflow-run.yml | 24 +++----
 .github/workflows/ci.yml                        |  2 +-
 .github/workflows/codeql-analysis.yml           |  2 +-
 .github/workflows/codeql-cancel.yml             |  4 +-
 .github/workflows/scheduled_quarantined.yml     |  2 +-
 .pre-commit-config.yaml                         | 52 +++++++--------
 chart/Chart.yaml                                |  1 +
 chart/dockerfiles/statsd-exporter/mappings.yml  |  2 +-
 chart/requirements.yaml                         |  2 +-
 chart/values.yaml                               | 86 +++++++++++++++----------
 tests/kubernetes/basic_pod.yaml                 |  2 +-
 11 files changed, 98 insertions(+), 81 deletions(-)

diff --git a/.github/workflows/build-images-workflow-run.yml b/.github/workflows/build-images-workflow-run.yml
index b791fc3..2ad2931 100644
--- a/.github/workflows/build-images-workflow-run.yml
+++ b/.github/workflows/build-images-workflow-run.yml
@@ -17,7 +17,7 @@
 #
 ---
 name: "Build Images"
-on:
+on:  # yamllint disable-line rule:truthy
   workflow_run:
     workflows: ["CI Build"]
     types: ['requested']
@@ -59,13 +59,13 @@ jobs:
     if: github.repository == 'apache/airflow' || github.event.workflow_run.event != 'schedule'
     steps:
       - name: "Get information about the origin 'CI Build' run"
-        uses: potiuk/get-workflow-origin@c657bb36aef4a7402bbe9b2e09a820320f8ff447 # v1
+        uses: potiuk/get-workflow-origin@c657bb36aef4a7402bbe9b2e09a820320f8ff447  # v1
         id: source-run-info
         with:
           token: ${{ secrets.GITHUB_TOKEN }}
           sourceRunId: ${{ github.event.workflow_run.id }}
       - name: "Cancel duplicated 'CI Build' runs"
-        uses: potiuk/cancel-workflow-runs@f696c622a83e4a63fff74848d3b149074658607d # v3_2
+        uses: potiuk/cancel-workflow-runs@f696c622a83e4a63fff74848d3b149074658607d  # v3_2
         with:
           token: ${{ secrets.GITHUB_TOKEN }}
           cancelMode: duplicates
@@ -84,7 +84,7 @@ jobs:
         # in GitHub Actions, we have to use Job names to match Event/Repo/Branch from the
         # build-info step there to find the duplicates ¯\_(ツ)_/¯.
 
-        uses: potiuk/cancel-workflow-runs@f696c622a83e4a63fff74848d3b149074658607d # v3_2
+        uses: potiuk/cancel-workflow-runs@f696c622a83e4a63fff74848d3b149074658607d  # v3_2
         with:
           cancelMode: namedJobs
           token: ${{ secrets.GITHUB_TOKEN }}
@@ -105,7 +105,7 @@ jobs:
         # can cancel all the matching "Build Images" workflow runs in the two following steps.
         # Yeah. Adding to the complexity ¯\_(ツ)_/¯.
 
-        uses: potiuk/cancel-workflow-runs@f696c622a83e4a63fff74848d3b149074658607d # v3_2
+        uses: potiuk/cancel-workflow-runs@f696c622a83e4a63fff74848d3b149074658607d  # v3_2
         id: cancel-failed
         with:
           token: ${{ secrets.GITHUB_TOKEN }}
@@ -140,7 +140,7 @@ jobs:
         # it to cancel any jobs that have matching names containing Source Run Id:
         # followed by one of the run ids. Yes I know it's super complex ¯\_(ツ)_/¯.
         if: env.BUILD_IMAGES == 'true' && steps.source-run-info-failed.outputs.cancelledRuns != '[]'
-        uses: potiuk/cancel-workflow-runs@f696c622a83e4a63fff74848d3b149074658607d # v3_2
+        uses: potiuk/cancel-workflow-runs@f696c622a83e4a63fff74848d3b149074658607d  # v3_2
         with:
           cancelMode: namedJobs
           token: ${{ secrets.GITHUB_TOKEN }}
@@ -225,8 +225,8 @@ jobs:
     needs: [build-info, cancel-workflow-runs]
     strategy:
       matrix:
-      # We need to attempt to build all possible versions here because workflow_run
-      # event is run from master for both master and v1-10-tests
+        # We need to attempt to build all possible versions here because workflow_run
+        # event is run from master for both master and v1-10-tests
         python-version: ${{ fromJson(needs.build-info.outputs.allPythonVersions) }}
         image-type: [CI, PROD]
       fail-fast: true
@@ -277,7 +277,7 @@ jobs:
               echo "::set-output name=proceed::false"
           fi
       - name: Initiate Github Checks for Building image
-        uses: LouisBrunner/checks-action@9f02872da71b6f558c6a6f190f925dde5e4d8798 #v1.1.0
+        uses: LouisBrunner/checks-action@9f02872da71b6f558c6a6f190f925dde5e4d8798  # v1.1.0
         id: build-image-check
         with:
           token: ${{ secrets.GITHUB_TOKEN }}
@@ -325,7 +325,7 @@ jobs:
         run: ./scripts/ci/images/ci_push_production_images.sh
         if: matrix.image-type == 'PROD' && steps.defaults.outputs.proceed == 'true'
       - name: Update Github Checks for Building image with status
-        uses: LouisBrunner/checks-action@9f02872da71b6f558c6a6f190f925dde5e4d8798 #v1.1.0
+        uses: LouisBrunner/checks-action@9f02872da71b6f558c6a6f190f925dde5e4d8798  # v1.1.0
         if: always() && steps.defaults.outputs.proceed == 'true'
         with:
           token: ${{ secrets.GITHUB_TOKEN }}
@@ -347,7 +347,7 @@ jobs:
     needs: [build-images]
     steps:
       - name: "Canceling the 'CI Build' source workflow in case of failure!"
-        uses: potiuk/cancel-workflow-runs@cancel_message #v3
+        uses: potiuk/cancel-workflow-runs@cancel_message  # v3
         with:
           token: ${{ secrets.GITHUB_TOKEN }}
           cancelMode: self
@@ -362,7 +362,7 @@ jobs:
     needs: [build-images]
     steps:
       - name: "Canceling the 'CI Build' source workflow in case of failure!"
-        uses: potiuk/cancel-workflow-runs@f696c622a83e4a63fff74848d3b149074658607d # v3_2
+        uses: potiuk/cancel-workflow-runs@f696c622a83e4a63fff74848d3b149074658607d  # v3_2
         with:
           token: ${{ secrets.GITHUB_TOKEN }}
           cancelMode: self
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 85f8e27..46cdea3 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -17,7 +17,7 @@
 #
 ---
 name: CI Build
-on:
+on:  # yamllint disable-line rule:truthy
   schedule:
     - cron: '28 0 * * *'
   push:
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index 01bac7e..40e518d 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -1,7 +1,7 @@
 ---
 name: "CodeQL"
 
-on:
+on:  # yamllint disable-line rule:truthy
   push:
     branches: [master]
   pull_request:
diff --git a/.github/workflows/codeql-cancel.yml b/.github/workflows/codeql-cancel.yml
index 2221d7a..bba6cc7 100644
--- a/.github/workflows/codeql-cancel.yml
+++ b/.github/workflows/codeql-cancel.yml
@@ -1,6 +1,6 @@
 ---
 name: "Cancel duplicate CodeQL workflows"
-on:
+on:  # yamllint disable-line rule:truthy
   workflow_run:
     workflows: ["CodeQL"]
     types: ['requested']
@@ -12,7 +12,7 @@ jobs:
     if: github.repository == 'apache/airflow' || github.event.workflow_run.event != 'schedule'
     steps:
       - name: "Cancel duplicated 'CodeQL' runs"
-        uses: potiuk/cancel-workflow-runs@f696c622a83e4a63fff74848d3b149074658607d # v3_2
+        uses: potiuk/cancel-workflow-runs@f696c622a83e4a63fff74848d3b149074658607d  # v3_2
         id: cancel
         with:
           token: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.github/workflows/scheduled_quarantined.yml b/.github/workflows/scheduled_quarantined.yml
index 5468943..b75627c 100644
--- a/.github/workflows/scheduled_quarantined.yml
+++ b/.github/workflows/scheduled_quarantined.yml
@@ -17,7 +17,7 @@
 #
 ---
 name: Quarantined Build
-on:
+on:  # yamllint disable-line rule:truthy
   schedule:
     # Run quarantined builds 4 times a day to gather better quarantine stats
     - cron: '12 */6 * * *'
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index fd243ec..f1b930a 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -161,34 +161,34 @@ repos:
     hooks:
       - id: yamllint
         name: Check yaml files with yamllint
-        entry: yamllint -c yamllint-config.yml
+        entry: yamllint -c yamllint-config.yml --strict
         types: [yaml]
         exclude: ^.*init_git_sync\.template\.yaml$|^.*airflow\.template\.yaml$|^chart/templates/.*\.yaml$
-    ##
-    ## Dear committer.
-    ##
-    ## If you ever come here to add the missing isort step here - hear a little warning.
-    ##
-    ## Initially isort will cause surprising duplicates of urlparse and other urllib related methods.
-    ## The urllib imports seem broken for python 2 but they are actually fine due to future
-    ## backport aliases installed elsewhere in the code (implicitly) - in 6 places.
-    ##
-    ## When you decide how to fix it (likely talking to other people in community) and you push
-    ## build to CI you will find terrible truth that in Airflow 1.10 modules are so much
-    ## cross-dependent, that imports in a number of places have to be done in specific order and
-    ## if this is not followed properly, circular imports kick-in and you are doomed.
-    ##
-    ## Running isort breaks the import House of Cards and there is no easy way to fix it short of
-    ## splitting a number of files and probably breaking compatibility.
-    ##
-    ## Luckily this has been fixed in Airflow 2.0 by proper untangling of the cross-dependencies and
-    ## 1.10.* branch is really in maintenance mode, so do not really waste your time here.
-    ##
-    ## Unless you really want of course. But then either delete this comment or increase the counter
-    ## below after you give up.
-    ##
-    ## Total hours wasted here = 3
-    ##
+  ##
+  ## Dear committer.
+  ##
+  ## If you ever come here to add the missing isort step here - hear a little warning.
+  ##
+  ## Initially isort will cause surprising duplicates of urlparse and other urllib related methods.
+  ## The urllib imports seem broken for python 2 but they are actually fine due to future
+  ## backport aliases installed elsewhere in the code (implicitly) - in 6 places.
+  ##
+  ## When you decide how to fix it (likely talking to other people in community) and you push
+  ## build to CI you will find terrible truth that in Airflow 1.10 modules are so much
+  ## cross-dependent, that imports in a number of places have to be done in specific order and
+  ## if this is not followed properly, circular imports kick-in and you are doomed.
+  ##
+  ## Running isort breaks the import House of Cards and there is no easy way to fix it short of
+  ## splitting a number of files and probably breaking compatibility.
+  ##
+  ## Luckily this has been fixed in Airflow 2.0 by proper untangling of the cross-dependencies and
+  ## 1.10.* branch is really in maintenance mode, so do not really waste your time here.
+  ##
+  ## Unless you really want of course. But then either delete this comment or increase the counter
+  ## below after you give up.
+  ##
+  ## Total hours wasted here = 3
+  ##
   - repo: local
     hooks:
       - id: shellcheck
diff --git a/chart/Chart.yaml b/chart/Chart.yaml
index 927b412..93de06e 100644
--- a/chart/Chart.yaml
+++ b/chart/Chart.yaml
@@ -16,6 +16,7 @@
 # under the License.
 
 # apiVersion v1 is Helm 2
+---
 apiVersion: v1
 name: airflow
 version: 1.0.0
diff --git a/chart/dockerfiles/statsd-exporter/mappings.yml b/chart/dockerfiles/statsd-exporter/mappings.yml
index f86854e..f10ab00 100644
--- a/chart/dockerfiles/statsd-exporter/mappings.yml
+++ b/chart/dockerfiles/statsd-exporter/mappings.yml
@@ -14,7 +14,7 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-
+---
 mappings:
   # Map dot separated stats to labels
   - match: airflow.dagrun.dependency-check.*.*
diff --git a/chart/requirements.yaml b/chart/requirements.yaml
index 56f29ee..c0b6af2 100644
--- a/chart/requirements.yaml
+++ b/chart/requirements.yaml
@@ -14,7 +14,7 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-
+---
 dependencies:
   - name: postgresql
     version: 6.3.12
diff --git a/chart/values.yaml b/chart/values.yaml
index ba7a01e..b8c4fcf 100644
--- a/chart/values.yaml
+++ b/chart/values.yaml
@@ -223,12 +223,12 @@ webserver:
   extraNetworkPolicies: []
 
   resources: {}
-    # limits:
-    #   cpu: 100m
-    #   memory: 128Mi
-    # requests:
-    #   cpu: 100m
-    #   memory: 128Mi
+  # limits:
+  #   cpu: 100m
+  #   memory: 128Mi
+  # requests:
+  #   cpu: 100m
+  #   memory: 128Mi
 
   # Create initial user.
   defaultUser:
@@ -265,12 +265,12 @@ flower:
   # Additional network policies as needed
   extraNetworkPolicies: []
   resources: {}
-    # limits:
-    #   cpu: 100m
-    #   memory: 128Mi
-    # requests:
-    #   cpu: 100m
-    #   memory: 128Mi
+  # limits:
+  #   cpu: 100m
+  #   memory: 128Mi
+  # requests:
+  #   cpu: 100m
+  #   memory: 128Mi
 
   service:
     type: ClusterIP
@@ -281,12 +281,12 @@ statsd:
   # Additional network policies as needed
   extraNetworkPolicies: []
   resources: {}
-    # limits:
-    #   cpu: 100m
-    #   memory: 128Mi
-    # requests:
-    #   cpu: 100m
-    #   memory: 128Mi
+  # limits:
+  #   cpu: 100m
+  #   memory: 128Mi
+  # requests:
+  #   cpu: 100m
+  #   memory: 128Mi
 
   service:
     extraAnnotations: {}
@@ -313,13 +313,21 @@ pgbouncer:
     config:
       maxUnavailable: 1
 
+  # Limit the resources to pgbouncerExported.
+  # When you specify the resource request the scheduler uses this information to decide which node to place
+  # the Pod on. When you specify a resource limit for a Container, the kubelet enforces those limits so
+  # that the running container is not allowed to use more of that resource than the limit you set.
+  # See: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
+  # Example:
+  #
+  # resource:
+  #   limits:
+  #     cpu: 100m
+  #     memory: 128Mi
+  #   requests:
+  #     cpu: 100m
+  #     memory: 128Mi
   resources: {}
-    # limits:
-    #   cpu: 100m
-    #   memory: 128Mi
-    # requests:
-    #   cpu: 100m
-    #   memory: 128Mi
 
   service:
     extraAnnotations: {}
@@ -365,11 +373,13 @@ redis:
 registry:
   secretName: ~
 
+  # Example:
+  # connection:
+  #   user: ~
+  #   pass: ~
+  #   host: ~
+  #   email: ~
   connection: {}
-    # user: ~
-    # pass: ~
-    # host: ~
-    # email: ~
 
 # Elasticsearch logging configuration
 elasticsearch:
@@ -378,11 +388,14 @@ elasticsearch:
   # A secret containing the connection
   secretName: ~
   # Or an object representing the connection
+  # Example:
+  # connection:
+  #   user: ~
+  #   pass: ~
+  #   host: ~
+  #   port: ~
   connection: {}
-    # user: ~
-    # pass: ~
-    # host: ~
-    # port: ~
+
 
 # All ports used by chart
 ports:
@@ -559,7 +572,8 @@ dags:
     #     GIT_SYNC_USERNAME: <base64_encoded_git_username>
     #     GIT_SYNC_PASSWORD: <base64_encoded_git_password>
     # and specify the name of the secret below
-    #credentialsSecret: git-credentials
+    #
+    # credentialsSecret: git-credentials
     #
     #
     # If you are using an ssh clone url, you can load
@@ -573,10 +587,12 @@ dags:
     #     # key needs to be gitSshKey
     #     gitSshKey: <base64_encoded_data>
     # and specify the name of the secret below
-    #sshKeySecret: airflow-ssh-secret
+    # sshKeySecret: airflow-ssh-secret
+    #
     # If you are using an ssh private key, you can additionally
     # specify the content of your known_hosts file, example:
-    #knownHosts: |
+    #
+    # knownHosts: |
     #    <host1>,<ip1> <key1>
     #    <host2>,<ip2> <key2>
     # interval between git sync attempts in seconds
diff --git a/tests/kubernetes/basic_pod.yaml b/tests/kubernetes/basic_pod.yaml
index 417b56d..fff84d1 100644
--- a/tests/kubernetes/basic_pod.yaml
+++ b/tests/kubernetes/basic_pod.yaml
@@ -14,7 +14,7 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-
+---
 apiVersion: v1
 kind: Pod
 metadata: