Skip to content

Commit 9a4d4f7

Browse files
shaun-nxciarams87
authored andcommitted
Update pipeline to build and publish UBI images (#3958)
1 parent d2fffc9 commit 9a4d4f7

File tree

6 files changed

+61
-38
lines changed

6 files changed

+61
-38
lines changed

.github/workflows/build.yml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
platforms:
77
required: true
88
type: string
9+
build-os:
10+
required: false
11+
type: string
12+
default: ''
913
image:
1014
required: true
1115
type: string
@@ -120,12 +124,12 @@ jobs:
120124
flavor: |
121125
latest=${{ (inputs.tag != '' && 'true') || 'auto' }}
122126
tags: |
123-
type=semver,pattern={{version}}
124-
type=edge
125-
type=schedule
126-
type=ref,event=pr
127-
type=ref,event=branch,suffix=-rc,enable=${{ startsWith(github.ref, 'refs/heads/release') && inputs.tag == '' }}
128-
type=raw,value=${{ inputs.tag }},enable=${{ inputs.tag != '' }}
127+
type=semver,pattern={{version}},suffix=${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }}
128+
type=edge,suffix=${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }}
129+
type=schedule,suffix=${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }}
130+
type=ref,event=pr,suffix=${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }}
131+
type=ref,event=branch,suffix=-rc${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }},enable=${{ startsWith(github.ref, 'refs/heads/release') && inputs.tag == '' }}
132+
type=raw,value=${{ inputs.tag }},enable=${{ inputs.tag != '' }},suffix=${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }}
129133
labels: |
130134
org.opencontainers.image.documentation=https://docs.nginx.com/nginx-gateway-fabric
131135
org.opencontainers.image.vendor=NGINX Inc <[email protected]>
@@ -143,16 +147,16 @@ jobs:
143147
- name: Build Docker Image
144148
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
145149
with:
146-
file: build/Dockerfile${{ inputs.image == 'nginx' && '.nginx' || '' }}${{ inputs.image == 'plus' && '.nginxplus' || '' }}
150+
file: ${{ inputs.build-os != '' && format('build/{0}/Dockerfile{1}', inputs.build-os, inputs.image == 'nginx' && '.nginx' || inputs.image == 'plus' && '.nginxplus' || '') || format('build/Dockerfile{0}', inputs.image == 'nginx' && '.nginx' || inputs.image == 'plus' && '.nginxplus' || '') }}
147151
context: "."
148152
target: ${{ inputs.image == 'ngf' && 'goreleaser' || '' }}
149153
tags: ${{ steps.meta.outputs.tags }}
150154
labels: ${{ steps.meta.outputs.labels }}
151155
annotations: ${{ steps.meta.outputs.annotations }}
152156
push: ${{ !inputs.dry_run }}
153157
platforms: ${{ inputs.platforms }}
154-
cache-from: type=gha,scope=${{ inputs.image }}
155-
cache-to: type=gha,scope=${{ inputs.image }},mode=max
158+
cache-from: type=gha,scope=${{ inputs.image }}${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }}
159+
cache-to: type=gha,scope=${{ inputs.image }}${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }},mode=max
156160
pull: true
157161
no-cache: ${{ github.event_name != 'pull_request' }}
158162
sbom: true

