-
Notifications
You must be signed in to change notification settings - Fork 1.3k
392 lines (370 loc) · 12.6 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
387
388
389
390
391
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@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- run: echo "tag=$(CI_FORCE_CLEAN=1 bin/root-tag)" >> "$GITHUB_OUTPUT"
id: tag
outputs:
tag: ${{ steps.tag.outputs.tag }}
build-cli:
needs: [tag]
runs-on: ubuntu-20.04
timeout-minutes: 15
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- 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@0b7f8abb1508181956e8e162db84b466c27e18ce
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: 20
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- 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@0b7f8abb1508181956e8e162db84b466c27e18ce
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@fac708d6674e30b6ba41289acaab6d4b75aa0753
with:
go-version: '1.19'
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
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@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- uses: tj-actions/changed-files@c860b5c47fa71f461da850094ef2f6e3d6514e44
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.26
steps:
- uses: extractions/setup-just@69d82fb0233557aec017ef13706851d0694e0f1d
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: olix0r/cargo-action-fmt/setup@9269f3aa1ff01775d95efc97037e2cbdb41d9684
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
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
shell: bash
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@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- 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@0b7f8abb1508181956e8e162db84b466c27e18ce
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
- helm-upgrade
- uninstall
- upgrade-edge
- upgrade-stable
continue-on-error: true
runs-on: ubuntu-20.04
timeout-minutes: 15
steps:
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753
with:
go-version: '1.19'
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
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@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- uses: tj-actions/changed-files@c860b5c47fa71f461da850094ef2f6e3d6514e44
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@fac708d6674e30b6ba41289acaab6d4b75aa0753
with:
go-version: '1.19'
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
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@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- uses: tj-actions/changed-files@c860b5c47fa71f461da850094ef2f6e3d6514e44
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.26
steps:
- uses: extractions/setup-just@69d82fb0233557aec017ef13706851d0694e0f1d
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753
with:
go-version: '1.19'
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
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
shell: bash
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; 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