@@ -110,6 +110,7 @@ jobs:
110110 min_k8s_version : ${{ steps.vars.outputs.min_k8s_version }}
111111 k8s_latest : ${{ steps.vars.outputs.k8s_latest }}
112112 helm_changes : ${{ steps.filter.outputs.charts }}
113+ operator_changes : ${{ steps.filter.outputs.operator }}
113114 steps :
114115 - name : Checkout Repository
115116 uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
@@ -145,6 +146,9 @@ jobs:
145146 filters : |
146147 charts:
147148 - charts/nginx-gateway-fabric/**/*
149+ operator:
150+ - operators/**/*
151+ - charts/nginx-gateway-fabric/**/*
148152
149153 - name : Output Variables
150154 id : vars
@@ -405,7 +409,9 @@ jobs:
405409 matrix :
406410 image : [ngf, nginx]
407411 platforms : ["linux/arm64, linux/amd64"]
408- build-os : ["", ubi]
412+ # On PRs: only standard OS (2 jobs)
413+ # On main/release: include ubi (4 jobs)
414+ build-os : ${{ github.event_name == 'pull_request' && fromJSON('[""]') || fromJSON('["", "ubi"]') }}
409415 uses : ./.github/workflows/build.yml
410416 with :
411417 image : ${{ matrix.image }}
@@ -428,7 +434,9 @@ jobs:
428434 strategy :
429435 fail-fast : false
430436 matrix :
431- build-os : ["", ubi]
437+ # On PRs: only standard OS (1 job)
438+ # On main/release: include ubi (2 jobs)
439+ build-os : ${{ github.event_name == 'pull_request' && fromJSON('[""]') || fromJSON('["", "ubi"]') }}
432440 with :
433441 image : plus
434442 platforms : " linux/arm64, linux/amd64"
@@ -459,20 +467,19 @@ jobs:
459467 packages : write # for docker/build-push-action to push to GHCR
460468 id-token : write # for docker/login to login to NGINX registry
461469 secrets : inherit
470+ if : ${{ needs.vars.outputs.operator_changes == 'true' || github.event_name == 'push' || github.event_name == 'schedule' || inputs.is_production_release }}
462471
463472 functional-tests :
464473 name : Functional tests
465474 needs : [vars, build-oss, build-plus]
466475 strategy :
467476 fail-fast : false
468477 matrix :
469- image : [nginx, plus]
470- build-os : ["", ubi]
471- k8s-version :
472- [
473- " ${{ needs.vars.outputs.min_k8s_version }}" ,
474- " ${{ needs.vars.outputs.k8s_latest }}" ,
475- ]
478+ # On PRs: run nginx + plus with latest k8s only (2 jobs)
479+ # On main/release: run full matrix (8 jobs)
480+ image : ${{ github.event_name == 'pull_request' && fromJSON('["nginx", "plus"]') || fromJSON('["nginx", "plus"]') }}
481+ build-os : ${{ github.event_name == 'pull_request' && fromJSON('[""]') || fromJSON('["", "ubi"]') }}
482+ k8s-version : ${{ github.event_name == 'pull_request' && fromJSON(format('["{0}"]', needs.vars.outputs.k8s_latest)) || fromJSON(format('["{0}", "{1}"]', needs.vars.outputs.min_k8s_version, needs.vars.outputs.k8s_latest)) }}
476483 uses : ./.github/workflows/functional.yml
477484 with :
478485 image : ${{ matrix.image }}
@@ -488,14 +495,12 @@ jobs:
488495 strategy :
489496 fail-fast : false
490497 matrix :
491- image : [nginx, plus]
492- build-os : ["", ubi]
493- k8s-version :
494- [
495- " ${{ needs.vars.outputs.min_k8s_version }}" ,
496- " ${{ needs.vars.outputs.k8s_latest }}" ,
497- ]
498- enable-experimental : [true, false]
498+ # On PRs: run nginx only, latest k8s, experimental enabled (1 job - most coverage)
499+ # On main/release: run full matrix (16 jobs)
500+ image : ${{ github.event_name == 'pull_request' && fromJSON('["nginx"]') || fromJSON('["nginx", "plus"]') }}
501+ build-os : ${{ github.event_name == 'pull_request' && fromJSON('[""]') || fromJSON('["", "ubi"]') }}
502+ k8s-version : ${{ github.event_name == 'pull_request' && fromJSON(format('["{0}"]', needs.vars.outputs.k8s_latest)) || fromJSON(format('["{0}", "{1}"]', needs.vars.outputs.min_k8s_version, needs.vars.outputs.k8s_latest)) }}
503+ enable-experimental : ${{ github.event_name == 'pull_request' && fromJSON('[true]') || fromJSON('[true, false]') }}
499504 uses : ./.github/workflows/conformance.yml
500505 with :
501506 image : ${{ matrix.image }}
0 commit comments