44 push :
55 branches :
66 - main
7- tags :
8- - " v[0-9]+.[0-9]+.[0-9]+"
97 pull_request :
108 branches :
119 - main
@@ -21,13 +19,38 @@ permissions:
2119 contents : read
2220
2321jobs :
22+ variables :
23+ name : Set Variables
24+ runs-on : ubuntu-24.04
25+ outputs :
26+ runner : ${{ steps.vars.outputs.runner }}
27+ version : ${{ steps.vars.outputs.version }}
28+ chart_version : ${{ steps.vars.outputs.chart_version }}
29+ openshift_version : ${{ steps.vars.outputs.openshift_version }}
30+ steps :
31+ - name : Checkout Repository
32+ uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
33+
34+ - name : Output Variables
35+ id : vars
36+ run : |
37+ runner=ubuntu-24.04
38+ if [ "${{ github.event_name }}" == "push" ]; then
39+ runner=ubuntu-24.04-amd64
40+ fi
41+ echo "runner=$runner" >> $GITHUB_OUTPUT
42+ echo "version=$(git describe --tags)" >> $GITHUB_OUTPUT
43+ echo "chart_version=$(yq '.appVersion' <helm-charts/nginx-ingress/Chart.yaml)" >> $GITHUB_OUTPUT
44+ echo "openshift_version=$(yq '.annotations["com.redhat.openshift.versions"]' <bundle/metadata/annotations.yaml | cut -dv -f2)" >> $GITHUB_OUTPUT
45+
2446 build :
2547 name : Build Image
26- runs-on : ubuntu-24.04
48+ runs-on : ${{ needs.variables.outputs.runner }}
49+ needs : [variables]
2750 outputs :
2851 version : ${{ steps.meta.outputs.version }}
2952 permissions :
30- contents : write # for lucacome/draft-release to create a draft release
53+ contents : read
3154 security-events : write # for github/codeql-action/upload-sarif to upload SARIF results
3255 packages : write # for docker/build-push-action to push to GHCR
3356 steps :
6689 - name : Docker Buildx
6790 uses : docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
6891
69- - name : Output Variables
70- id : vars
71- run : |
72- echo "version=$(git describe --tags)" >> $GITHUB_OUTPUT
73- echo "chart_version=$(yq '.appVersion' <helm-charts/nginx-ingress/Chart.yaml)" >> $GITHUB_OUTPUT
74- echo "openshift_version=$(yq '.annotations["com.redhat.openshift.versions"]' <bundle/metadata/annotations.yaml | cut -dv -f2)" >> $GITHUB_OUTPUT
75-
7692 - name : Docker meta
7793 id : meta
7894 uses : docker/metadata-action@c1e51972afc2121e065aed6d45c65596fe445f3f # v5.8.0
@@ -84,14 +100,13 @@ jobs:
84100 tags : |
85101 type=edge
86102 type=ref,event=pr
87- type=semver,pattern={{version}}
88103 labels : |
89104 org.opencontainers.image.documentation=https://docs.nginx.com/nginx-ingress-controller
90105 org.opencontainers.image.vendor=NGINX Inc <[email protected] > 91106 name="NGINX Ingress Operator"
9210793108 vendor="NGINX Inc"
94- version=${{ steps.vars .outputs.version }}
109+ version=${{ needs.variables .outputs.version }}
95110 release=1
96111 summary="The NGINX Ingress Operator is a Kubernetes/OpenShift component which deploys and manages one or more NGINX/NGINX Plus Ingress Controllers"
97112 description="The NGINX Ingress Operator is a Kubernetes/OpenShift component which deploys and manages one or more NGINX/NGINX Plus Ingress Controllers"
@@ -120,30 +135,32 @@ jobs:
120135 format : " sarif"
121136 output : " trivy-results.sarif"
122137 ignore-unfixed : " true"
138+ if : github.event_name != 'pull_request'
123139
124140 - name : Upload Trivy scan results to GitHub Security tab
125141 uses : github/codeql-action/upload-sarif@64d10c13136e1c5bce3e5fbde8d4906eeaafc885 # v3.30.6
126142 continue-on-error : true
127143 with :
128144 sarif_file : " trivy-results.sarif"
145+ if : github.event_name != 'pull_request'
129146
130147 - name : Upload Scan Results
131148 uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
132149 continue-on-error : true
133150 with :
134151 name : " trivy-results.sarif"
135152 path : " trivy-results.sarif"
136- if : always()
153+ if : github.event_name != 'pull_request'
137154
138155 - name : Create/Update Draft
139156 uses : lucacome/draft-release@fd099feb33710d1fa27b915a08a7acd6a1fb7fd2 # v2.0.0
140157 with :
141158 minor-label : " enhancement"
142159 major-label : " change"
143- publish : ${{ github.ref_type == 'tag' }}
160+ publish : false
144161 variables : |
145- nic_version=${{ steps.vars .outputs.chart_version }}
146- openshift_version=${{ steps.vars .outputs.openshift_version }}
162+ nic_version=${{ needs.variables .outputs.chart_version }}
163+ openshift_version=${{ needs.variables .outputs.openshift_version }}
147164 notes-footer : |
148165 ## Compatibility
149166
@@ -156,65 +173,4 @@ jobs:
156173 uses : ./.github/workflows/e2e-test.yml
157174 needs : build
158175 with :
159- operator_version : ${{ github.ref_type == 'tag' && needs.build.outputs.version || 'edge' }}
160-
161- certify :
162- name : Certify for Red Hat OpenShift
163- runs-on : ubuntu-24.04
164- needs : [build, e2e-test]
165- if : ${{ github.ref_type == 'tag' }}
166- env :
167- preflight_version : 1.14.1 # renovate: datasource=github-releases depName=preflight packageName=redhat-openshift-ecosystem/openshift-preflight
168- steps :
169- - name : Checkout Repository
170- uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
171-
172- - name : Certify Images
173- continue-on-error : false
174- run : |
175- curl -fsSL https://github.com/redhat-openshift-ecosystem/openshift-preflight/releases/download/${{ env.preflight_version }}/preflight-linux-amd64 --output preflight
176- chmod +x preflight
177-
178- IFS=',' read -ra arch_list <<< "${{ env.platforms }}"
179-
180- for arch in "${arch_list[@]}"; do
181- architecture=("${arch#*/}")
182- ./preflight check container quay.io/nginx/nginx-ingress-operator:${{ needs.build.outputs.version }} --pyxis-api-token ${{ secrets.PYXIS_API_TOKEN }} --certification-project-id ${{ secrets.CERTIFICATION_PROJECT_ID }} --platform $architecture --submit
183- done
184-
185- # # Disable PR creation until issues with NGINX_PAT are resolved
186- # - name: Make
187- # run: |
188- # make bundle USE_IMAGE_DIGESTS=true
189-
190- # - name: Checkout certified-operators repo
191- # uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
192- # with:
193- # token: ${{ secrets.NGINX_PAT }}
194- # repository: nginx-bot/certified-operators
195- # path: certified-operators
196-
197- # - name: Update certified-operators repo
198- # working-directory: certified-operators/operators/nginx-ingress-operator
199- # run: |
200- # mkdir v${{ needs.build.outputs.version }}
201- # cp -R ../../../bundle/manifests v${{ needs.build.outputs.version }}/
202- # cp -R ../../../bundle/metadata v${{ needs.build.outputs.version }}/
203-
204- # - name: Commit changes
205- # uses: stefanzweifel/git-auto-commit-action@b863ae1933cb653a53c021fe36dbb774e1fb9403 # v5.2.0
206- # with:
207- # commit_message: operator nginx-ingress-operator (v${{ needs.build.outputs.version }})
208- # commit_author: nginx-bot <[email protected] > 209- # commit_user_name: nginx-bot
210- # commit_user_email: [email protected] 211- # create_branch: true
212- # branch: update-nginx-ingress-operator-to-v${{ needs.build.outputs.version }}
213- # repository: certified-operators
214-
215- # - name: Create PR
216- # working-directory: certified-operators
217- # run: |
218- # gh pr create --title "operator nginx-ingress-operator (v${{ needs.build.outputs.version }})" --body "Update nginx-ingress-operator to v${{ needs.build.outputs.version }}" --head nginx-bot:update-nginx-ingress-operator-to-v${{ needs.build.outputs.version }} --base main --repo redhat-openshift-ecosystem/certified-operators
219- # env:
220- # GITHUB_TOKEN: ${{ secrets.NGINX_PAT }}
176+ operator_version : ${{ needs.build.outputs.version }}
0 commit comments