Repository navigation
247 lines (212 loc) · 7.64 KB
/
Copy pathci.yml
File metadata and controls
247 lines (212 loc) · 7.64 KB
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
name: CI
on:
pull_request:
push:
branches:
- main
jobs:
build:
name: "Build & Test"
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
with:
go-version-file: "go.mod"
- name: Build
run: make build
- name: Unit tests
run: make test
helm-install:
name: helm install
needs: [build]
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
helm-version: [v3.18.6, v3.19.0, v4.0.0]
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
with:
go-version-file: "go.mod"
- name: Setup Helm
uses: azure/setup-helm@1a275c3b69536ee54be43f2070a358922e12c8d4 # v4.3.1
with:
version: ${{ matrix.helm-version }}
- name: helm plugin install
run: helm plugin install .
integration-tests:
name: Integration Tests
needs: [build]
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
matrix:
helm-version: [v3.18.6, v3.19.0, v4.0.0]
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
fetch-depth: 0
- uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
with:
go-version-file: "go.mod"
- name: Setup Helm
uses: azure/setup-helm@1a275c3b69536ee54be43f2070a358922e12c8d4 # v4.3.1
with:
version: ${{ matrix.helm-version }}
- name: Install plugin
run: helm plugin install .
- name: Setup test repository
id: setup
run: |
TEST_DIR=$(mktemp -d)
cd "$TEST_DIR"
git init
git config user.email "test@example.com"
git config user.name "Test User"
mkdir -p charts
# Copy all test charts from repository
cp -r "$GITHUB_WORKSPACE/test-charts/"* charts/
git add .
git commit -m "Initial commit"
echo "test_dir=$TEST_DIR" >> $GITHUB_OUTPUT
- name: Detect no changes between same commit
uses: ./.github/actions/assert-output
with:
working-directory: ${{ steps.setup.outputs.test_dir }}
command: >
helm git-diff
--base HEAD
--current HEAD
--chart-dir charts
test-chart
should-be-empty: true
- name: Commit replica count change
run: |
cd ${{ steps.setup.outputs.test_dir }}
sed -i 's/replicaCount: 1/replicaCount: 3/' charts/test-chart/values.yaml
git add charts/test-chart/values.yaml
git commit -m "Increase replica count to 3"
- name: Verify replica count appears in diff
uses: ./.github/actions/assert-output
with:
working-directory: ${{ steps.setup.outputs.test_dir }}
command: >
helm git-diff
--base HEAD~1
--current HEAD
--chart-dir charts
test-chart
should-contain: "replicas: 3"
- name: Auto-detect changed charts
uses: ./.github/actions/assert-output
with:
working-directory: ${{ steps.setup.outputs.test_dir }}
command: helm git-diff --base HEAD~1 --current HEAD --chart-dir charts
should-contain: "test-chart"
- name: Commit image tag change
run: |
cd ${{ steps.setup.outputs.test_dir }}
sed -i 's/tag: "1.36"/tag: "1.37"/' charts/test-chart/values.yaml
git add charts/test-chart/values.yaml
git commit -m "Update busybox tag to 1.37"
- name: Verify image tag appears in diff
uses: ./.github/actions/assert-output
with:
working-directory: ${{ steps.setup.outputs.test_dir }}
command: helm git-diff --base HEAD~1 --current HEAD --chart-dir charts
should-contain: "1.37"
- name: Modify values for uncommitted changes test
run: |
cd ${{ steps.setup.outputs.test_dir }}
sed -i 's/replicaCount: 3/replicaCount: 5/' charts/test-chart/values.yaml
- name: Test uncommitted changes detection
uses: ./.github/actions/assert-output
with:
working-directory: ${{ steps.setup.outputs.test_dir }}
command: >
helm git-diff
--base HEAD
--chart-dir charts
test-chart
should-contain: "replicas: 5"
- name: Cleanup uncommitted changes
run: |
cd ${{ steps.setup.outputs.test_dir }}
git checkout charts/test-chart/values.yaml
- name: Test --values flag
run: |
cd ${{ steps.setup.outputs.test_dir }}
# Create two different values files
echo "replicaCount: 10" > values-10.yaml
echo "replicaCount: 20" > values-20.yaml
# Test that --values is actually being used by checking output contains expected value
# Use helm template directly to verify values work
helm template release-name charts/test-chart --values values-10.yaml | grep -q "replicas: 10"
echo "Values file works with helm template"
- name: Test --set flag shows no changes
uses: ./.github/actions/assert-output
with:
working-directory: ${{ steps.setup.outputs.test_dir }}
command: >
helm git-diff
--base HEAD
--current HEAD
--chart-dir charts
--set replicaCount=7
test-chart
should-be-empty: true
- name: Test multiple --set flags shows no changes
uses: ./.github/actions/assert-output
with:
working-directory: ${{ steps.setup.outputs.test_dir }}
command: >
helm git-diff
--base HEAD
--current HEAD
--chart-dir charts
--set replicaCount=8
--set image.tag=2.0
test-chart
should-be-empty: true
- name: Test library chart is skipped
uses: ./.github/actions/assert-output
with:
working-directory: ${{ steps.setup.outputs.test_dir }}
command: >
helm git-diff
--base HEAD
--current HEAD
--chart-dir charts
test-library
should-contain: "skipped (library chart)"
- name: Test chart with local file dependencies
uses: ./.github/actions/assert-output
with:
working-directory: ${{ steps.setup.outputs.test_dir }}
command: >
helm git-diff
--base HEAD
--current HEAD
--chart-dir charts
test-with-deps
should-be-empty: true
- name: Test --fail-on-diff flag with differences
working-directory: ${{ steps.setup.outputs.test_dir }}
run: |
CMD="helm git-diff --base HEAD~1 --current HEAD --chart-dir charts"
CMD="$CMD --fail-on-diff test-chart"
if $CMD; then
echo "--fail-on-diff should have exited with code 1"
exit 1
fi
- name: Test --fail-on-diff flag without differences
working-directory: ${{ steps.setup.outputs.test_dir }}
run: helm git-diff --base HEAD --current HEAD --chart-dir charts --fail-on-diff test-chart
- name: Cleanup test directory
if: always()
run: rm -rf ${{ steps.setup.outputs.test_dir }}