@@ -228,6 +228,39 @@ 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
+ cat > $filter <<EOF
248
+ kube-ovn-controller:
249
+ - go.mod
250
+ - go.sum
251
+ EOF
252
+ module=$(grep ^module go.mod | awk '{print $2}')
253
+ go list -f '{{ join .Deps "\n" }}' pkg/controller | grep ^$module/ | while read pkg; do
254
+ echo "- ${pkg#${module}/}/*" >> $filter
255
+ done
256
+
257
+ - uses : dorny/paths-filter@v2
258
+ id : filter
259
+ with :
260
+ base : ${{ github.base_ref || github.ref_name }}
261
+ filters : .github/path-filters.yaml
262
+ list-files : csv
263
+
231
264
k8s-conformance-e2e :
232
265
name : Kubernetes Conformance E2E
233
266
needs :
@@ -328,10 +361,13 @@ jobs:
328
361
329
362
k8s-netpol-e2e :
330
363
name : Kubernetes Network Policy E2E
331
- if : github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'network policy')
364
+ if : |
365
+ always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') &&
366
+ (needs.netpol-path-filter.outputs.test-netpol == 1 || contains(github.event.pull_request.labels.*.name, 'network policy'))
332
367
needs :
333
368
- build-kube-ovn
334
369
- build-e2e-binaries
370
+ - netpol-path-filter
335
371
runs-on : ubuntu-22.04
336
372
timeout-minutes : 60
337
373
strategy :
@@ -420,10 +456,13 @@ jobs:
420
456
421
457
k8s-netpol-legacy-e2e :
422
458
name : Kubernetes Network Policy Legacy E2E
423
- if : github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'network policy')
459
+ if : |
460
+ always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') &&
461
+ (needs.netpol-path-filter.outputs.test-netpol == 1 || contains(github.event.pull_request.labels.*.name, 'network policy'))
424
462
needs :
425
463
- build-kube-ovn
426
464
- build-e2e-binaries
465
+ - netpol-path-filter
427
466
runs-on : ubuntu-22.04
428
467
timeout-minutes : 60
429
468
strategy :
@@ -512,8 +551,12 @@ jobs:
512
551
513
552
cyclonus-netpol-e2e :
514
553
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
554
+ if : |
555
+ always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') &&
556
+ (needs.netpol-path-filter.outputs.test-netpol == 1 || contains(github.event.pull_request.labels.*.name, 'network policy'))
557
+ needs :
558
+ - build-kube-ovn
559
+ - netpol-path-filter
517
560
runs-on : ubuntu-22.04
518
561
timeout-minutes : 30
519
562
strategy :
0 commit comments