32
32
uses : ./.github/workflows/build-k3s.yaml
33
33
with :
34
34
upload-image : true
35
+ build-arm64 :
36
+ uses : ./.github/workflows/build-k3s.yaml
37
+ with :
38
+ arch : ubuntu-24.04-arm
39
+ upload-image : true
35
40
e2e :
36
41
name : " E2E Tests"
37
42
needs : build
40
45
strategy :
41
46
fail-fast : false
42
47
matrix :
43
- etest : [startup, s3, btrfs, externalip, privateregistry, embeddedmirror, wasm]
48
+ etest : [autoimport, startup, s3, btrfs, externalip, privateregistry, embeddedmirror, wasm]
44
49
max-parallel : 3
45
50
steps :
46
51
- name : " Checkout"
@@ -80,44 +85,118 @@ jobs:
80
85
chmod +x ./dist/artifacts/k3s
81
86
cd tests/e2e/${{ matrix.etest }}
82
87
go test -v -timeout=45m ./${{ matrix.etest}}_test.go -ci -local
88
+ - name : On Failure, Upload Journald Logs
89
+ uses : actions/upload-artifact@v4
90
+ if : ${{ failure() }}
91
+ with :
92
+ name : ${{ matrix.etest}}-journald-logs
93
+ path : tests/e2e/${{ matrix.etest }}/*-jlog.txt
94
+ retention-days : 30
83
95
- name : On Failure, Launch Debug Session
84
96
uses : lhotari/action-upterm@v1
85
97
if : ${{ failure() }}
86
98
with :
87
99
# # If no one connects after 5 minutes, shut down server.
88
100
wait-timeout-minutes : 5
89
101
- name : Upload Results To Codecov
90
- uses : codecov/codecov-action@v4
102
+ uses : codecov/codecov-action@v5
91
103
with :
92
104
token : ${{ secrets.CODECOV_TOKEN }}
93
105
files : tests/e2e/${{ matrix.etest }}/coverage.out
94
106
flags : e2etests # optional
95
107
verbose : true # optional (default = false)
96
- docker :
97
- needs : build
98
- name : Docker Tests
99
- runs-on : ubuntu-latest
100
- timeout-minutes : 20
108
+
109
+ build-go-tests :
110
+ name : " Build Go Tests"
101
111
strategy :
102
- fail-fast : false
103
112
matrix :
104
- dtest : [basics, bootstraptoken, cacerts, compat, lazypull, upgrade]
113
+ arch : [amd64, arm64]
114
+ runs-on : ${{ matrix.arch == 'arm64' && 'ubuntu-24.04-arm' || 'ubuntu-latest' }}
115
+ outputs :
116
+ channel : ${{ steps.channel_step.outputs.channel }}
105
117
steps :
106
118
- name : Checkout
107
119
uses : actions/checkout@v4
120
+ - name : Install Go
121
+ uses : ./.github/actions/setup-go
122
+ - name : Build Go Tests
123
+ run : |
124
+ mkdir -p ./dist/artifacts
125
+ go test -c -ldflags="-w -s" -o ./dist/artifacts ./tests/docker/...
126
+ - name : Upload Go Tests
127
+ uses : actions/upload-artifact@v4
108
128
with :
109
- fetch-depth : 1
110
- - name : " Download k3s image"
129
+ name : docker-go-tests-${{ matrix.arch }}
130
+ path : ./dist/artifacts/*.test
131
+ compression-level : 9
132
+ retention-days : 1
133
+ # For upgrade and skew tests, we need to know the channel this run is based off.
134
+ # Since this is predetermined, we can run this step before the actual test job, saving time.
135
+ - name : Determine channel
136
+ id : channel_step
137
+ run : |
138
+ . ./scripts/version.sh
139
+ MINOR_VER=$(echo $VERSION_TAG | cut -d'.' -f1,2)
140
+ echo "CHANNEL=$MINOR_VER" >> $GITHUB_OUTPUT
141
+ # channel name should be v1.XX or latest
142
+ - name : Fail if channel name does not match pattern
143
+ run : |
144
+ if [[ ! ${{ steps.channel_step.outputs.channel }} =~ ^v1\.[0-9]+$|latest$ ]]; then
145
+ echo "Channel name ${{ steps.channel_step.outputs.channel }} does not match pattern"
146
+ exit 1
147
+ fi
148
+
149
+ docker-go :
150
+ needs : [build, build-arm64, build-go-tests]
151
+ name : Docker
152
+ timeout-minutes : 30
153
+ strategy :
154
+ fail-fast : false
155
+ matrix :
156
+ dtest : [basics, bootstraptoken, cacerts, etcd, lazypull, skew, snapshotrestore, upgrade]
157
+ arch : [amd64, arm64]
158
+ runs-on : ${{ matrix.arch == 'arm64' && 'ubuntu-24.04-arm' || 'ubuntu-latest' }}
159
+ env :
160
+ CHANNEL : ${{ needs.build-go-tests.outputs.channel }}
161
+ steps :
162
+ - name : Checkout
163
+ uses : actions/checkout@v4
164
+ - name : " Download K3s image (amd64)"
165
+ if : ${{ matrix.arch == 'amd64' }}
111
166
uses : actions/download-artifact@v4
112
167
with :
113
168
name : k3s
114
169
path : ./dist/artifacts
115
- - name : Load k3s image
116
- run : docker image load -i ./dist/artifacts/k3s-image.tar
117
- - name : Run ${{ matrix.dtest }} Test
118
- run : |
170
+ - name : " Download K3s image (arm64)"
171
+ if : ${{ matrix.arch == 'arm64' }}
172
+ uses : actions/download-artifact@v4
173
+ with :
174
+ name : k3s-arm64
175
+ path : ./dist/artifacts
176
+ - name : Load and set K3s image
177
+ run : |
178
+ if [ ${{ matrix.arch }} = "arm64" ]; then
179
+ mv ./dist/artifacts/k3s-arm64 ./dist/artifacts/k3s
180
+ fi
119
181
chmod +x ./dist/artifacts/k3s
120
- . ./scripts/version.sh
121
- . ./tests/docker/test-helpers
122
- . ./tests/docker/test-run-${{ matrix.dtest }}
123
- echo "Did test-run-${{ matrix.dtest }} pass $?"
182
+ docker image load -i ./dist/artifacts/k3s-image.tar
183
+ IMAGE_TAG=$(docker image ls --format '{{.Repository}}:{{.Tag}}' | grep 'rancher/k3s')
184
+ echo "K3S_IMAGE=$IMAGE_TAG" >> $GITHUB_ENV
185
+ - name : Download Go Tests
186
+ uses : actions/download-artifact@v4
187
+ with :
188
+ name : docker-go-tests-${{ matrix.arch }}
189
+ path : ./dist/artifacts
190
+ - name : Run ${{ matrix.dtest }} Test
191
+ # Put the compiled test binary back in the same place as the test source
192
+ run : |
193
+ chmod +x ./dist/artifacts/${{ matrix.dtest }}.test
194
+ mv ./dist/artifacts/${{ matrix.dtest }}.test ./tests/docker/${{ matrix.dtest }}/
195
+ cd ./tests/docker/${{ matrix.dtest }}
196
+ if [ ${{ matrix.dtest }} = "upgrade" ] || [ ${{ matrix.dtest }} = "skew" ]; then
197
+ ./${{ matrix.dtest }}.test -k3sImage=$K3S_IMAGE -channel=$CHANNEL
198
+ elif [ ${{ matrix.dtest }} = "snapshotrestore" ]; then
199
+ ./${{ matrix.dtest }}.test -ci
200
+ else
201
+ ./${{ matrix.dtest }}.test -k3sImage=$K3S_IMAGE
202
+ fi
0 commit comments