-
Notifications
You must be signed in to change notification settings - Fork 15
172 lines (144 loc) · 4.74 KB
/
helm-chart.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
name: Helm chart validation
on:
push:
branches:
- main
paths:
- 'helm/**'
- '.github/workflows/helm-chart.yml'
pull_request:
branches:
- main
paths:
- 'helm/**'
- '.github/workflows/helm-chart.yml'
jobs:
lint:
name: Lint and install chart
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Helm
uses: azure/setup-helm@v4
with:
version: v3.13.2
- name: Install Python
uses: actions/[email protected]
with:
python-version: 3.9
- name: Set up chart-testing
uses: helm/[email protected]
- name: Add bitami repo
run: helm repo add bitnami https://charts.bitnami.com/bitnami
- name: Lint helm chart
run: |
ct lint --config ./.github/configs/chart-testing.yaml
- name: Create kind cluster
if: "${{!startsWith(github.event.pull_request.title, 'feat: Release')}}"
uses: helm/[email protected]
- name: Label cluster nodes
if: "${{!startsWith(github.event.pull_request.title, 'feat: Release')}}"
run: |
for node in $(kubectl get nodes -o name); do
kubectl label --overwrite $node "role=management"
done
- name: Run chart-testing (install and upgrade)
if: "${{!startsWith(github.event.pull_request.title, 'feat: Release')}}"
run: ct install --upgrade --config ./.github/configs/chart-testing.yaml
validate:
name: Validate chart against kubernetes API
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Helm
uses: azure/setup-helm@v4
with:
version: v3.13.2
- name: Create kind cluster
uses: helm/[email protected]
- name: Validate chart
run: |
helm template flowforge ./helm/flowforge --set forge.domain=example.com | kubectl apply --validate=true -f -
unit-tests:
name: Run unit tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Helm
uses: azure/setup-helm@v4
- name: Install unittest plugin
run: helm plugin install https://github.com/helm-unittest/helm-unittest.git
- name: Run unit tests
run: |
helm unittest ./helm/flowforge -t JUnit -o junit-results.xml
- name: Publish Test Report
uses: mikepenz/action-junit-report@v5
if: always()
with:
check_name: 'Helm chart unit tests'
report_paths: 'junit-results.xml'
detailed_summary: true
scan:
name: Scan chart
runs-on: ubuntu-latest
permissions:
security-events: write
strategy:
fail-fast: false
matrix:
tool:
- checkov
# temporary disabled due to https://github.com/zegl/kube-score/issues/559
# - kube-score
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Helm
uses: azure/setup-helm@v4
with:
version: v3.13.2
- name: Scan chart with checkov
if: matrix.tool == 'checkov'
uses: bridgecrewio/checkov-action@v12
with:
directory: ${{ github.workspace }}/helm
var_file: ${{ github.workspace }}/helm/flowforge/ci/default-values.yaml
skip_path: /flowforge/charts/
framework: helm
output_format: cli,sarif
output_file_path: console,results.sarif
soft_fail: true
env:
HELM_NAMESPACE: no-default-namespace
- name: Template chart
# temporary disabled due to https://github.com/zegl/kube-score/issues/559
if: false
run: |
helm template flowforge ./helm/flowforge --set forge.domain=example.com > ${{ github.workspace }}/templated_chart.yaml
- name: Install kube-score
# temporary disabled due to https://github.com/zegl/kube-score/issues/559
if: false
uses: yokawasa/[email protected]
with:
setup-tools: "kube-score"
kube-score: '1.17.0'
- name: Scan chart with kube-score
# temporary disabled due to https://github.com/zegl/kube-score/issues/559
if: false
continue-on-error: true
run:
kube-score score ${{ github.workspace }}/templated_chart.yaml --output-format sarif > results.sarif
- name: "Upload SARIF file"
if: success() || failure()
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: results.sarif