forked from linkerd/linkerd2
-
Notifications
You must be signed in to change notification settings - Fork 0
387 lines (365 loc) · 12.5 KB
/
integration.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
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
name: Integration tests
on:
pull_request:
paths:
- .github/workflows/integration.yml
- .proxy-version
- '**/*.go'
- '**/Dockerfile*'
- Cargo.lock
- charts/**
- go.sum
- justfile
- multicluser/**
- policy-controller/**
- policy-test/**
- viz/**
- '!.devcontainer/**'
permissions:
contents: read
env:
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
DOCKER_REGISTRY: ghcr.io/linkerd
GH_ANNOTATION: true
K3D_VERSION: v5.4.4
RUST_BACKTRACE: short
RUSTUP_MAX_RETRIES: 10
YQ_VERSION: v4.25.1
jobs:
cleanup:
runs-on: ubuntu-20.04
permissions:
actions: write
steps:
- uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5
with:
all_but_latest: true
access_token: ${{ github.token }}
tag:
needs: [cleanup]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b
- run: echo "::set-output name=tag::$(CI_FORCE_CLEAN=1 bin/root-tag)"
id: tag
outputs:
tag: ${{ steps.tag.outputs.tag }}
build-cli:
needs: [tag]
runs-on: ubuntu-20.04
timeout-minutes: 15
steps:
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b
- uses: ./.github/actions/docker-build
id: build
with:
docker-registry: ${{ env.DOCKER_REGISTRY }}
docker-target: linux-amd64
component: cli-bin
tag: ${{ needs.tag.outputs.tag }}
- name: Extract CLI binary
run: |
mkdir -p /home/runner/archives
id=$(docker create '${{ steps.build.outputs.image }}')
docker cp "$id:/out/linkerd-linux-amd64" /home/runner/archives/linkerd
v=$(/home/runner/archives/linkerd version --short --client)
[[ "$v" == '${{ needs.tag.outputs.tag }}' ]] || exit 1
- uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb
with:
name: image-archives
path: /home/runner/archives
##
## Core: Test the core control plane
##
## TODO(ver) CNI configurations should be tested separately.
##
build-core:
needs: [tag]
runs-on: ubuntu-20.04
strategy:
matrix:
component:
- cni-plugin
- controller
- policy-controller
- proxy
timeout-minutes: 15
steps:
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b
- uses: ./.github/actions/docker-build
id: build
with:
docker-registry: ${{ env.DOCKER_REGISTRY }}
docker-target: linux-amd64
component: ${{ matrix.component }}
tag: ${{ needs.tag.outputs.tag }}
- name: Run docker save
run: |
mkdir -p /home/runner/archives
docker save '${{ steps.build.outputs.image }}' >'/home/runner/archives/${{ matrix.component }}.tar'
- uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb
with:
name: image-archives
path: /home/runner/archives
test-core:
needs: [tag, build-cli, build-core]
strategy:
matrix:
test:
- cni-calico-deep
- deep
continue-on-error: true
runs-on: ubuntu-20.04
timeout-minutes: 15
steps:
- uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568
with:
go-version: '1.18'
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b
- uses: actions/download-artifact@9782bd6a9848b53b110e712e20e42d89988822b7
with:
name: image-archives
path: image-archives
- run: cp image-archives/linkerd "$HOME" && chmod 755 "$HOME/linkerd"
- run: find image-archives -ls
- run: bin/tests --images archive --cleanup-docker --name ${{ matrix.test }} "$HOME/linkerd"
env:
LINKERD_DOCKER_REGISTRY: ${{ env.DOCKER_REGISTRY }}
TAG: ${{ needs.tag.outputs.tag }}
##
## Policy: Only run policy tests when the policy controller or proxy changes
##
changed-policy:
needs: [cleanup]
runs-on: ubuntu-20.04
timeout-minutes: 5
steps:
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b
- uses: tj-actions/changed-files@1d1287f9fafd92be283f99b781fb5f00f00dd471
id: changed
with:
files: |
.github/workflows/integration.yml
.proxy-version
Cargo.lock
charts/linkerd-control-plane/**
charts/linkerd-crds/templates/policy/**
justfile
policy-controller/**
policy-test/**
outputs:
modified: ${{ steps.changed.outputs.any_modified }}
test-policy:
needs: [tag, changed-policy, build-cli, build-core]
if: needs.changed-policy.outputs.modified == 'true'
runs-on: ubuntu-20.04
timeout-minutes: 20
strategy:
matrix:
k8s:
- v1.21
- v1.25
steps:
- uses: extractions/setup-just@95b912dc5d3ed106a72907f2f9b91e76d60bdb76
- uses: olix0r/cargo-action-fmt/setup@9269f3aa1ff01775d95efc97037e2cbdb41d9684
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b
- uses: actions/download-artifact@9782bd6a9848b53b110e712e20e42d89988822b7
with:
name: image-archives
path: image-archives
- run: find image-archives -ls
- run: cp image-archives/linkerd "$HOME" && chmod 755 "$HOME/linkerd"
- name: Setup deps
run: |
rm -rf "$HOME/.cargo"
bin/scurl -v https://sh.rustup.rs | sh -s -- -y --default-toolchain "$(cat rust-toolchain)"
# shellcheck disable=SC1090
source ~/.cargo/env
echo "PATH=$PATH" >> "$GITHUB_ENV"
bin/scurl -v "https://raw.githubusercontent.com/k3d-io/k3d/${K3D_VERSION}/install.sh" | bash
bin/scurl -vo /usr/local/bin/yq "https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_amd64" && chmod +x /usr/local/bin/yq
- run: just policy-test-build
- run: just k3d-k8s='${{ matrix.k8s }}' k3d-create
- run: docker load <image-archives/controller.tar
- run: docker load <image-archives/policy-controller.tar
- run: docker load <image-archives/proxy.tar
- run: docker image ls
- run: just linkerd-tag='${{ needs.tag.outputs.tag }}' linkerd-exec="$HOME/linkerd" linkerd-install
- name: Load images
run: |
# Image loading is flakey in CI, so retry!
for _ in {1..6} ; do
if just linkerd-tag='${{ needs.tag.outputs.tag }}' policy-test-deps-load ; then exit 0 ; fi
sleep 10
echo retrying...
done
exit 1
- run: just policy-test-run --jobs=1
##
## Ext: Run tests that require non-core components.
##
build-ext:
needs: [tag]
runs-on: ubuntu-20.04
strategy:
matrix:
component:
- jaeger-webhook
- metrics-api
- tap
- web
timeout-minutes: 15
steps:
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b
- uses: ./.github/actions/docker-build
id: build
with:
docker-registry: ${{ env.DOCKER_REGISTRY }}
docker-target: linux-amd64
component: ${{ matrix.component }}
tag: ${{ needs.tag.outputs.tag }}
- name: Run docker save
run: |
mkdir -p /home/runner/archives
docker save '${{ steps.build.outputs.image }}' >'/home/runner/archives/${{ matrix.component }}.tar'
- uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb
with:
name: image-archives
path: /home/runner/archives
# These tests exercise core functionality, but need the viz extension.
test-ext:
needs: [tag, build-cli, build-core, build-ext]
strategy:
matrix:
integration_test:
- cluster-domain
- default-policy-deny
- external
- rsa-ca
# Skipping Helm upgrade test given chart in 2.11 is backwards-incompatible
#- helm-upgrade
- uninstall
- upgrade-edge
- upgrade-stable
continue-on-error: true
runs-on: ubuntu-20.04
timeout-minutes: 15
steps:
- uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568
with:
go-version: '1.18'
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b
- uses: actions/download-artifact@9782bd6a9848b53b110e712e20e42d89988822b7
with:
name: image-archives
path: image-archives
- run: cp image-archives/linkerd "$HOME" && chmod 755 "$HOME/linkerd"
- run: ls -l image-archives/linkerd
- run: bin/tests --images archive --cleanup-docker --name '${{ matrix.integration_test }}' "$HOME/linkerd"
env:
LINKERD_DOCKER_REGISTRY: ${{ env.DOCKER_REGISTRY }}
##
## Viz: Run the (flakey) `viz` suite only when the `viz` extension is updated.
##
changed-viz:
needs: [cleanup]
runs-on: ubuntu-20.04
timeout-minutes: 5
steps:
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b
- uses: tj-actions/changed-files@1d1287f9fafd92be283f99b781fb5f00f00dd471
id: changed
with:
files: |
.github/workflows/integration.yml
.proxy-version
justfile
viz/**
test/integration/viz/**
outputs:
modified: ${{ steps.changed.outputs.any_modified }}
test-viz:
needs: [tag, changed-viz, build-cli, build-core, build-ext]
if: needs.changed-viz.outputs.modified == 'true'
continue-on-error: true
runs-on: ubuntu-20.04
timeout-minutes: 15
steps:
- uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568
with:
go-version: '1.18'
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b
- uses: actions/download-artifact@9782bd6a9848b53b110e712e20e42d89988822b7
with:
name: image-archives
path: image-archives
- run: cp image-archives/linkerd "$HOME" && chmod 755 "$HOME/linkerd"
- run: ls -l image-archives/linkerd
- run: bin/tests --images archive --cleanup-docker --name viz "$HOME/linkerd"
env:
LINKERD_DOCKER_REGISTRY: ${{ env.DOCKER_REGISTRY }}
##
## Multicluster: Run 'multicluster' suite only when the 'multicluster' extension is updated.
## Tests are run on min and max k8s versions
##
changed-multicluster:
needs: [cleanup]
runs-on: ubuntu-20.04
timeout-minutes: 5
steps:
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b
- uses: tj-actions/changed-files@1d1287f9fafd92be283f99b781fb5f00f00dd471
id: changed
with:
files: |
.github/workflows/integration.yml
.proxy-version
justfile
multicluster/**
test/integration/multicluster/**
outputs:
modified: ${{ steps.changed.outputs.any_modified }}
test-multicluster:
needs: [tag, changed-multicluster, build-cli, build-core, build-ext]
if: needs.changed-multicluster.outputs.modified == 'true'
runs-on: ubuntu-20.04
timeout-minutes: 20
strategy:
matrix:
k8s:
- v1.21
- v1.25
steps:
- uses: extractions/setup-just@95b912dc5d3ed106a72907f2f9b91e76d60bdb76
- uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568
with:
go-version: '1.18'
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b
- uses: actions/download-artifact@9782bd6a9848b53b110e712e20e42d89988822b7
with:
name: image-archives
path: image-archives
- run: cp image-archives/linkerd "$HOME" && chmod 755 "$HOME/linkerd"
- run: ls -l image-archives/linkerd
- name: Setup deps
run: |
echo "PATH=$PATH" >> "$GITHUB_ENV"
bin/scurl -v "https://raw.githubusercontent.com/k3d-io/k3d/${K3D_VERSION}/install.sh" | bash
- name: Load docker images
run: |
for img in controller policy-controller proxy web metrics-api tap jaeger-webhook; do
docker load <"image-archives/${img}.tar"
done
- run: docker image ls
- run: just mc-test-build
- name: Run just mc-test-load
run: |
just linkerd-tag='${{ needs.tag.outputs.tag }}' \
k3d-k8s='${{ matrix.k8s }}' \
mc-test-load
- name: Run just mc-test-run
run: |
just linkerd-tag='${{ needs.tag.outputs.tag }}' \
k3d-k8s='${{ matrix.k8s }}' \
mc-test-run