-
Notifications
You must be signed in to change notification settings - Fork 5
176 lines (161 loc) · 5.2 KB
/
e2e-test.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
name: Run E2E Kind Test
env:
CI_IMAGE_REPO: ghcr.io/spidernet-io/cni-plugins/meta-plugins
on:
schedule:
# each day
- cron: "0 20 * * *"
push:
branches:
- main
- v*
pull_request_target:
types:
- opened
- synchronize
- reopened
jobs:
get_ref:
runs-on: ubuntu-latest
outputs:
ref: ${{ steps.result.outputs.ref }}
run_e2e: ${{ steps.get_ref.outputs.run_e2e }}
steps:
- name: Check Code Changes
uses: dorny/[email protected]
if: ${{ github.event_name == 'pull_request_target' }}
id: filter_pr
with:
base: ${{ github.event.pull_request.base.sha }}
ref: ${{ github.event.pull_request.head.sha }}
filters: |
run_e2e:
- '**/*.sh'
- '**/*.go'
- 'go.mod'
- 'test/*'
- 'go.sum'
- 'Makefile*'
- '**/Makefile*'
- name: Get Ref
id: get_ref
run: |
if ${{ github.event_name == 'push' }} ; then
echo "trigger by push"
echo ::set-output name=tag::${{ github.sha }}
echo ::set-output name=push::false
echo ::set-output name=run_e2e::true
elif ${{ github.event_name == 'pull_request_target' }} ; then
echo "trigger by pull_request_target"
echo ::set-output name=tag::${{ github.event.pull_request.head.sha }}
echo ::set-output name=push::false
if ${{ steps.filter_pr.outputs.run_e2e == 'true' }} ; then
# run all e2e
echo ::set-output name=run_e2e::true
fi
else
# schedule event
# use main sha for e2e image tag
echo "trigger by schedule"
echo ::set-output name=tag::main
echo ::set-output name=push::false
# nightly ci, run all e2e
echo ::set-output name=run_e2e::true
fi
- name: Checkout code
uses: actions/checkout@v3
with:
persist-credentials: false
ref: ${{ steps.get_ref.outputs.tag }}
- name: Result Ref
id: result
run: |
git_ref=$( git show -s --format='format:%H')
echo "ref=${git_ref}" >> $GITHUB_OUTPUT
call_build_e2e_image:
needs: [get_ref]
if: ${{ needs.get_ref.outputs.run_e2e == 'true' }}
uses: ./.github/workflows/image-build.yaml
with:
ref: ${{ needs.get_ref.outputs.ref }}
push: false
secrets: inherit
call_e2e_dual_calico:
needs: [get_ref,call_build_e2e_image]
if: ${{ needs.get_ref.outputs.run_e2e == 'true' }}
uses: ./.github/workflows/e2e-init.yaml
with:
ip_family: dual
default_cni: k8s-pod-network
push: false
ref: ${{ needs.get_ref.outputs.ref }}
secrets: inherit
call_e2e_ipv4_calico:
needs: [get_ref,call_build_e2e_image]
if: ${{ needs.get_ref.outputs.run_e2e == 'true' }}
uses: ./.github/workflows/e2e-init.yaml
with:
ip_family: ipv4
default_cni: k8s-pod-network
push: false
ref: ${{ needs.get_ref.outputs.ref }}
secrets: inherit
call_e2e_ipv6_calico:
needs: [get_ref,call_build_e2e_image]
if: ${{ needs.get_ref.outputs.run_e2e == 'true' }}
uses: ./.github/workflows/e2e-init.yaml
with:
ip_family: ipv6
default_cni: k8s-pod-network
push: false
ref: ${{ needs.get_ref.outputs.ref }}
secrets: inherit
call_e2e_dual_cilium:
needs: [get_ref,call_build_e2e_image]
if: ${{ needs.get_ref.outputs.run_e2e == 'true' }}
uses: ./.github/workflows/e2e-init.yaml
with:
ip_family: dual
default_cni: cilium
push: false
ref: ${{ needs.get_ref.outputs.ref }}
secrets: inherit
call_e2e_ipv4_cilium:
needs: [get_ref,call_build_e2e_image]
if: ${{ needs.get_ref.outputs.run_e2e == 'true' }}
uses: ./.github/workflows/e2e-init.yaml
with:
ip_family: ipv4
default_cni: cilium
push: false
ref: ${{ needs.get_ref.outputs.ref }}
secrets: inherit
call_e2e_ipv6_cilium:
needs: [get_ref,call_build_e2e_image]
if: ${{ needs.get_ref.outputs.run_e2e == 'true' }}
uses: ./.github/workflows/e2e-init.yaml
with:
ip_family: ipv6
default_cni: cilium
push: false
ref: ${{ needs.get_ref.outputs.ref }}
secrets: inherit
create_e2e_issue:
needs: [call_e2e_dual_calico,call_e2e_ipv4_calico,call_e2e_ipv6_calico,call_e2e_dual_cilium,call_e2e_ipv4_cilium,call_e2e_ipv6_cilium]
runs-on: ubuntu-latest
if: github.event_name == 'schedule' && always() && !cancelled() && contains(needs.*.result, 'failure')
steps:
- name: echo
run: |
echo ${{ github.repository }}
echo ${{ github.repository_owner }}
echo "TIMESTAMP=`date +%Y-%m-%d`" >> $GITHUB_ENV
- name: create an issue
uses: dacbd/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
title: "Auto E2E CI ${{ ENV.TIMESTAMP }}: Failed(Auto Create)"
body: |
action url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
labels: "kind/bug"
assignees: "cyclinder"