|
1 | 1 | name: Lint and Test Charts |
2 | 2 |
|
3 | | -on: |
4 | | - push: |
| 3 | +on: |
| 4 | + # push: |
| 5 | + # paths: |
| 6 | + # - 'charts/**' |
| 7 | + # - '.github/**' |
| 8 | + pull_request: |
5 | 9 | paths: |
6 | 10 | - 'charts/**' |
7 | | - - '.github/**' |
| 11 | + - '.github/**' |
| 12 | + workflow_dispatch: |
| 13 | + |
| 14 | +env: |
| 15 | + KUBE_SCORE_VERSION: 1.10.0 |
| 16 | + HELM_VERSION: v3.4.1 |
8 | 17 |
|
9 | 18 | jobs: |
10 | 19 | lint-test: |
11 | 20 | runs-on: ubuntu-latest |
12 | 21 | steps: |
13 | 22 | - name: Checkout |
14 | | - uses: actions/checkout@v1 |
15 | | - |
| 23 | + uses: actions/checkout@v2 |
| 24 | + with: |
| 25 | + fetch-depth: 0 |
| 26 | + |
| 27 | + - name: Set up Helm |
| 28 | + uses: azure/setup-helm@v1 |
| 29 | + with: |
| 30 | + version: ${{ env.HELM_VERSION }} |
| 31 | + |
| 32 | + - name: Set up kube-score |
| 33 | + run: | |
| 34 | + wget https://github.com/zegl/kube-score/releases/download/v${{ env.KUBE_SCORE_VERSION }}/kube-score_${{ env.KUBE_SCORE_VERSION }}_linux_amd64 -O kube-score |
| 35 | + chmod 755 kube-score |
| 36 | +
|
| 37 | + - name: Kube-score generated manifests |
| 38 | + run: helm template --values .ci/values-kube-score.yaml charts/* | ./kube-score score - |
| 39 | + --ignore-test pod-networkpolicy |
| 40 | + --ignore-test deployment-has-poddisruptionbudget |
| 41 | + --ignore-test deployment-has-host-podantiaffinity |
| 42 | + --ignore-test container-security-context |
| 43 | + --ignore-test pod-probes |
| 44 | + --ignore-test container-image-tag |
| 45 | + --enable-optional-test container-security-context-privileged |
| 46 | + |
| 47 | + # python is a requirement for the chart-testing action below (supports yamllint among other tests) |
| 48 | + - uses: actions/setup-python@v2 |
| 49 | + with: |
| 50 | + python-version: 3.7 |
| 51 | + |
| 52 | + - name: Set up chart-testing |
| 53 | + uses: helm/chart-testing-action@v2.0.1 |
| 54 | + |
| 55 | + - name: Run chart-testing (list-changed) |
| 56 | + id: list-changed |
| 57 | + run: | |
| 58 | + changed=$(ct list-changed --config .ci/ct-config.yaml) |
| 59 | + if [[ -n "$changed" ]]; then |
| 60 | + echo "::set-output name=changed::true" |
| 61 | + fi |
| 62 | +
|
16 | 63 | - name: Run chart-testing (lint) |
17 | | - id: lint |
18 | | - uses: helm/chart-testing-action@v1.0.0-rc.1 |
| 64 | + run: ct lint --config .ci/ct-config.yaml |
| 65 | + |
| 66 | + # Refer to https://github.com/kubernetes-sigs/kind/releases when updating the node_images |
| 67 | + - name: Create 1.20 kind cluster |
| 68 | + uses: helm/kind-action@v1.1.0 |
19 | 69 | with: |
20 | | - config: .ci/ct-config.yaml |
21 | | - command: lint |
| 70 | + node_image: kindest/node:v1.20.2@sha256:8f7ea6e7642c0da54f04a7ee10431549c0257315b3a634f6ef2fecaaedb19bab |
| 71 | + cluster_name: kubernetes-1.20 |
| 72 | + if: steps.list-changed.outputs.changed == 'true' |
22 | 73 |
|
23 | | - - name: Create kind cluster |
24 | | - uses: helm/kind-action@v1.0.0-alpha.3 |
| 74 | + - name: Run chart-testing (install) against 1.20 |
| 75 | + run: ct install --config .ci/ct-config.yaml |
| 76 | + |
| 77 | + - name: Create 1.19 kind cluster |
| 78 | + uses: helm/kind-action@v1.1.0 |
25 | 79 | with: |
26 | | - install_local_path_provisioner: true |
27 | | - # Only build a kind cluster if there are chart changes to test. |
28 | | - if: steps.lint.outputs.changed == 'true' |
| 80 | + node_image: kindest/node:v1.19.7@sha256:a70639454e97a4b733f9d9b67e12c01f6b0297449d5b9cbbef87473458e26dca |
| 81 | + cluster_name: kubernetes-1.19 |
| 82 | + if: steps.list-changed.outputs.changed == 'true' |
| 83 | + |
| 84 | + - name: Run chart-testing (install) against 1.19 |
| 85 | + run: ct install --config .ci/ct-config.yaml |
29 | 86 |
|
30 | | - - name: Run chart-testing (install) |
31 | | - uses: helm/chart-testing-action@v1.0.0-rc.1 |
| 87 | + - name: Create 1.18 kind cluster |
| 88 | + uses: helm/kind-action@v1.1.0 |
32 | 89 | with: |
33 | | - command: install |
34 | | - config: .ci/ct-config.yaml |
| 90 | + node_image: kindest/node:v1.18.15@sha256:5c1b980c4d0e0e8e7eb9f36f7df525d079a96169c8a8f20d8bd108c0d0889cc4 |
| 91 | + cluster_name: kubernetes-1.18 |
| 92 | + if: steps.list-changed.outputs.changed == 'true' |
| 93 | + |
| 94 | + - name: Run chart-testing (install) against 1.18 |
| 95 | + run: ct install --config .ci/ct-config.yaml |
0 commit comments