@@ -16,9 +16,8 @@ name: K8S E2E Suite
16
16
17
17
on :
18
18
workflow_dispatch :
19
+ workflow_call :
19
20
pull_request :
20
- issue_comment :
21
- types : [created]
22
21
merge_group :
23
22
types : [checks_requested]
24
23
schedule :
27
26
28
27
concurrency :
29
28
group : ${{ github.workflow }}-${{ github.event.number || github.event.comment.html_url || github.event.merge_group.head_sha || github.event.schedule || github.sha }}
30
-
31
29
cancel-in-progress : true
32
30
33
31
env :
42
40
PROFILE : debug
43
41
44
42
jobs :
45
- validate :
46
- name : Validate comment
47
- runs-on : ubuntu-latest
48
- if : |
49
- github.event_name != 'issue_comment' ||
50
- ( github.event.issue.pull_request &&
51
- ( contains(github.event.comment.body, '/ci-run-all') ||
52
- contains(github.event.comment.body, '/ci-run-k8s')
53
- )
54
- )
55
- steps :
56
- - name : Get PR comment author
57
- id : comment
58
- uses : tspascoal/get-user-teams-membership@v2
59
- with :
60
- username : ${{ github.actor }}
61
- team : ' Vector'
62
- GITHUB_TOKEN : ${{ secrets.GH_PAT_ORG }}
63
-
64
- - name : Validate author membership
65
- if : steps.comment.outputs.isTeamMember == 'false'
66
- run : exit 1
67
-
68
43
changes :
69
- needs : validate
44
+ # Only evaluate files changed on pull request trigger
45
+ if : github.event_name == 'pull_request'
70
46
uses : ./.github/workflows/changes.yml
71
47
with :
72
48
base_ref : ${{ github.event.pull_request.base.ref }}
76
52
build-x86_64-unknown-linux-gnu :
77
53
name : Build - x86_64-unknown-linux-gnu
78
54
runs-on : [linux, ubuntu-20.04-4core]
79
- needs : [changes, validate]
80
- if : github.event_name != 'pull_request' || needs.changes.outputs.k8s == 'true'
55
+ needs : changes
56
+ # Run this job even if `changes` job is skipped (non- pull request trigger)
57
+ if : ${{ !failure() && !cancelled() && (github.event_name != 'pull_request' || needs.changes.outputs.k8s == 'true') }}
81
58
# cargo-deb requires a release build, but we don't need optimizations for tests
82
59
env :
83
60
CARGO_PROFILE_RELEASE_OPT_LEVEL : 0
@@ -141,8 +118,9 @@ jobs:
141
118
compute-k8s-test-plan :
142
119
name : Compute K8s test plan
143
120
runs-on : ubuntu-latest
144
- needs : [changes, validate]
145
- if : github.event_name != 'pull_request' || needs.changes.outputs.k8s == 'true'
121
+ needs : changes
122
+ # Run this job even if `changes` job is skipped
123
+ if : ${{ !failure() && !cancelled() && (github.event_name != 'pull_request' || needs.changes.outputs.k8s == 'true') }}
146
124
outputs :
147
125
matrix : ${{ steps.set-matrix.outputs.matrix }}
148
126
steps :
@@ -195,9 +173,10 @@ jobs:
195
173
name : K8s ${{ matrix.kubernetes_version.version }} / ${{ matrix.container_runtime }} (${{ matrix.kubernetes_version.role }})
196
174
runs-on : [linux, ubuntu-20.04-4core]
197
175
needs :
198
- - validate
199
176
- build-x86_64-unknown-linux-gnu
200
177
- compute-k8s-test-plan
178
+ # because `changes` job might be skipped
179
+ if : always() && needs.build-x86_64-unknown-linux-gnu.result == 'success' && needs.compute-k8s-test-plan.result == 'success'
201
180
strategy :
202
181
matrix : ${{ fromJson(needs.compute-k8s-test-plan.outputs.matrix) }}
203
182
fail-fast : false
@@ -246,20 +225,18 @@ jobs:
246
225
final-result :
247
226
name : K8s E2E Suite
248
227
runs-on : ubuntu-latest
249
- needs : [test-e2e-kubernetes, validate]
250
- if : |
251
- always() && (github.event_name != 'issue_comment' || (github.event.issue.pull_request
252
- && (contains(github.event.comment.body, '/ci-run-k8s') || contains(github.event.comment.body, '/ci-run-all'))))
228
+ needs : test-e2e-kubernetes
229
+ if : always()
253
230
env :
254
231
FAILED : ${{ contains(needs.*.result, 'failure') }}
255
232
steps :
256
233
- name : (PR comment) Get PR branch
257
- if : success() && github.event_name == 'issue_comment'
234
+ if : github.event_name == 'issue_comment' && env.FAILED != 'true '
258
235
uses : xt0rted/pull-request-comment-branch@v2
259
236
id : comment-branch
260
237
261
238
- name : (PR comment) Submit PR result as success
262
- if : success() && github.event_name == 'issue_comment'
239
+ if : github.event_name == 'issue_comment' && env.FAILED != 'true '
263
240
uses :
myrotvorets/[email protected]
264
241
with :
265
242
sha : ${{ steps.comment-branch.outputs.head_sha }}
0 commit comments