-
Notifications
You must be signed in to change notification settings - Fork 1
122 lines (108 loc) · 3.83 KB
/
pr-chart-lint-and-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
---
name: Lint and Test Charts
"on":
pull_request:
types:
- opened
- synchronize
- reopened
branches:
- main
jobs:
prep_job:
runs-on: ubuntu-latest
outputs:
has_changes: ${{ steps.changed-files.outputs.any_changed }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: tj-actions/changed-files@v39
id: changed-files
with:
files: |
**/*.yaml
**/*.yml
**/*.tpl
files_ignore: |
**/*.md
.github/**
test:
runs-on: ubuntu-latest
needs: prep_job
if: ${{ needs.prep_job.outputs.has_changes == 'true' }}
env:
# see https://github.com/kubernetes-sigs/kind/releases
# make sure to update the image refs in the matrix as well, when update this version!
kind_version: v0.20.0
strategy:
matrix:
include:
- name: k8s-1.27
kindest_image: kindest/node:v1.27.3@sha256:3966ac761ae0136263ffdb6cfd4db23ef8a83cba8a463690e98317add2c9ba72
- name: k8s-1.26
kindest_image: kindest/node:v1.26.6@sha256:6e2d8b28a5b601defe327b98bd1c2d1930b49e5d8c512e1895099e4504007adb
- name: k8s-1.25
kindest_image: kindest/node:v1.25.11@sha256:227fa11ce74ea76a0474eeefb84cb75d8dad1b08638371ecf0e86259b35be0c8
- name: k8s-1.24
kindest_image: kindest/node:v1.24.15@sha256:7db4f8bea3e14b82d12e044e25e34bd53754b7f2b0e9d56df21774e6f66a70ab
- name: k8s-1.23
kindest_image: kindest/node:v1.23.17@sha256:59c989ff8a517a93127d4a536e7014d28e235fb3529d9fba91b3951d461edfdb
- name: k8s-1.22
kindest_image: kindest/node:v1.22.17@sha256:f5b2e5698c6c9d6d0adc419c0deae21a425c07d81bbf3b6a6834042f25d4fba2
- name: k8s-1.21
kindest_image: kindest/node:v1.21.14@sha256:8a4e9bb3f415d2bb81629ce33ef9c76ba514c14d707f9797a01e3216376ba093
name: ${{ matrix.name }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: azure/[email protected]
- uses: actions/setup-python@v4
- name: Set up chart-testing
uses: helm/[email protected]
- name: Lint charts
run: ct lint --config .github/workflows/conf/ct.yml
- uses: helm/kind-action@main
with:
config: .github/workflows/conf/kind.yml
version: ${{ env.kind_version }}
node_image: ${{ matrix.kindest_image }}
- name: Create chart preconditions
run: .github/workflows/scripts/chart-test-prep.sh
- name: Chart installation tests
run: .github/workflows/scripts/chart-test.sh
- name: Debug information on failure
run: kubectl describe nodes; echo "=== API Versions ==="; kubectl api-versions; echo "=== CRDs ==="; kubectl get crd
if: failure()
lint:
runs-on: ubuntu-latest
needs: prep_job
if: ${{ needs.prep_job.outputs.has_changes == 'true' }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v4
- name: Run checkov on each test case permutation
run: .github/workflows/scripts/checkov-chart-linting.sh
skip:
runs-on: ubuntu-latest
needs: prep_job
if: ${{ needs.prep_job.outputs.has_changes != 'true' }}
strategy:
matrix:
include:
- name: k8s-1.27
- name: k8s-1.26
- name: k8s-1.25
- name: k8s-1.24
- name: k8s-1.23
- name: k8s-1.22
- name: k8s-1.21
- name: lint
name: ${{ matrix.name }}
steps:
- run: |
echo "Skip ${{ matrix.name }} for this pull request because no relevant files have been changed."
echo "This is needed to not block the pull request as these are configured as required status check."