-
Notifications
You must be signed in to change notification settings - Fork 0
479 lines (440 loc) · 18.8 KB
/
version-skew.yaml
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
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
#
# Copyright 2023 The Dapr Authors
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
name: Version Skew tests
on:
# Run when a PR is merged to master.
push:
branches:
- master
# Dispatch on external events
repository_dispatch:
types:
- test-version-skew
defaults:
run:
shell: bash
# Jobs can be triggered with the `/test-version-skew` command. You can also
# supply a specific version to test against, overriding the current latest
# release, e.g. `/test-version-skew 1.10.5`. This is useful for testing
# against a specific patch or release candidate. This version must be a
# valid tag and artefacts be publicly available. Remember that Dapr only
# guarantees N-1.
jobs:
# Dapr guarantees that the control plane and Dapr sidecars may have a version
# skew of N-1 and still be fully functional. This workflow verifies this
# guarantee holds for master and the previous release (or overridden version
# reference).
# This workflow runs the previous releases integration tests against the
# matrix of master/latest-release daprd/control-plane. This ensures the
# previous assertions hold for the current HEAD, and version skew works
# between daprd and the control plane.
integration-version-skew:
name: integration-version-skew
runs-on: ubuntu-latest
strategy:
fail-fast: false # Keep running if one leg fails.
matrix:
mode:
- control-plane-master
- dapr-sidecar-master
steps:
- name: Set up for Dapr lastest release
run: |
echo "DAPR_PREV_VERSION=$(curl -s https://api.github.com/repos/dapr/dapr/releases/latest | jq -r '.tag_name' | cut -c 2-)" >> $GITHUB_ENV
- name: Set up for master
if: github.event_name != 'repository_dispatch'
run: |
echo "CHECKOUT_REPO=${{ github.repository }}" >> $GITHUB_ENV
echo "CHECKOUT_REF=refs/heads/master" >> $GITHUB_ENV
shell: bash
- name: Setup test output
shell: bash
run: |
export TEST_OUTPUT_FILE_PREFIX=$GITHUB_WORKSPACE/test_report
echo "TEST_OUTPUT_FILE_PREFIX=$TEST_OUTPUT_FILE_PREFIX" >> $GITHUB_ENV
- name: Parse test payload
if: github.event_name == 'repository_dispatch'
uses: actions/[email protected]
with:
github-token: ${{secrets.DAPR_BOT_TOKEN}}
script: |
const testPayload = context.payload.client_payload;
if (testPayload) {
var fs = require('fs');
var envs = `CHECKOUT_REPO=${testPayload.pull_head_repo}\n`+
`CHECKOUT_REF=${testPayload.pull_head_ref}\n`+
`PR_NUMBER=${testPayload.issue.number}`;
if (testPayload.previous_version) {
envs += `\nDAPR_PREV_VERSION=${testPayload.previous_version}`;
}
// Set environment variables
fs.appendFileSync(process.env.GITHUB_ENV, envs);
}
- name: Create PR comment
if: env.PR_NUMBER != ''
uses: artursouza/[email protected]
with:
header: ${{ github.run_id }}-version-skew-integration-${{ matrix.mode }}-${{ env.DAPR_PREV_VERSION }}
number: ${{ env.PR_NUMBER }}
hide: true
hide_classify: OUTDATED
GITHUB_TOKEN: ${{ secrets.DAPR_BOT_TOKEN }}
message: |
# Dapr Version Skew integration test (${{ matrix.mode }} - ${{ env.DAPR_PREV_VERSION }})
🔗 **[Link to Action run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})**
Commit ref: ${{ env.CHECKOUT_REF }}
- name: Check out code
uses: actions/checkout@v3
with:
repository: ${{ env.CHECKOUT_REPO }}
ref: ${{ env.CHECKOUT_REF }}
- name: Checkout last release repo
uses: actions/checkout@v3
with:
repository: dapr/dapr
path: latest-release
ref: v${{ env.DAPR_PREV_VERSION }}
- name: Apply patches to latest release
run: |
export DAPR_LATEST_MAJOR_MINOR=$(echo ${{ env.DAPR_PREV_VERSION }} | cut -d. -f1-2)
export DAPR_PATCH_DIR="$(pwd)/.github/scripts/version-skew-test-patches/integration/release-$DAPR_LATEST_MAJOR_MINOR"
if [ -d "$DAPR_PATCH_DIR" ]; then
cd latest-release
echo "Applying patches from $DAPR_PATCH_DIR to $(pwd)"
git apply --ignore-space-change --ignore-whitespace $DAPR_PATCH_DIR/*.patch
git diff
fi
- name: Set up Go
id: setup-go
uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
- name: Build & download binaries
run: |
go mod tidy -v
make build
mkdir -p downloads && cd downloads
curl -so daprd_linux_amd64.tar.gz -L https://github.com/dapr/dapr/releases/download/v${{ env.DAPR_PREV_VERSION }}/daprd_linux_amd64.tar.gz
curl -so sentry_linux_amd64.tar.gz -L https://github.com/dapr/dapr/releases/download/v${{ env.DAPR_PREV_VERSION }}/sentry_linux_amd64.tar.gz
curl -so placement_linux_amd64.tar.gz -L https://github.com/dapr/dapr/releases/download/v${{ env.DAPR_PREV_VERSION }}/placement_linux_amd64.tar.gz
curl -so injector_linux_amd64.tar.gz -L https://github.com/dapr/dapr/releases/download/v${{ env.DAPR_PREV_VERSION }}/injector_linux_amd64.tar.gz
curl -so operator_linux_amd64.tar.gz -L https://github.com/dapr/dapr/releases/download/v${{ env.DAPR_PREV_VERSION }}/operator_linux_amd64.tar.gz
tar xvf daprd_linux_amd64.tar.gz
tar xvf sentry_linux_amd64.tar.gz
tar xvf placement_linux_amd64.tar.gz
tar xvf injector_linux_amd64.tar.gz
tar xvf operator_linux_amd64.tar.gz
- name: Setup DAPR_INTEGRATION_X_PATH - control-plane master
if: matrix.mode == 'control-plane-master'
run: |
echo "DAPR_INTEGRATION_DAPRD_PATH=$(pwd)/downloads/daprd" >> $GITHUB_ENV
echo "DAPR_INTEGRATION_PLACEMENT_PATH=$(pwd)/dist/linux_amd64/release/placement" >> $GITHUB_ENV
echo "DAPR_INTEGRATION_OPERATOR_PATH=$(pwd)/dist/linux_amd64/release/operator" >> $GITHUB_ENV
echo "DAPR_INTEGRATION_SENTRY_PATH=$(pwd)/dist/linux_amd64/release/sentry" >> $GITHUB_ENV
echo "DAPR_INTEGRATION_INJECTOR_PATH=$(pwd)/dist/linux_amd64/release/injector" >> $GITHUB_ENV
- name: Setup DAPR_INTEGRATION_X_PATH - dapr-sidecar master
if: matrix.mode == 'dapr-sidecar-master'
run: |
echo "DAPR_INTEGRATION_DAPRD_PATH=$(pwd)/dist/linux_amd64/release/daprd" >> $GITHUB_ENV
echo "DAPR_INTEGRATION_PLACEMENT_PATH=$(pwd)/downloads/placement" >> $GITHUB_ENV
echo "DAPR_INTEGRATION_SENTRY_PATH=$(pwd)/downloads/sentry" >> $GITHUB_ENV
echo "DAPR_INTEGRATION_OPERATOR_PATH=$(pwd)/downloads/operator" >> $GITHUB_ENV
echo "DAPR_INTEGRATION_INJECTOR_PATH=$(pwd)/downloads/injector" >> $GITHUB_ENV
- name: Run make test-integration
run: cd latest-release && make test-integration
- name: Upload test results
if: always()
uses: actions/upload-artifact@master
with:
name: latest-release/${{ matrix.mode }}_test_e2e.json
path: latest-release/${{ env.TEST_OUTPUT_FILE_PREFIX }}_integration.*
- name: Update PR comment for success
if: ${{ success() }}
uses: artursouza/[email protected]
with:
header: ${{ github.run_id }}-version-skew-integration-${{ matrix.mode }}-${{ env.DAPR_PREV_VERSION }}
number: ${{ env.PR_NUMBER }}
append: true
GITHUB_TOKEN: ${{ secrets.DAPR_BOT_TOKEN }}
message: |
## ✅ Version Skew tests passed
- name: Update PR comment for failure
if: ${{ failure() }}
uses: artursouza/[email protected]
with:
header: ${{ github.run_id }}-version-skew-integration-${{ matrix.mode }}-${{ env.DAPR_PREV_VERSION }}
number: ${{ env.PR_NUMBER }}
append: true
GITHUB_TOKEN: ${{ secrets.DAPR_BOT_TOKEN }}
message: |
## ❌ Version Skew tests failed
Please check the logs for details on the error.
- name: Update PR comment for cancellation
if: ${{ cancelled() }}
uses: artursouza/[email protected]
with:
header: ${{ github.run_id }}-version-skew-integration-${{ matrix.mode }}-${{ env.DAPR_PREV_VERSION }}
number: ${{ env.PR_NUMBER }}
append: true
GITHUB_TOKEN: ${{ secrets.DAPR_BOT_TOKEN }}
message: |
## ⚠️ Version Skew tests cancelled
The Action has been canceled
# This workflow runs our e2e tests on KinD. Tests are performed with the
# control plane on master and side car on the previous release, and vice
# versa.
#
# The e2e tests from the previous release are run against this deployment.
e2e-version-skew:
name: e2e-version-skew
runs-on: ubuntu-latest
env:
REGISTRY_PORT: 5000
REGISTRY_NAME: kind-registry
DAPR_REGISTRY: localhost:5000/dapr
DAPR_TAG: dev
DAPR_NAMESPACE: dapr-tests
DAPR_CACHE_REGISTRY: "dapre2eacr.azurecr.io"
PULL_POLICY: Always
strategy:
fail-fast: false # Keep running if one leg fails.
matrix:
mode:
- control-plane-master
- dapr-sidecar-master
steps:
- name: Set up for Dapr lastest release
run: |
echo "DAPR_PREV_VERSION=$(curl -s https://api.github.com/repos/dapr/dapr/releases/latest | jq -r '.tag_name' | cut -c 2-)" >> $GITHUB_ENV
- name: Set up for master
if: github.event_name != 'repository_dispatch'
run: |
echo "CHECKOUT_REPO=${{ github.repository }}" >> $GITHUB_ENV
echo "CHECKOUT_REF=refs/heads/master" >> $GITHUB_ENV
shell: bash
- name: Parse test payload
if: github.event_name == 'repository_dispatch'
uses: actions/[email protected]
with:
github-token: ${{secrets.DAPR_BOT_TOKEN}}
script: |
const testPayload = context.payload.client_payload;
if (testPayload) {
var fs = require('fs');
var envs = `CHECKOUT_REPO=${testPayload.pull_head_repo}\n`+
`CHECKOUT_REF=${testPayload.pull_head_ref}\n`+
`PR_NUMBER=${testPayload.issue.number}`;
if (testPayload.previous_version) {
envs += `\nDAPR_PREV_VERSION=${testPayload.previous_version}`;
}
// Set environment variables
fs.appendFileSync(process.env.GITHUB_ENV, envs);
}
- name: Create PR comment
if: env.PR_NUMBER != ''
uses: artursouza/[email protected]
with:
header: ${{ github.run_id }}-version-skew-e2e-${{ matrix.mode }}-${{ env.DAPR_PREV_VERSION }}
number: ${{ env.PR_NUMBER }}
hide: true
hide_classify: OUTDATED
GITHUB_TOKEN: ${{ secrets.DAPR_BOT_TOKEN }}
message: |
# Dapr Version Skew e2e test (${{ matrix.mode }} - ${{ env.DAPR_PREV_VERSION }})
🔗 **[Link to Action run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})**
Commit ref: ${{ env.CHECKOUT_REF }}
- name: Check out code
uses: actions/checkout@v4
with:
repository: ${{ env.CHECKOUT_REPO }}
ref: ${{ env.CHECKOUT_REF }}
- name: Checkout last release repo
uses: actions/checkout@v4
with:
repository: dapr/dapr
path: latest-release
ref: v${{ env.DAPR_PREV_VERSION }}
- name: Apply patches to latest release
run: |
export DAPR_LATEST_MAJOR_MINOR=$(echo ${{ env.DAPR_PREV_VERSION }} | cut -d. -f1-2)
export DAPR_PATCH_DIR="$(pwd)/.github/scripts/version-skew-test-patches/e2e/release-$DAPR_LATEST_MAJOR_MINOR/${{ matrix.mode }}"
if [ -d "$DAPR_PATCH_DIR" ]; then
echo "Applying patches from $DAPR_PATCH_DIR"
cd latest-release
echo "Applying patches from $DAPR_PATCH_DIR to $(pwd)"
git apply --ignore-space-change --ignore-whitespace $DAPR_PATCH_DIR/*.patch
git diff
fi
- name: Set up Go
id: setup-go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Configure KinD
run: |
cat > kind.yaml <<EOF
apiVersion: kind.x-k8s.io/v1alpha4
kind: Cluster
nodes:
- role: control-plane
image: kindest/node:v1.25.3@sha256:f52781bc0d7a19fb6c405c2af83abfeb311f130707a0e219175677e366cc45d1
- role: worker
image: kindest/node:v1.25.3@sha256:f52781bc0d7a19fb6c405c2af83abfeb311f130707a0e219175677e366cc45d1
- role: worker
image: kindest/node:v1.25.3@sha256:f52781bc0d7a19fb6c405c2af83abfeb311f130707a0e219175677e366cc45d1
- role: worker
image: kindest/node:v1.25.3@sha256:f52781bc0d7a19fb6c405c2af83abfeb311f130707a0e219175677e366cc45d1
containerdConfigPatches:
- |-
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."localhost:$REGISTRY_PORT"]
endpoint = ["http://$REGISTRY_NAME:$REGISTRY_PORT"]
EOF
# Log the generated kind.yaml for easy reference.
cat kind.yaml
# Set log target directories
echo "DAPR_CONTAINER_LOG_PATH=$GITHUB_WORKSPACE/container_logs/v1.25.3_ha" >> $GITHUB_ENV
echo "DAPR_TEST_LOG_PATH=$GITHUB_WORKSPACE/test_logs/v1.25.3_ha" >> $GITHUB_ENV
- name: Create KinD Cluster
uses: helm/[email protected]
with:
config: kind.yaml
cluster_name: kind
version: v0.17.0
- name: Get KinD info
run: |
kubectl cluster-info --context kind-kind
NODE_IP=$(kubectl get nodes \
-lkubernetes.io/hostname!=kind-control-plane \
-ojsonpath='{.items[0].status.addresses[?(@.type=="InternalIP")].address}')
echo "MINIKUBE_NODE_IP=$NODE_IP" >> $GITHUB_ENV
- name: Setup test output
shell: bash
run: |
export TEST_OUTPUT_FILE_PREFIX=$GITHUB_WORKSPACE/test_report
echo "TEST_OUTPUT_FILE_PREFIX=$TEST_OUTPUT_FILE_PREFIX" >> $GITHUB_ENV
- name: Setup local registry
run: |
# Run a registry.
docker run -d --restart=always \
-p $REGISTRY_PORT:$REGISTRY_PORT --name $REGISTRY_NAME registry:2
# Connect the registry to the KinD network.
docker network connect "kind" $REGISTRY_NAME
- name: Setup Helm
uses: azure/setup-helm@v3
with:
version: v3.3.4
- name: Build and push Dapr
run: |
make build-linux
make docker-build
make docker-push
- name: Build and push test apps
run: |
cd latest-release && make build-push-e2e-app-all
- name: Setup Dapr - control-plane master
if: matrix.mode == 'control-plane-master'
run: |
make setup-helm-init
make create-test-namespace
export ADDITIONAL_HELM_SET="dapr_operator.logLevel=debug,dapr_sidecar_injector.image.name=ghcr.io/dapr/daprd:${{env.DAPR_PREV_VERSION}}"
export HA_MODE=true
make docker-deploy-k8s
- name: Setup Dapr - control-plane previous release
if: matrix.mode == 'dapr-sidecar-master'
run: |
make setup-helm-init
make create-test-namespace
export DAPR_CLI_LATEST_VERSION=$(curl -s https://api.github.com/repos/dapr/cli/releases/latest | jq -r '.tag_name' | cut -c 2-)
wget -q https://raw.githubusercontent.com/dapr/cli/master/install/install.sh -O - | /bin/bash -s $DAPR_CLI_LATEST_VERSION
dapr uninstall --all
dapr init -k --runtime-version ${{ env.DAPR_PREV_VERSION }} \
--set dapr_operator.logLevel=debug,dapr_sidecar_injector.image.name=localhost:5000/dapr/daprd:dev-linux-amd64 \
-n dapr-tests --enable-ha
- name: Setup Components
run: |
cd latest-release
make setup-helm-init
make setup-test-env-redis
make setup-test-env-kafka
make setup-test-env-zipkin
make setup-test-env-postgres
make setup-test-components
- name: Free up some diskspace
run: |
docker image prune -a -f
- name: Run tests
run: |
cd latest-release && make test-e2e-all
- name: Save control plane logs
if: always()
run: |
cd latest-release && make save-dapr-control-plane-k8s-logs
# Container log files can be bigger than the maximum file size allowed by GitHub
- name: Compress logs
if: always()
run: |
gzip --fast -r ${{ env.DAPR_CONTAINER_LOG_PATH }}
gzip --fast -r ${{ env.DAPR_TEST_LOG_PATH }}
shell: bash
- name: Upload container logs
if: always()
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.mode}}_container_logs
path: ${{ env.DAPR_CONTAINER_LOG_PATH }}
compression-level: 0 # Content is already compressed
- name: Upload test logs
if: always()
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.mode}}_test_logs
path: ${{ env.DAPR_TEST_LOG_PATH }}
compression-level: 0 # Content is already compressed
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.mode }}_test_e2e.json
path: ${{ env.TEST_OUTPUT_FILE_PREFIX }}_e2e.*
- name: Update PR comment for success
if: ${{ success() }}
uses: artursouza/[email protected]
with:
header: ${{ github.run_id }}-version-skew-e2e-${{ matrix.mode }}-${{ env.DAPR_PREV_VERSION }}
number: ${{ env.PR_NUMBER }}
append: true
GITHUB_TOKEN: ${{ secrets.DAPR_BOT_TOKEN }}
message: |
## ✅ Version Skew tests passed
- name: Update PR comment for failure
if: ${{ failure() }}
uses: artursouza/[email protected]
with:
header: ${{ github.run_id }}-version-skew-e2e-${{ matrix.mode }}-${{ env.DAPR_PREV_VERSION }}
number: ${{ env.PR_NUMBER }}
append: true
GITHUB_TOKEN: ${{ secrets.DAPR_BOT_TOKEN }}
message: |
## ❌ Version Skew tests failed
Please check the logs for details on the error.
- name: Update PR comment for cancellation
if: ${{ cancelled() }}
uses: artursouza/[email protected]
with:
header: ${{ github.run_id }}-version-skew-e2e-${{ matrix.mode }}-${{ env.DAPR_PREV_VERSION }}
number: ${{ env.PR_NUMBER }}
append: true
GITHUB_TOKEN: ${{ secrets.DAPR_BOT_TOKEN }}
message: |
## ⚠️ Version Skew tests cancelled
The Action has been canceled