.github/workflows/ci.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,10 +350,12 @@ jobs:
350350
matrix:
351351
image: [ngf, nginx]
352352
platforms: ["linux/arm64, linux/amd64"]
353+
build-os: ["", ubi]
353354
uses: ./.github/workflows/build.yml
354355
with:
355356
image: ${{ matrix.image }}
356357
platforms: ${{ matrix.platforms }}
358+
build-os: ${{ matrix.build-os }}
357359
tag: ${{ inputs.release_version || '' }}
358360
dry_run: ${{ inputs.dry_run || false}}
359361
runner: ${{ github.repository_owner == 'nginx' && (inputs.is_production_release || (github.event_name == 'push' && github.ref == 'refs/heads/main')) && 'ubuntu-24.04-amd64' || 'ubuntu-24.04' }}
@@ -368,9 +370,14 @@ jobs:
368370
name: Build Plus images
369371
needs: [vars, binary]
370372
uses: ./.github/workflows/build.yml
373+
strategy:
374+
fail-fast: false
375+
matrix:
376+
build-os: ["", ubi]
371377
with:
372378
image: plus
373379
platforms: "linux/arm64, linux/amd64"
380+
build-os: ${{ matrix.build-os }}
374381
tag: ${{ inputs.release_version || '' }}
375382
dry_run: ${{ inputs.dry_run || false }}
376383
runner: ${{ github.repository_owner == 'nginx' && (inputs.is_production_release || (github.event_name == 'push' && github.ref == 'refs/heads/main')) && 'ubuntu-24.04-amd64' || 'ubuntu-24.04' }}
@@ -388,6 +395,7 @@ jobs:
388395
fail-fast: false
389396
matrix:
390397
image: [nginx, plus]
398+
build-os: ["", ubi]
391399
k8s-version:
392400
[
393401
"${{ needs.vars.outputs.min_k8s_version }}",
@@ -397,6 +405,7 @@ jobs:
397405
with:
398406
image: ${{ matrix.image }}
399407
k8s-version: ${{ matrix.k8s-version }}
408+
build-os: ${{ matrix.build-os }}
400409
secrets: inherit
401410
permissions:
402411
contents: read
@@ -408,6 +417,7 @@ jobs:
408417
fail-fast: false
409418
matrix:
410419
image: [nginx, plus]
420+
build-os: ["", ubi]
411421
k8s-version:
412422
[
413423
"${{ needs.vars.outputs.min_k8s_version }}",
@@ -419,6 +429,7 @@ jobs:
419429
image: ${{ matrix.image }}
420430
k8s-version: ${{ matrix.k8s-version }}
421431
enable-experimental: ${{ matrix.enable-experimental }}
432+
build-os: ${{ matrix.build-os }}
422433
production-release: ${{ inputs.is_production_release == true && (inputs.dry_run == false || inputs.dry_run == null) }}
423434
release_version: ${{ inputs.release_version }}
424435
secrets: inherit

.github/workflows/conformance.yml

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
image:
77
required: true
88
type: string
9+
build-os:
10+
required: false
11+
type: string
12+
default: ''
913
k8s-version:
1014
required: true
1115
type: string
@@ -75,12 +79,12 @@ jobs:
7579
images: |
7680
name=ghcr.io/nginx/nginx-gateway-fabric
7781
tags: |
78-
type=semver,pattern={{version}}
79-
type=edge
80-
type=schedule
81-
type=ref,event=pr
82-
type=ref,event=branch,suffix=-rc,enable=${{ startsWith(github.ref, 'refs/heads/release') && !inputs.production-release }}
83-
type=raw,value={{inputs.release_version}},enable=${{ inputs.production-release && inputs.release_version != '' }}
82+
type=semver,pattern={{version}},suffix=${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }}
83+
type=edge,suffix=${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }}
84+
type=schedule,suffix=${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }}
85+
type=ref,event=pr,suffix=${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }}
86+
type=ref,event=branch,suffix=-rc${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }},enable=${{ startsWith(github.ref, 'refs/heads/release') && !inputs.production-release }}
87+
type=raw,value={{ inputs.release_version }},enable=${{ inputs.production-release && inputs.release_version != '' }},suffix=${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }}
8488
8589
- name: NGINX Docker meta
8690
id: nginx-meta
@@ -89,12 +93,12 @@ jobs:
8993
images: |
9094
name=ghcr.io/nginx/nginx-gateway-fabric/${{ inputs.image == 'plus' && 'nginx-plus' || inputs.image }}
9195
tags: |
92-
type=semver,pattern={{version}}
93-
type=edge
94-
type=schedule
95-
type=ref,event=pr
96-
type=ref,event=branch,suffix=-rc,enable=${{ startsWith(github.ref, 'refs/heads/release') && !inputs.production-release }}
97-
type=raw,value={{inputs.release_version}},enable=${{ inputs.production-release && inputs.release_version != '' }}
96+
type=semver,pattern={{version}},suffix=${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }}
97+
type=edge,suffix=${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }}
98+
type=schedule,suffix=${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }}
99+
type=ref,event=pr,suffix=${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }}
100+
type=ref,event=branch,suffix=-rc${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }},enable=${{ startsWith(github.ref, 'refs/heads/release') && !inputs.production-release }}
101+
type=raw,value={{ inputs.release_version }},enable=${{ inputs.production-release && inputs.release_version != '' }},suffix=${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }}
98102
99103
- name: Build binary
100104
uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0
@@ -119,11 +123,11 @@ jobs:
119123
- name: Build NGINX Docker Image
120124
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
121125
with:
122-
file: build/Dockerfile${{ inputs.image == 'nginx' && '.nginx' || '' }}${{ inputs.image == 'plus' && '.nginxplus' || ''}}
126+
file: build${{ inputs.build-os != '' && format('/{0}', inputs.build-os) || '' }}/Dockerfile${{ inputs.image == 'nginx' && '.nginx' || '' }}${{ inputs.image == 'plus' && '.nginxplus' || '' }}
123127
tags: ${{ steps.nginx-meta.outputs.tags }}
124128
context: "."
125129
load: true
126-
cache-from: type=gha,scope=${{ inputs.image }}
130+
cache-from: type=gha,scope=${{ inputs.image }}${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }}
127131
pull: true
128132
build-args: |
129133
NJS_DIR=internal/controller/nginx/modules/src
@@ -178,7 +182,7 @@ jobs:
178182
if: ${{ inputs.enable-experimental }}
179183
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
180184
with:
181-
name: conformance-profile-${{ inputs.image }}-${{ inputs.k8s-version }}
185+
name: conformance-profile-${{ inputs.image }}-${{ inputs.k8s-version }}-${{ steps.ngf-meta.outputs.version }}
182186
path: ./tests/conformance-profile.yaml
183187

