This repository has been archived by the owner on Apr 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
275 lines (271 loc) · 9.83 KB
/
kind.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
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
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
name: E2E Tests
on:
push:
branches:
- master
- main
pull_request:
types: [opened, synchronize, reopened]
jobs:
gates:
# The gates job is intended to derive all necessary information for branching logic further down the graph.
runs-on: ubuntu-latest
outputs:
# See jobs.<job_id>.outputs reference for details on passing variables between jobs:
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idoutputs
commitmsg: ${{ steps.getcommit.outputs.commitmsg }}
fileChangesToCoreArtifacts: ${{ steps.filter.outputs.fileChangesToCoreArtifacts }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 10
- name: get-commit-msg
id: getcommit
run: |
echo ::set-output name=commitmsg::$(git log --format=%B -n 1 ${{ github.event.after }})
- uses: dorny/paths-filter@v2
# Reference documentation for this action: https://github.com/dorny/paths-filter#examples
id: filter
with:
# Here we test for file changes with the filter. While at present the "fileChangesToCoreArtifacts" variable
# is only testing for changes outside of the documentation, this does in principle give us fine-grained
# control should we wish to exclude other supporting folders from triggering the larger test runs.
#
# Unfortunately, it is, at time of writing, not possible to do this work with Github Action's path
# exclusions logic, as there is no way to set a job to report as successful without running it, and
# the paths logic will skip the job altogether. This means that, without the control gained here,
# any job that we wish to set as "Required" in for merge checks must be run whether it's relevant
# to the changes or not. See the following discussion:
# https://github.community/t/feature-request-conditional-required-checks/16761/13
filters: |
fileChangesToCoreArtifacts:
- '!docs/**'
binary:
runs-on: ubuntu-20.04
needs: gates
container:
image: flanksource/build-tools:v0.15.1
env:
FILE_CHANGES_TO_CORE_ARTIFACTS: ${{ needs.gates.outputs.fileChangesToCoreArtifacts == 'true' }}
steps:
# Get values for cache paths to be used in later steps
- id: go-cache-paths
if: ${{ env.FILE_CHANGES_TO_CORE_ARTIFACTS == 'true' }}
run: |
echo "::set-output name=go-build::$(go env GOCACHE)"
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
- uses: actions/checkout@v3
with:
fetch-depth: 0
if: ${{ env.FILE_CHANGES_TO_CORE_ARTIFACTS == 'true' }}
# Cache go build cache, used to speedup go test
- run: git config --global --add safe.directory $PWD
- name: Go Build Cache
if: ${{ env.FILE_CHANGES_TO_CORE_ARTIFACTS == 'true' }}
uses: actions/cache@v2
with:
path: ${{ steps.go-cache-paths.outputs.go-build }}
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
# Cache go mod cache, used to speedup builds
- name: Go Mod Cache
if: ${{ env.FILE_CHANGES_TO_CORE_ARTIFACTS == 'true' }}
uses: actions/cache@v2
with:
path: ${{ steps.go-cache-paths.outputs.go-mod }}
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
- name: Make linux
if: ${{ env.FILE_CHANGES_TO_CORE_ARTIFACTS == 'true' }}
run: make linux
- uses: actions/upload-artifact@v2
if: ${{ env.FILE_CHANGES_TO_CORE_ARTIFACTS == 'true' }}
with:
name: karina
path: ./.bin/karina
e2e:
runs-on: ubuntu-20.04
if: "!contains(toJSON(needs.gates.outputs.commitmsg), 'skip-e2e')"
needs:
- binary
- gates
env:
FILE_CHANGES_TO_CORE_ARTIFACTS: ${{ needs.gates.outputs.fileChangesToCoreArtifacts == 'true' }}
strategy:
fail-fast: false
matrix:
k8s:
- v1.21.1
- v1.22.15
suite:
- minimal
- monitoring
- harbor2
- postgres
- elastic
- security
- platform
- managed
- nosql
- canary-checker
steps:
- uses: actions/checkout@v3
if: ${{ env.FILE_CHANGES_TO_CORE_ARTIFACTS == 'true' }}
with:
fetch-depth: 0
- uses: actions/download-artifact@v2
if: ${{ env.FILE_CHANGES_TO_CORE_ARTIFACTS == 'true' }}
with:
name: karina
path: ./.bin
- name: Run e2e testing script
if: ${{ env.FILE_CHANGES_TO_CORE_ARTIFACTS == 'true' }}
id: e2e
env:
GIT_API_KEY: ${{ secrets.GITHUB_TOKEN }}
SUITE: ${{ matrix.suite }}
KUBERNETES_VERSION: ${{matrix.k8s}}
BUILD: test (${{matrix.k8s}}, ${{ matrix.suite }})
ADDITIONAL_CONFIG: -c test/hosted-tests.yaml
run: ./test/test.sh
- name: Upload test results
if: ${{ env.FILE_CHANGES_TO_CORE_ARTIFACTS == 'true' && always() }}
uses: actions/upload-artifact@v2
with:
if-no-files-found: ignore
name: test-results-${{matrix.k8s}}-${{matrix.suite}}
path: test-results/
- name: Upload snapshots
if: ${{ env.FILE_CHANGES_TO_CORE_ARTIFACTS == 'true' && always() }}
uses: actions/upload-artifact@v2
with:
if-no-files-found: ignore
name: snapshot-${{matrix.k8s}}-${{matrix.suite}}
path: artifacts/snapshot
- name: Generate Kind logs
if: ${{ env.FILE_CHANGES_TO_CORE_ARTIFACTS == 'true' && failure() }}
run: kind export logs --name=kind-${{matrix.suite}}-${{matrix.k8s}} artifacts/kind-logs
- name: Upload Kind logs
if: ${{ env.FILE_CHANGES_TO_CORE_ARTIFACTS == 'true' && failure() }}
uses: actions/upload-artifact@v2
with:
if-no-files-found: ignore
name: kind-logs-${{matrix.k8s}}-${{matrix.suite}}
path: artifacts/kind-logs
upgrade:
runs-on: ubuntu-20.04
if: ${{ (!contains(toJSON(needs.gates.outputs.commitmsg), 'skip-e2e') && needs.gates.outputs.fileChangesToCoreArtifacts == 'true')}}
needs:
- binary
- gates
strategy:
fail-fast: false
matrix:
k8s:
- v1.19.11
suite:
- minimal
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/download-artifact@v2
with:
name: karina
path: ./.bin
- name: Run upgrade testing script
id: upgrade
env:
GIT_API_KEY: ${{ secrets.GITHUB_TOKEN }}
SUITE: ${{ matrix.suite }}
KUBERNETES_VERSION: ${{matrix.k8s}}
BUILD: test (${{matrix.k8s}}, ${{ matrix.suite }})
REFERENCE_VERSION: v0.51.0
run: ./test/upgrade.sh
- name: Upload test results
if: ${{ always() }}
uses: actions/upload-artifact@v2
with:
if-no-files-found: ignore
name: test-results-${{matrix.k8s}}-${{matrix.suite}}
path: test-results/
- name: Upload snapshots
if: ${{ always() }}
uses: actions/upload-artifact@v2
with:
if-no-files-found: ignore
name: snapshot-${{matrix.k8s}}-${{matrix.suite}}
path: artifacts/snapshot.zip
- name: Generate Kind logs
if: failure()
run: kind export logs --name=kind-${{matrix.suite}}-${{matrix.k8s}} artifacts/kind-logs
- name: Upload Kind logs
if: failure()
uses: actions/upload-artifact@v2
with:
if-no-files-found: ignore
name: kind-logs-${{matrix.k8s}}-${{matrix.suite}}
path: artifacts/kind-logs
# selfhosted:
# runs-on: [self-hosted]
# if: ${{ (!contains(toJSON(needs.gates.outputs.commitmsg), 'skip-e2e') && needs.gates.outputs.fileChangesToCoreArtifacts == 'true')}}
# needs:
# - binary
# - gates
# strategy:
# fail-fast: false
# matrix:
# k8s:
# - v1.19.11
# suite:
# - minimal
# # - minimal-antrea
# - monitoring
# - harbor2
# # - postgres
# # - elastic
# # - security
# - platform
# # - nosql
# # - cicd
# steps:
# - uses: actions/checkout@v3
# with:
# fetch-depth: 0
# - uses: actions/download-artifact@v2
# with:
# name: karina
# path: ./.bin
# - name: Run e2e testing script
# id: e2e
# env:
# CACHE_DIR: /runner/_work
# GIT_API_KEY: ${{ secrets.GITHUB_TOKEN }}
# SUITE: ${{ matrix.suite }}
# KUBERNETES_VERSION: ${{matrix.k8s}}
# BUILD: test (${{matrix.k8s}}, ${{ matrix.suite }})
# KIND_IMAGE: harbor.lab.flanksource/docker.io/kindest/node
# ADDITIONAL_CONFIG: -c test/vsphere-harbor.yaml
# run: ./test/test.sh
# - name: Upload test results
# if: ${{ always() }}
# uses: actions/upload-artifact@v2
# with:
# if-no-files-found: ignore
# name: test-results-${{matrix.k8s}}-${{matrix.suite}}
# path: test-results/
# - name: Upload snapshots
# if: ${{ always() }}
# uses: actions/upload-artifact@v2
# with:
# if-no-files-found: ignore
# name: snapshot-${{matrix.k8s}}-${{matrix.suite}}
# path: artifacts/snapshot.zip
# - name: Generate Kind logs
# if: failure()
# run: .bin/kind export logs --name $(.bin/kind cluster get) artifacts/kind-logs
# - name: Upload Kind logs
# if: failure()
# uses: actions/upload-artifact@v2
# with:
# if-no-files-found: ignore
# name: kind-logs-${{matrix.k8s}}-${{matrix.suite}}
# path: artifacts/kind-logs