1- name : Continuous Integration
1+ name : CI
22
33on :
44 push :
@@ -30,28 +30,9 @@ concurrency:
3030 cancel-in-progress : true
3131
3232jobs :
33-
34- vars :
35- name : Get variables
36- runs-on : ubuntu-20.04
37- outputs :
38- sha_short : ${{ steps.vars.outputs.sha }}
39- repo_name : ${{ steps.vars.outputs.repo }}
40- version : ${{ steps.vars.outputs.version }}
41- steps :
42- - name : Checkout Repository
43- uses : actions/checkout@v3
44- - name : Output Variables
45- id : vars
46- run : |
47- echo "::set-output name=sha::$(echo ${GITHUB_SHA} | cut -c1-7)"
48- echo "::set-output name=repo::$(echo ${GITHUB_REPOSITORY} | cut -d '/' -f 2)"
49- echo "::set-output name=version::$(echo ${GITHUB_REF} | cut -d '/' -f 2)"
50-
5133 build :
5234 name : Build Image
5335 runs-on : ubuntu-20.04
54- needs : vars
5536 steps :
5637 - name : Checkout Repository
5738 uses : actions/checkout@v3
@@ -70,37 +51,46 @@ jobs:
7051 username : ${{ github.repository_owner }}
7152 password : ${{ secrets.GITHUB_TOKEN }}
7253 if : github.event_name != 'pull_request'
54+ - name : Login to Quay.io
55+ uses : docker/login-action@v2
56+ with :
57+ registry : quay.io
58+ username : ${{ secrets.QUAY_USERNAME }}
59+ password : ${{ secrets.QUAY_ROBOT_TOKEN }}
60+ if : github.event_name != 'pull_request'
7361 - name : Setup QEMU
7462 uses : docker/setup-qemu-action@v2
7563 with :
7664 platforms : arm64,ppc64le,s390x
7765 if : github.event_name != 'pull_request'
7866 - name : Docker Buildx
7967 uses : docker/setup-buildx-action@v2
68+ - name : Output Variables
69+ id : vars
70+ run : |
71+ echo "version=$(git describe --tags)" >> $GITHUB_OUTPUT
8072 - name : Docker meta
8173 id : meta
8274 uses : docker/metadata-action@v4
8375 with :
8476 images : |
8577 nginx/nginx-ingress-operator
8678 ghcr.io/nginxinc/nginx-ingress-operator
79+ quay.io/nginx/nginx-ingress-operator
8780 tags : |
8881 type=edge
8982 type=ref,event=pr
9083 type=semver,pattern={{version}}
9184 labels : |
9285 org.opencontainers.image.documentation=https://docs.nginx.com/nginx-ingress-controller
9386 org.opencontainers.image.vendor=NGINX Inc <[email protected] > 94- - name : Output Variables
95- id : var
96- run : |
97- version=latest
98- if ${{ startsWith(github.ref, 'refs/tags/') }}; then
99- operator_version=v${{ needs.vars.outputs.version }}
100- else
101- operator_version=$version-${{ needs.vars.outputs.sha_short }}
102- fi
103- echo "::set-output name=version::$operator_version"
87+ name="NGINX Ingress Operator"
88+ 89+ vendor="NGINX Inc"
90+ version=${{ steps.vars.outputs.version }}
91+ release=1
92+ summary="The NGINX Ingress Operator is a Kubernetes/OpenShift component which deploys and manages one or more NGINX/NGINX Plus Ingress Controllers"
93+ description="The NGINX Ingress Operator is a Kubernetes/OpenShift component which deploys and manages one or more NGINX/NGINX Plus Ingress Controllers"
10494 - name : Build Image
10595 uses : docker/build-push-action@v3
10696 with :
@@ -112,9 +102,8 @@ jobs:
112102 platforms : ${{ github.event_name != 'pull_request' && env.platforms || '' }}
113103 load : ${{ github.event_name == 'pull_request' }}
114104 push : ${{ github.event_name != 'pull_request' }}
105+ no-cache : ${{ github.event_name != 'pull_request' }}
115106 pull : true
116- build-args : |
117- VERSION=${{ steps.var.outputs.version }}
118107 - name : Run Trivy vulnerability scanner
119108 uses :
aquasecurity/[email protected] 120109 continue-on-error : true
@@ -135,52 +124,3 @@ jobs:
135124 name : ' trivy-results.sarif'
136125 path : ' trivy-results.sarif'
137126 if : always()
138-
139-
140- notify :
141- name : Notify
142- runs-on : ubuntu-20.04
143- needs : [vars, build]
144- if : always() && github.ref == 'refs/heads/main'
145- steps :
146- - name : Workflow Status
147- id : check
148- uses : martialonline/workflow-status@v3
149- - name : Send Notification
150- uses : 8398a7/action-slack@v3
151- if : steps.check.outputs.status == 'failure'
152- with :
153- status : custom
154- custom_payload : |
155- {
156- username: 'Github',
157- icon_emoji: ':octocat:',
158- mention: 'channel',
159- attachments: [{
160- title: '${{ needs.vars.outputs.repo_name }} ${{ github.workflow }} pipeline has failed',
161- color: '${{ steps.check.outputs.status }}' == 'failure' ? 'danger' : 'warning',
162- fields: [{
163- title: 'Commit Hash',
164- value: '${{ needs.vars.outputs.sha_short }}',
165- short: true
166- },
167- {
168- title: 'Author',
169- value: '${{ github.actor }}',
170- short: true
171- },
172- {
173- title: 'Commit Message',
174- value: `${{ github.event.head_commit.message }}`,
175- short: false
176- },
177- {
178- title: 'Pipeline URL',
179- value: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}',
180- short: false
181- }]
182- }]
183- }
184- env :
185- GITHUB_TOKEN : ${{ github.token }}
186- SLACK_WEBHOOK_URL : ${{ secrets.SLACK_WEBHOOK }}
0 commit comments