@@ -228,6 +228,41 @@ jobs:
228
228
- run : make e2e-build
229
229
working-directory : ${{ env.E2E_DIR }}
230
230
231
+ netpol-path-filter :
232
+ name : Network Policy Path Filter
233
+ if : github.event_name != 'pull_request'
234
+ runs-on : ubuntu-22.04
235
+ outputs :
236
+ test-netpol : ${{ steps.filter.outputs.kube-ovn-controller }}
237
+ steps :
238
+ - uses : actions/checkout@v3
239
+ - uses : actions/setup-go@v3
240
+ with :
241
+ go-version-file : go.mod
242
+ check-latest : true
243
+
244
+ - name : Generate path filter
245
+ run : |
246
+ filter=".github/path-filters.yaml"
247
+ workflow=$(echo ${{ github.workflow_ref }} | awk -F@ '{print $1}' | sed 's@^${{ github.repository }}/@@')
248
+ cat > $filter <<EOF
249
+ kube-ovn-controller:
250
+ - $workflow
251
+ - go.mod
252
+ - go.sum
253
+ EOF
254
+ module=$(grep ^module go.mod | awk '{print $2}')
255
+ go list -f '{{ join .Deps "\n" }}' pkg/controller | grep ^$module/ | while read pkg; do
256
+ echo "- ${pkg#${module}/}/*" >> $filter
257
+ done
258
+
259
+ - uses : dorny/paths-filter@v2
260
+ id : filter
261
+ with :
262
+ base : ${{ github.base_ref || github.ref_name }}
263
+ filters : .github/path-filters.yaml
264
+ list-files : csv
265
+
231
266
k8s-conformance-e2e :
232
267
name : Kubernetes Conformance E2E
233
268
needs :
@@ -328,10 +363,13 @@ jobs:
328
363
329
364
k8s-netpol-e2e :
330
365
name : Kubernetes Network Policy E2E
331
- if : github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'network policy')
366
+ if : |
367
+ always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') &&
368
+ (needs.netpol-path-filter.outputs.test-netpol == 1 || contains(github.event.pull_request.labels.*.name, 'network policy'))
332
369
needs :
333
370
- build-kube-ovn
334
371
- build-e2e-binaries
372
+ - netpol-path-filter
335
373
runs-on : ubuntu-22.04
336
374
timeout-minutes : 60
337
375
strategy :
@@ -420,10 +458,13 @@ jobs:
420
458
421
459
k8s-netpol-legacy-e2e :
422
460
name : Kubernetes Network Policy Legacy E2E
423
- if : github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'network policy')
461
+ if : |
462
+ always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') &&
463
+ (needs.netpol-path-filter.outputs.test-netpol == 1 || contains(github.event.pull_request.labels.*.name, 'network policy'))
424
464
needs :
425
465
- build-kube-ovn
426
466
- build-e2e-binaries
467
+ - netpol-path-filter
427
468
runs-on : ubuntu-22.04
428
469
timeout-minutes : 60
429
470
strategy :
@@ -512,8 +553,12 @@ jobs:
512
553
513
554
cyclonus-netpol-e2e :
514
555
name : Cyclonus Network Policy E2E
515
- if : github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'network policy')
516
- needs : build-kube-ovn
556
+ if : |
557
+ always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') &&
558
+ (needs.netpol-path-filter.outputs.test-netpol == 1 || contains(github.event.pull_request.labels.*.name, 'network policy'))
559
+ needs :
560
+ - build-kube-ovn
561
+ - netpol-path-filter
517
562
runs-on : ubuntu-22.04
518
563
timeout-minutes : 30
519
564
strategy :
0 commit comments