-
Notifications
You must be signed in to change notification settings - Fork 593
181 lines (149 loc) · 5.68 KB
/
kind-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
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
name: KinD e2e tests
on:
pull_request:
branches: [ 'main', 'master' ]
defaults:
run:
shell: bash
jobs:
e2e-tests:
name: e2e tests
runs-on: ubuntu-latest
strategy:
fail-fast: false # Keep running if one leg fails.
matrix:
k8s-version:
- v1.26.6
- v1.27.3
test-suite:
- ./test/rekt/...
- ./test/e2e
- ./test/conformance
- ./test/experimental
- ./test/auth
# Map between K8s and KinD versions.
# This is attempting to make it a bit clearer what's being tested.
# See: https://github.com/kubernetes-sigs/kind/releases/tag/v0.20.0
include:
- k8s-version: v1.26.6
kind-version: v0.20.0
kind-image-sha: sha256:6e2d8b28a5b601defe327b98bd1c2d1930b49e5d8c512e1895099e4504007adb
- k8s-version: v1.27.3
kind-version: v0.20.0
kind-image-sha: sha256:3966ac761ae0136263ffdb6cfd4db23ef8a83cba8a463690e98317add2c9ba72
# Add the flags we use for each of these test suites.
- test-suite: ./test/e2e
extra-test-flags: >
-channels=messaging.knative.dev/v1:Channel,messaging.knative.dev/v1:InMemoryChannel
-sources=sources.knative.dev/v1:ApiServerSource,sources.knative.dev/v1:ContainerSource,sources.knative.dev/v1beta2:PingSource
- test-suite: ./test/conformance
extra-test-flags: >
-brokers=eventing.knative.dev/v1:MTChannelBasedBroker
-channels=messaging.knative.dev/v1:Channel,messaging.knative.dev/v1:InMemoryChannel
-sources=sources.knative.dev/v1:ApiServerSource,sources.knative.dev/v1:ContainerSource,sources.knative.dev/v1beta2:PingSource
env:
KO_DOCKER_REPO: kind.local
SYSTEM_NAMESPACE: knative-eventing
# Use a semi-random cluster suffix, but somewhat predictable
# so reruns don't just give us a completely new value.
CLUSTER_SUFFIX: c${{ github.run_id }}.local
ARTIFACTS: ${{ github.workspace }}/artifacts
NODE_VERSION: ${{ matrix.k8s-version }}
NODE_SHA: ${{ matrix.kind-image-sha }}
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.20.x
# Install the latest release of ko
- name: Install ko
uses: ko-build/setup-ko@v0.6
- name: Check out code onto GOPATH
uses: actions/checkout@v2
- name: Install KinD
run: |
set -x
# Disable swap otherwise memory enforcement doesn't work
# See: https://kubernetes.slack.com/archives/CEKK1KTN2/p1600009955324200
sudo swapoff -a
sudo rm -f /swapfile
curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${{ matrix.kind-version }}/kind-$(uname)-amd64
chmod +x ./kind
sudo mv kind /usr/local/bin
- name: Create KinD Cluster
run: ./hack/create-kind-cluster.sh
- name: Install Knative Eventing
run: |
set -o pipefail
kubectl create namespace ${SYSTEM_NAMESPACE}
export KO_FLAGS="--platform=linux/amd64"
source ./test/e2e-common.sh
knative_setup
# Be KinD to these tests.
kubectl scale -n${SYSTEM_NAMESPACE} deployment/chaosduck --replicas=0
- name: Test Setup
run: |
source ./test/e2e-common.sh
test_setup
- name: Apply experimental features config
if: matrix.test-suite == './test/experimental'
run: |
kubectl apply -f ./test/experimental/config
- name: Apply auth features config
if: matrix.test-suite == './test/auth'
run: |
kubectl apply -f ./test/auth/config
- name: Wait for things to be up
run: |
set -e
source ./vendor/knative.dev/hack/infra-library.sh
wait_until_pods_running ${SYSTEM_NAMESPACE}
- name: Run e2e Tests
run: |
export CLUSTER_DOMAIN=${CLUSTER_SUFFIX}
# Run the tests tagged as e2e on the KinD cluster.
go test -race -count=1 -parallel=12 -timeout=50m -tags=e2e \
${{ matrix.test-suite }} ${{ matrix.extra-test-flags }}
- name: Collect system diagnostics
if: ${{ failure() }}
run: |
echo '::group:: all pods'
kubectl get pods --all-namespaces=true
echo '::endgroup::'
echo '::group:: describe system pods'
kubectl -n${SYSTEM_NAMESPACE} describe pods
echo '::endgroup::'
for x in $(kubectl get pods -n${SYSTEM_NAMESPACE} -oname); do
echo "::group:: describe system $x"
kubectl -n${SYSTEM_NAMESPACE} describe $x
echo '::endgroup::'
echo "::group:: $x system logs"
kubectl -n${SYSTEM_NAMESPACE} logs $x --all-containers
echo '::endgroup::'
done
echo "::group:: all events"
kubectl get events --all-namespaces=true
echo '::endgroup::'
- name: Dump Artifacts
if: ${{ failure() }}
run: |
if [[ -d ${{ env.ARTIFACTS }} ]]; then
cd ${{ env.ARTIFACTS }}
for x in $(find . -type f); do
echo "::group:: artifact $x"
cat $x
echo '::endgroup::'
done
fi
- name: Post failure notice to Slack
uses: rtCamp/action-slack-notify@v2.1.0
if: ${{ failure() && github.event_name != 'pull_request' }}
env:
SLACK_ICON: http://github.com/knative.png?size=48
SLACK_USERNAME: github-actions
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_CHANNEL: 'eventing'
MSG_MINIMAL: 'true'
SLACK_TITLE: Periodic e2e on kind on ${{ matrix.k8s-version }} failed.
SLACK_MESSAGE: |
For detailed logs: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}