forked from linkerd/linkerd2
-
Notifications
You must be signed in to change notification settings - Fork 0
152 lines (149 loc) · 4.93 KB
/
integration_tests.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
name: Integration tests
on:
pull_request: {}
push:
paths-ignore:
- '*.md'
- '**/*.md'
branches:
- main
env:
GH_ANNOTATION: true
DOCKER_BUILDKIT: 1
jobs:
docker_build:
runs-on: ubuntu-18.04
strategy:
matrix:
# Keep in sync with release.yaml matrix build
target: [proxy, controller, web, cni-plugin, debug, cli-bin, grafana, jaeger-webhook]
name: Docker build (${{ matrix.target }})
timeout-minutes: 30
steps:
- name: Checkout code
# actions/checkout@v2
uses: actions/checkout@722adc6
- name: Set environment variables from scripts
run: |
. bin/_tag.sh
echo "TAG=$(CI_FORCE_CLEAN=1 bin/root-tag)" >> $GITHUB_ENV
. bin/_docker.sh
echo "DOCKER_REGISTRY=$DOCKER_REGISTRY" >> $GITHUB_ENV
echo "DOCKER_BUILDKIT_CACHE=${{ runner.temp }}/.buildx-cache" >> $GITHUB_ENV
- name: Cache docker layers
# actions/cache@v4
uses: actions/cache@v4
with:
path: ${{ env.DOCKER_BUILDKIT_CACHE }}
key: ${{ runner.os }}-buildx-${{ matrix.target }}-${{ env.TAG }}
restore-keys: |
${{ runner.os }}-buildx-${{ matrix.target }}-
- name: Build docker images
env:
DOCKER_TRACE: 1
run: |
docker buildx create --driver docker-container --use
bin/docker-build-${{ matrix.target }}
- name: Prune docker layers cache
# changes generate new images while the existing ones don't get removed
# so we manually do that to avoid bloating the cache
run: bin/docker-cache-prune
- name: Create artifact with CLI and image archives
env:
ARCHIVES: /home/runner/archives
run: |
mkdir -p $ARCHIVES
docker save "$DOCKER_REGISTRY/${{ matrix.target }}:$TAG" > $ARCHIVES/${{ matrix.target }}.tar
# save windows cli into artifacts
if [ '${{ matrix.target }}' == 'cli-bin' ]; then
cp -r ./target/cli/windows/linkerd $ARCHIVES/linkerd-windows.exe
fi
# `with.path` values do not support environment variables yet, so an
# absolute path is used here.
#
# https://github.com/actions/upload-artifact/issues/8
- name: Upload artifact
# actions/upload-artifact@v4
uses: actions/upload-artifact@v4
with:
name: image-archives
path: /home/runner/archives
# todo: Keep in sync with `release.yml`
windows_static_cli_tests:
name: Static CLI tests (windows)
runs-on: windows-latest
needs: [docker_build]
timeout-minutes: 30
steps:
- name: Checkout code
# actions/checkout@v2
uses: actions/checkout@722adc6
- name: Try to load cached Go modules
# actions/cache@v4
uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Download image archives
# actions/download-artifact@v4
uses: actions/download-artifact@v4
with:
name: image-archives
- name: Run CLI Integration tests
run: |
go test --failfast --mod=readonly ".\test\cli" --linkerd=$PWD\image-archives\linkerd-windows.exe --cli-tests -v
integration_tests:
strategy:
matrix:
integration_test:
- cluster-domain
- deep
- external-issuer
- helm-deep
- helm-upgrade
- multicluster
- uninstall
- upgrade-edge
- upgrade-stable
- cni-calico-deep
needs: [docker_build]
name: Integration tests (${{ matrix.integration_test }})
runs-on: ubuntu-18.04
timeout-minutes: 30
steps:
- name: Checkout code
# actions/checkout@v2
uses: actions/checkout@722adc6
- name: Try to load cached Go modules
# actions/cache@v4
uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Set environment variables from scripts
run: |
. bin/_tag.sh
echo "TAG=$(CI_FORCE_CLEAN=1 bin/root-tag)" >> $GITHUB_ENV
. bin/_docker.sh
echo "DOCKER_REGISTRY=$DOCKER_REGISTRY" >> $GITHUB_ENV
- name: Download image archives
# actions/download-artifact@v4
uses: actions/download-artifact@v4
with:
name: image-archives
- name: Load cli-bin image into local docker images
run: docker load < image-archives/cli-bin.tar
- name: Install CLI
run: |
# Copy the CLI out of the local cli-bin container.
container_id=$(docker create "$DOCKER_REGISTRY/cli-bin:$TAG")
docker cp $container_id:/out/linkerd-linux-amd64 "$HOME/.linkerd"
# Validate the CLI version matches the current build tag.
[[ "$TAG" == "$($HOME/.linkerd version --short --client)" ]]
- name: Run integration tests
run: |
bin/tests --images archive --name ${{ matrix.integration_test }} "$HOME/.linkerd"