3
gh: circleci/github-cli@2.0
11
default: "v1.23.17-k3s1"
14
default: "v1.29.1-k3s2"
17
default: "ubuntu-2204:2022.10.2"
18
gh_action_build_artifact_name:
26
default: "v1.28.1-k3s1"
30
e2e_param_parallelism:
36
e2e_param_cniNetworkPlugin:
42
description: "Install an upstream Go release to $HOME/go"
53
name: "Install basic tools"
55
if [ -r /etc/os-release ]; then source /etc/os-release; fi
58
if ! command -v sudo 2>&1 >/dev/null; then
64
sudo env DEBIAN_FRONTEND=noninteractive apt install -y curl git make unzip gcc xz-utils
71
curl -s --fail --location https://dl.google.com/go/go<<pipeline.parameters.go_version>>.linux-<<parameters.go_arch>>.tar.gz | tar -xz -C $HOME
72
echo 'export PATH=$HOME/go/bin:$PATH' >> $BASH_ENV
73
# if GOPATH is not set, `golang-ci` fails with an obscure message
74
# "ERROR Running error: context loading failed: failed to load program with go/packages: could not determine GOARCH and Go compiler"
75
echo 'export GOPATH=$HOME/go' >> $BASH_ENV
76
halt_non_priority_job:
77
description: "don't run following steps if in PR and doesn't have a specific label"
81
description: a label to for running this (if empty no label override is allowed)
82
default: "ci/run-full-matrix"
87
if [[ "<< pipeline.git.branch >>" == "master" || "<< pipeline.git.branch >>" == "release-"* ]]; then
88
echo "on a main branch so don't halt job"
91
if [[ "<< pipeline.git.tag >>" != "" ]]; then
92
echo "on a tag to don't halt job"
95
if [[ "<<parameters.label>>" != "" && $(${KUMA_DIR}/tools/ci/has_label.sh "<<parameters.label>>") == "true" ]]; then
96
echo "<<parameters.label>> label present on PR so don't halt job"
99
echo "halt running job"
100
circleci-agent step halt
102
setenv_depending_on_priority:
103
description: "don't run following steps if in PR and doesn't have a specific label"
107
description: a label to for running this (if empty no label override is allowed)
110
description: a set of env var to set if it's a priority job
116
echo 'export << parameters.env >>' >> "$BASH_ENV"
119
if [[ "<< pipeline.git.branch >>" == "master" || "<< pipeline.git.branch >>" == "release-"* ]]; then
120
echo "on a main branch so run everything"
123
if [[ "<< pipeline.git.tag >>" != "" ]]; then
124
echo "on a tag so run everything"
127
if [[ "<<parameters.label>>" != "" && $(${KUMA_DIR}/tools/ci/has_label.sh "<<parameters.label>>") == "true" ]]; then
128
echo "<<parameters.label>> label present on PR so run everything"
133
description: "don't run following steps if PR has a specific label"
137
description: a label to for running this (if empty no label override is allowed)
143
if [[ "<<parameters.label>>" != "" && $(${KUMA_DIR}/tools/ci/has_label.sh "<<parameters.label>>") == "true" ]]; then
144
echo "Not running as the PR has label: <<parameters.label>>"
145
circleci-agent step halt
148
echo "PR doesn't have label <<parameters.label>> keep running job"
152
resource_class: xlarge
154
- image: "cimg/go:<< pipeline.parameters.go_version >>"
157
GO_VERSION: << pipeline.parameters.go_version >>
159
resource_class: arm.xlarge
161
- image: "cimg/go:<< pipeline.parameters.go_version >>"
164
GO_VERSION: << pipeline.parameters.go_version >>
166
resource_class: xlarge
168
image: << pipeline.parameters.ubuntu_image >>
171
GO_VERSION: << pipeline.parameters.go_version >>
173
resource_class: large
175
image: << pipeline.parameters.ubuntu_image >>
178
GO_VERSION: << pipeline.parameters.go_version >>
180
resource_class: arm.large
182
image: << pipeline.parameters.ubuntu_image >>
185
GO_VERSION: << pipeline.parameters.go_version >>
188
executor: golang-<< parameters.arch >>
191
description: the executor to run on
197
key: vm-<< parameters.arch >>_go.mod_{{ checksum "go.sum" }}_{{ checksum "mk/dependencies/deps.lock" }}_{{ checksum ".circleci/config.yml" }}
199
command: make dev/tools
201
name: "Download Go modules"
205
key: vm-<< parameters.arch >>_go.mod_{{ checksum "go.sum" }}_{{ checksum "mk/dependencies/deps.lock" }}_{{ checksum ".circleci/config.yml" }}
207
- "/home/circleci/go/pkg/mod"
208
- "/home/circleci/.kuma-dev"
212
description: The test make target.
216
description: The golang arch.
220
name: vm-<< parameters.arch >>
224
condition: {equal: [arm64, << parameters.arch >>]}
226
- halt_non_priority_job
227
- halt_job_if_labeled:
228
label: "ci/skip-test"
229
- install_build_tools:
230
go_arch: << parameters.arch >>
233
- vm-<< parameters.arch >>_go.mod_{{ checksum "go.sum" }}_{{ checksum "mk/dependencies/deps.lock" }}_{{ checksum ".circleci/config.yml" }}
237
make << parameters.target >> TEST_REPORTS=1
240
destination: /reports
241
- store_test_results:
246
description: version of k3s to use or "kind" and "kindIpv6"
248
default: << pipeline.parameters.last_k8s_version >>
250
description: level of parallelization
254
description: makefile target without test/e2e prefix
258
description: The golang arch
262
description: The CNI networking plugin to use [flannel | calico]
266
name: vm-<< parameters.arch >>
267
parallelism: << parameters.parallelism >>
270
- halt_job_if_labeled:
271
label: "ci/skip-test"
272
- halt_job_if_labeled:
273
label: "ci/skip-e2e-test"
277
- {equal: ["", << parameters.target >>]}
278
- {equal: [calico, << parameters.cniNetworkPlugin >>]}
279
- {equal: [kindIpv6, << parameters.k8sVersion >>]}
280
- {equal: [arm64, << parameters.arch >>]}
281
- {equal: [<< pipeline.parameters.first_k8s_version >>, << parameters.k8sVersion >>]}
283
- halt_non_priority_job
287
name: skip_invalid_parameter_combinations
289
echo "Running with: \
290
k8s:<< parameters.k8sVersion >> \
291
target:<< parameters.target >> \
292
parallelism:<< parameters.parallelism >> \
293
arch:<< parameters.arch >> \
294
cniNetworkPlugin:<< parameters.cniNetworkPlugin >> \
297
echo "Non valid job combination halting job reason: $1"
298
circleci-agent step halt
303
if [[ "<< parameters.k8sVersion >>" == "kind" && "<< parameters.target >>" != "universal" ]]; then
304
skip "kind should only be used when testing ipv6 or with e2e-universal"
306
if [[ "<< parameters.k8sVersion >>" != kind* && "<< parameters.target >>" == "universal" ]]; then
307
skip "universal only runs on kind"
309
echo "Continuing tests"
310
- install_build_tools:
311
go_arch: << parameters.arch >>
314
- vm-<< parameters.arch >>_go.mod_{{ checksum "go.sum" }}_{{ checksum "mk/dependencies/deps.lock" }}_{{ checksum ".circleci/config.yml" }}
321
make dev/set-kuma-helm-repo
324
equal: [<< parameters.k8sVersion >>, "kindIpv6"]
327
name: Enable IPV6 and change DNS
329
cat \<<'EOF' | sudo tee /etc/docker/daemon.json
332
"fixed-cidr-v6": "2001:db8:1::/64",
337
sudo service docker restart
339
name: "Run E2E tests"
341
if [[ "<< parameters.k8sVersion >>" == "kindIpv6" ]]; then
343
export K8S_CLUSTER_TOOL=kind
344
export KUMA_DEFAULT_RETRIES=60
345
export KUMA_DEFAULT_TIMEOUT="6s"
347
if [[ "<< parameters.k8sVersion >>" != "kind"* ]]; then
348
export CI_K3S_VERSION=<< parameters.k8sVersion >>
349
export K3D_NETWORK_CNI=<< parameters.cniNetworkPlugin >>
351
if [[ "<< parameters.arch >>" == "arm64" ]]; then
352
export MAKE_PARAMETERS="-j1"
354
export MAKE_PARAMETERS="-j2"
357
if [[ "<< parameters.target >>" == "" ]]; then
358
export GINKGO_E2E_LABEL_FILTERS="job-$CIRCLE_NODE_INDEX"
361
if [[ "<< parameters.target >>" != "" ]]; then
362
target="test/e2e-<< parameters.target >>"
366
make ${MAKE_PARAMETERS} CI=true "${target}"
367
- store_test_results:
375
description: version of k3s to use or "kind" and "kindIpv6"
377
default: << pipeline.parameters.last_k8s_version >>
379
description: level of parallelization
383
description: makefile target without test/e2e prefix
387
description: The golang arch
391
description: The CNI networking plugin to use [flannel | calico]
395
name: vm-<< parameters.arch >>
396
parallelism: << parameters.parallelism >>
399
- install_build_tools:
400
go_arch: << parameters.arch >>
402
command: make dev/tools
404
name: "Download Go modules"
412
name: "Distributions"
414
make -j build/distributions
423
make dev/set-kuma-helm-repo
426
equal: [<< parameters.k8sVersion >>, "kindIpv6"]
429
name: Enable IPV6 and change DNS
431
cat \<<'EOF' | sudo tee /etc/docker/daemon.json
434
"fixed-cidr-v6": "2001:db8:1::/64",
439
sudo service docker restart
441
name: "Run E2E tests"
443
if [[ "<< parameters.k8sVersion >>" == "kindIpv6" ]]; then
445
export K8S_CLUSTER_TOOL=kind
446
export KUMA_DEFAULT_RETRIES=60
447
export KUMA_DEFAULT_TIMEOUT="6s"
449
if [[ "<< parameters.k8sVersion >>" != "kind"* ]]; then
450
export CI_K3S_VERSION=<< parameters.k8sVersion >>
451
export K3D_NETWORK_CNI=<< parameters.cniNetworkPlugin >>
453
if [[ "<< parameters.arch >>" == "arm64" ]]; then
454
export MAKE_PARAMETERS="-j1"
456
export MAKE_PARAMETERS="-j2"
459
if [[ "<< parameters.target >>" == "" ]]; then
460
export GINKGO_E2E_LABEL_FILTERS="job-$CIRCLE_NODE_INDEX"
463
if [[ "<< parameters.target >>" != "" ]]; then
464
target="test/e2e-<< parameters.target >>"
468
make ${MAKE_PARAMETERS} CI=true "${target}"
470
executor: vm-xlarge-amd64
475
sudo apt-get install -y qemu-user-static binfmt-support
476
- install_build_tools
478
- setenv_depending_on_priority:
479
label: "ci/run-full-matrix"
480
env: ENABLED_GOARCHES="arm64 amd64" ENABLED_GOOSES="linux darwin"
483
- build_go.mod_{{ checksum "go.sum" }}_{{ checksum "mk/dependencies/deps.lock" }}_{{ checksum ".circleci/config.yml" }}
485
command: make dev/tools
493
command: make -j build/distributions
495
command: make -j images
497
command: make -j docker/save
499
key: build_go.mod_{{ checksum "go.sum" }}_{{ checksum "mk/dependencies/deps.lock" }}_{{ checksum ".circleci/config.yml" }}
501
- "/home/circleci/go/pkg/mod"
502
- "/home/circleci/.kuma-dev"
503
- persist_to_workspace:
508
- artifacts-linux-amd64
509
- artifacts-linux-arm64
515
- install_build_tools
517
- setenv_depending_on_priority:
518
label: ci/force-publish
520
- setenv_depending_on_priority:
521
label: ci/run-full-matrix
522
env: ENABLED_GOARCHES="arm64 amd64" ENABLED_GOOSES="linux darwin"
526
- vm-amd64_go.mod_{{ checksum "go.sum" }}_{{ checksum "mk/dependencies/deps.lock" }}_{{ checksum ".circleci/config.yml" }}
530
name: inspect created tars
531
command: for i in build/distributions/out/*.tar.gz; do echo $i; tar -tvf $i; done
533
name: Publish distributions to Pulp
534
command: make publish/pulp
537
command: make docker/load
542
# ensure we always logout
553
- halt_job_if_labeled:
554
label: "ci/skip-container-structure-test"
555
- halt_job_if_labeled:
556
label: "ci/skip-test"
557
- setenv_depending_on_priority:
558
label: "ci/run-full-matrix"
559
env: ENABLED_GOARCHES="arm64 amd64"
561
command: sudo apt-get update; sudo apt-get install -y qemu-user-static binfmt-support
563
key: vm-amd64_go.mod_{{ checksum "go.sum" }}_{{ checksum "mk/dependencies/deps.lock" }}_{{ checksum ".circleci/config.yml" }}
567
command: make test/container-structure
575
name: go_cache-<< matrix.arch >>
583
name: test-<< matrix.arch >>
588
requires: [build, go_cache-<< matrix.arch >>]
590
name: legacy-k8s:<< matrix.arch >>-<< matrix.k8sVersion >>
594
k8sVersion: [<< pipeline.parameters.first_k8s_version >>, << pipeline.parameters.last_k8s_version >>, kind, kindIpv6]
598
requires: [build, go_cache-<< matrix.arch >>]
600
name: << matrix.target >>:<< matrix.arch >>-<< matrix.k8sVersion >>
604
k8sVersion: [<< pipeline.parameters.first_k8s_version >>, << pipeline.parameters.last_k8s_version >>, kind, kindIpv6]
605
target: [kubernetes, universal, multizone]
607
requires: [build, go_cache-<< matrix.arch >>]
609
name: << matrix.target >>:<< matrix.arch >>-<< matrix.k8sVersion >>-calico
613
k8sVersion: [<< pipeline.parameters.last_k8s_version >>]
616
cniNetworkPlugin: [calico]
617
requires: [build, go_cache-amd64]
618
- container-structure:
619
name: container-structure
622
requires: [test, container-structure]
626
equal: ["", << pipeline.parameters.gh_action_build_artifact_name >>]
632
k8sVersion: << pipeline.parameters.e2e_param_k8sVersion >>
633
target: << pipeline.parameters.e2e_param_target >>
634
arch: << pipeline.parameters.e2e_param_arch >>
635
cniNetworkPlugin: << pipeline.parameters.e2e_param_cniNetworkPlugin >>
636
parallelism: << pipeline.parameters.e2e_param_parallelism >>