-
Notifications
You must be signed in to change notification settings - Fork 337
148 lines (143 loc) · 5.8 KB
/
_e2e.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
on:
workflow_call:
inputs:
matrix:
required: true
type: string
runner:
type: string
required: true
permissions:
contents: read
env:
CI_TOOLS_DIR: ${{ contains(inputs.runner, '-kong') && '/work/kuma/kuma/.ci_tools' || '/home/runner/work/kuma/kuma/.ci_tools' }}
E2E_PARAM_K8S_VERSION: ${{ fromJSON(inputs.matrix).k8sVersion }}
E2E_PARAM_CNI_NETWORK_PLUGIN: ${{ fromJSON(inputs.matrix).cniNetworkPlugin }}
E2E_PARAM_ARCH: ${{ fromJSON(inputs.matrix).arch }}
E2E_PARAM_SIDECAR_CONTAINERS: ${{ fromJSON(inputs.matrix).sidecarContainers }}
E2E_PARAM_TARGET: ${{ fromJSON(inputs.matrix).target }}
E2E_PARAM_PARALLELISM: ${{ fromJSON(inputs.matrix).parallelism }}
jobs:
e2e:
timeout-minutes: 60
# can't use env vars here
runs-on: ${{ inputs.runner }}
if: ${{ inputs.runner != '' }}
strategy:
fail-fast: false
matrix:
parallelRunnerId: ${{ fromJSON((fromJSON(inputs.matrix).parallelism == '4' && '[0, 1, 2, 3]') || '[0]') }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
with:
go-version-file: go.mod
- uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: |
${{ env.CI_TOOLS_DIR }}
key: ${{ runner.os }}-${{ runner.arch }}-devtools-${{ hashFiles('mk/dependencies/deps.lock') }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-devtools
- run: |
make dev/tools
- name: "Free up disk space for the Runner"
run: |
echo "Disk usage before cleanup"
sudo df -h
echo "Removing big directories"
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc
echo "Pruning images"
docker system prune --all -f
echo "Disk usage after cleanup"
sudo df -h
- run: |
make build
- run: |
make -j build/distributions
- uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0
id: retry
with:
max_attempts: 3
retry_wait_seconds: 15s
timeout_minutes: 30
command: make -j images && make -j docker/save
- run: |
make dev/set-kuma-helm-repo
- name: "Enable ipv6 for docker"
if: ${{ env.E2E_PARAM_K8S_VERSION == 'kindIpv6' }}
run: |
cat <<'EOF' | sudo tee /etc/docker/daemon.json
{
"ipv6": true,
"fixed-cidr-v6": "2001:db8:1::/64",
"dns-search": ["."]
}
EOF
sudo service docker restart
- name: "Run E2E tests"
env:
DOCKERHUB_PULL_CREDENTIAL: ${{ secrets.DOCKERHUB_PULL_CREDENTIAL }}
KUMA_DEBUG: ${{ runner.debug == '1' }}
run: |
if [[ "${{ env.E2E_PARAM_K8S_VERSION }}" == "kindIpv6" ]]; then
export IPV6=true
export K8S_CLUSTER_TOOL=kind
export KUMA_DEFAULT_RETRIES=60
export KUMA_DEFAULT_TIMEOUT="6s"
fi
if [[ "${{ env.E2E_PARAM_K8S_VERSION }}" != "kind"* ]]; then
export CI_K3S_VERSION=$E2E_PARAM_K8S_VERSION
export K3D_NETWORK_CNI=${{ env.E2E_PARAM_CNI_NETWORK_PLUGIN }}
fi
if [[ "${{ env.E2E_PARAM_ARCH }}" == "arm64" ]]; then
export MAKE_PARAMETERS="-j1"
else
export MAKE_PARAMETERS="-j2"
fi
if [[ "${{ env.E2E_PARAM_SIDECAR_CONTAINERS }}" != "" ]]; then
export KUMA_EXPERIMENTAL_SIDECAR_CONTAINERS=true
fi
if [[ "${{ env.E2E_PARAM_TARGET }}" == "" ]]; then
export GINKGO_E2E_LABEL_FILTERS="job-${{ matrix.parallelRunnerId }}"
fi
env
if [[ "${{ env.E2E_PARAM_TARGET }}" == "multizone" ]]; then
export KUMA_DEFAULT_RETRIES=60
fi
function on_exit()
{
docker logout docker.io
}
# we pull a few images during the E2E run, sometimes we get rate-limited by docker hub
# to prevent this, we support specifying a pull credential here
if [[ "$DOCKERHUB_PULL_CREDENTIAL" != "" ]]; then
DOCKER_USER=$(echo "$DOCKERHUB_PULL_CREDENTIAL" | cut -d ':' -f 1)
DOCKER_PWD=$(echo "$DOCKERHUB_PULL_CREDENTIAL" | cut -d ':' -f 2)
echo -n "$DOCKER_PWD" | docker login -u "$DOCKER_USER" --password-stdin
trap "on_exit" EXIT
fi
if [[ "${{ env.E2E_PARAM_TARGET }}" != "" ]]; then
target="test/e2e-${{ env.E2E_PARAM_TARGET }}"
else
target="test/e2e"
fi
make ${MAKE_PARAMETERS} CI=true "${target}"
- uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
if: always()
with:
name: e2e-debug-${{ env.E2E_PARAM_TARGET }}-${{ env.E2E_PARAM_ARCH }}-${{ env.E2E_PARAM_K8S_VERSION }}-${{ env.E2E_PARAM_CNI_NETWORK_PLUGIN }}-${{ env.E2E_PARAM_SIDECAR_CONTAINERS }}-${{ matrix.parallelRunnerId }}
if-no-files-found: ignore
path: |
/tmp/e2e-debug/
retention-days: ${{ github.event_name == 'pull_request' && 5 || 10 }}
- uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
if: always()
with:
name: e2e-reports-${{ env.E2E_PARAM_TARGET }}-${{ env.E2E_PARAM_ARCH }}-${{ env.E2E_PARAM_K8S_VERSION }}-${{ env.E2E_PARAM_CNI_NETWORK_PLUGIN }}-${{ env.E2E_PARAM_SIDECAR_CONTAINERS }}-${{ matrix.parallelRunnerId }}
if-no-files-found: ignore
path: |
build/reports
retention-days: ${{ github.event_name == 'pull_request' && 5 || 10 }}