Skip to content

Commit 5494596

Browse files
committed
Update CI workflow
- Adds Quay.io - Removes updated notification job, creates new notification workflow - Adds Docker labels to CI
1 parent 9ee7fa0 commit 5494596

File tree

3 files changed

+93
-91
lines changed

3 files changed

+93
-91
lines changed

.github/workflows/ci.yml

Lines changed: 21 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Continuous Integration
1+
name: CI
22

33
on:
44
push:
@@ -30,28 +30,9 @@ concurrency:
3030
cancel-in-progress: true
3131

3232
jobs:
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+
maintainer="[email protected]"
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 }}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Notification
2+
3+
on:
4+
workflow_run:
5+
branches: main
6+
workflows:
7+
- "CI"
8+
types:
9+
- completed
10+
11+
jobs:
12+
on-failure:
13+
runs-on: ubuntu-20.04
14+
if: ${{ github.event.workflow_run.conclusion == 'failure' && github.event.repository.fork == false }}
15+
steps:
16+
- name: Data
17+
uses: actions/github-script@v6
18+
continue-on-error: true
19+
id: data
20+
with:
21+
script: |
22+
const message = context.payload.workflow_run.head_commit.message
23+
message_sanitized = message.split('\n')[0]
24+
25+
const check_data = (await github.rest.checks.listForRef({
26+
owner: context.payload.repository.owner.login,
27+
repo: context.payload.repository.name,
28+
ref: context.payload.workflow_run.head_commit.id,
29+
})).data.check_runs.filter(check_run => check_run.conclusion === 'failure')[0]
30+
31+
return {
32+
job_name: check_data.name,
33+
job_url: check_data.html_url,
34+
commit_message: message_sanitized,
35+
}
36+
37+
- name: Send Notification
38+
uses: 8398a7/action-slack@v3
39+
with:
40+
status: custom
41+
custom_payload: |
42+
{
43+
username: 'Github',
44+
icon_emoji: ':github:',
45+
mention: 'channel',
46+
attachments: [{
47+
title: '[${{ github.event.repository.full_name }}] ${{ github.event.workflow.name }} pipeline has failed (${{ github.event.workflow_run.event }})',
48+
color: 'danger',
49+
fields: [{
50+
title: 'Commit',
51+
value: `<https://github.com/${{ github.repository }}/commit/${{ github.event.workflow_run.head_commit.id }}|${{ fromJSON(steps.data.outputs.result).commit_message }}>`,
52+
short: true
53+
},
54+
{
55+
title: 'Failed Job',
56+
value: `<${{ fromJSON(steps.data.outputs.result).job_url }}|${{ fromJSON(steps.data.outputs.result).job_name }}>`,
57+
short: true
58+
},
59+
{
60+
title: 'Author',
61+
value: `${{ github.event.workflow_run.head_commit.author.name }}`,
62+
short: true
63+
},
64+
{
65+
title: 'Pipeline URL',
66+
value: `<https://github.com/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }}|${{ github.event.workflow_run.id }}>`,
67+
short: true
68+
}]
69+
}]
70+
}
71+
env:
72+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}

Dockerfile

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,12 @@
11
FROM quay.io/operator-framework/helm-operator:v1.25.1
22

3-
ARG VERSION
4-
53
ENV HOME=/opt/helm
64
COPY watches.yaml ${HOME}/watches.yaml
75
COPY helm-charts ${HOME}/helm-charts
86
WORKDIR ${HOME}
97

108
COPY LICENSE /licenses/
119

12-
LABEL name="NGINX Ingress Operator" \
13-
maintainer="[email protected]" \
14-
vendor="NGINX Inc" \
15-
version="v${VERSION}" \
16-
release="1" \
17-
summary="The NGINX Ingress Operator is a Kubernetes/OpenShift component which deploys and manages one or more NGINX/NGINX Plus Ingress Controllers" \
18-
description="The NGINX Ingress Operator is a Kubernetes/OpenShift component which deploys and manages one or more NGINX/NGINX Plus Ingress Controllers"
19-
2010
# hack to update packages with CVEs
2111
USER root
2212
RUN microdnf --nodocs upgrade -y libcom_err libxml2

0 commit comments

Comments
 (0)