184188
- name: Upload profile to release

.github/workflows/functional.yml

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ on:
99
k8s-version:
1010
required: true
1111
type: string
12+
build-os:
13+
required: false
14+
type: string
15+
default: ''
1216

1317
defaults:
1418
run:
@@ -61,11 +65,11 @@ jobs:
6165
images: |
6266
name=ghcr.io/nginx/nginx-gateway-fabric
6367
tags: |
64-
type=semver,pattern={{version}}
65-
type=schedule
66-
type=edge
67-
type=ref,event=pr
68-
type=ref,event=branch,suffix=-rc,enable=${{ startsWith(github.ref, 'refs/heads/release') }}
68+
type=semver,pattern={{version}},suffix=${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }}
69+
type=schedule,suffix=${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }}
70+
type=edge,suffix=${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }}
71+
type=ref,event=pr,suffix=${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }}
72+
type=ref,event=branch,suffix=-rc${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }},enable=${{ startsWith(github.ref, 'refs/heads/release') }}
6973
7074
- name: NGINX Docker meta
7175
id: nginx-meta
@@ -74,11 +78,11 @@ jobs:
7478
images: |
7579
name=ghcr.io/nginx/nginx-gateway-fabric/${{ inputs.image == 'plus' && 'nginx-plus' || inputs.image }}
7680
tags: |
77-
type=semver,pattern={{version}}
78-
type=edge
79-
type=schedule
80-
type=ref,event=pr
81-
type=ref,event=branch,suffix=-rc,enable=${{ startsWith(github.ref, 'refs/heads/release') }}
81+
type=semver,pattern={{version}},suffix=${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }}
82+
type=schedule,suffix=${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }}
83+
type=edge,suffix=${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }}
84+
type=ref,event=pr,suffix=${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }}
85+
type=ref,event=branch,suffix=-rc${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }},enable=${{ startsWith(github.ref, 'refs/heads/release') }}
8286
8387
- name: Build binary
8488
uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0
@@ -103,11 +107,11 @@ jobs:
103107
- name: Build NGINX Docker Image
104108
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
105109
with:
106-
file: build/Dockerfile${{ inputs.image == 'nginx' && '.nginx' || '' }}${{ inputs.image == 'plus' && '.nginxplus' || ''}}
110+
file: build${{ inputs.build-os != '' && format('/{0}', inputs.build-os) || '' }}/Dockerfile${{ inputs.image == 'nginx' && '.nginx' || '' }}${{ inputs.image == 'plus' && '.nginxplus' || '' }}
107111
tags: ${{ steps.nginx-meta.outputs.tags }}
108112
context: "."
109113
load: true
110-
cache-from: type=gha,scope=${{ inputs.image }}
114+
cache-from: type=gha,scope=${{ inputs.image }}${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }}
111115
pull: true
112116
build-args: |
113117
NJS_DIR=internal/controller/nginx/modules/src

build/ubi/Dockerfile.nginx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ RUN mkdir -p /usr/lib/nginx/modules /var/run/nginx /usr/lib64/nginx/modules \
5252
# Forward request and error logs to docker log collector
5353
&& ln -sf /dev/stdout /var/log/nginx/access.log \
5454
&& ln -sf /dev/stderr /var/log/nginx/error.log \
55-
&& mv /usr/lib64/nginx/modules/ngx_* /usr/lib/nginx/modules/
55+
&& cp /usr/lib64/nginx/modules/ngx_* /usr/lib/nginx/modules/
5656

5757
# Set proper permissions for nginx user
5858
RUN chown -R 101:1001 /etc/nginx /var/cache/nginx

build/ubi/Dockerfile.nginxplus

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ RUN mkdir -p /usr/lib/nginx/modules /var/run/nginx /usr/lib64/nginx/modules \
5959
# Forward request and error logs to docker log collector
6060
&& ln -sf /dev/stdout /var/log/nginx/access.log \
6161
&& ln -sf /dev/stderr /var/log/nginx/error.log \
62-
&& mv /usr/lib64/nginx/modules/ngx_* /usr/lib/nginx/modules/
62+
&& cp /usr/lib64/nginx/modules/ngx_* /usr/lib/nginx/modules/
6363

6464
# Copy default html files to a writable location
6565
RUN mkdir -p /etc/nginx/html \

0 commit comments

Comments
 (0)