Skip to content

Commit 893fdb1

Browse files
committed
Load images to Docker Daemon in build step. Run Openshift certification in matrix of images
1 parent aafd707 commit 893fdb1

File tree

3 files changed

+34
-94
lines changed

3 files changed

+34
-94
lines changed

.github/workflows/build.yml

Lines changed: 8 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ jobs:
4646
image: registry:3
4747
ports:
4848
- 5000:5000
49+
outputs:
50+
image_version: ${{ steps.meta.outputs.version }}
4951
steps:
5052
- name: Checkout Repository
5153
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
@@ -155,6 +157,7 @@ jobs:
155157
labels: ${{ steps.meta.outputs.labels }}
156158
annotations: ${{ steps.meta.outputs.annotations }}
157159
push: ${{ !inputs.dry_run }}
160+
load: true
158161
platforms: ${{ inputs.platforms }}
159162
cache-from: type=gha,scope=${{ inputs.image }}${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }}
160163
cache-to: type=gha,scope=${{ inputs.image }}${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }},mode=max
@@ -194,43 +197,15 @@ jobs:
194197
sarif_file: ${{ steps.scan.outputs.sarif }}
195198
category: build-${{ inputs.image }}
196199

197-
- name: Save NGINX Gateway Fabric image
198-
if: ${{ inputs.image == 'ngf' }}
199-
run: |
200-
IMAGE_TAG=$(echo "${{ steps.meta.outputs.tags }}" | grep '^localhost:5000/nginx-gateway-fabric/ngf:' | head -n 1)
201-
docker save -o ngf-image.tar $IMAGE_TAG
202-
203-
- name: Upload NGINX Gateway Fabric image artifact
204-
uses: actions/upload-artifact@v4
205-
with:
206-
name: ngf-image
207-
path: ngf-image.tar
208-
209200
- name: Show all image tags for debugging
210201
run: echo "${{ steps.meta.outputs.tags }}"
211202

212-
- name: Save NGINX OSS image as tarball
213-
if: ${{ inputs.image == 'nginx' }}
214-
run: |
215-
IMAGE_TAG=$(echo "${{ steps.meta.outputs.tags }}" | grep '^localhost:5000/nginx-gateway-fabric/nginx:' | head -n 1)
216-
docker save -o nginx-oss-image.tar $IMAGE_TAG
217-
218-
- name: Upload NGINX OSS image artifact
219-
if: ${{ inputs.image == 'nginx' }}
220-
uses: actions/upload-artifact@v4
221-
with:
222-
name: nginx-oss-image
223-
path: nginx-oss-image.tar
224-
225-
- name: Save Operator image as tarball
226-
if: ${{ inputs.image == 'operator' }}
203+
- name: Save the image as tarball
227204
run: |
228-
IMAGE_TAG=$(echo "${{ steps.meta.outputs.tags }}" | grep '^localhost:5000/nginx-gateway-fabric/operator:' | head -n 1)
229-
docker save -o operator-image.tar $IMAGE_TAG
205+
docker save -o ${{ inputs.image }}-${{ steps.meta.outputs.version }}.tar localhost:5000/nginx-gateway-fabric/${{ inputs.image }}:${{ steps.meta.outputs.version }}
230206
231-
- name: Upload Operator image artifact
232-
if: ${{ inputs.image == 'operator' }}
207+
- name: Upload the image artifact
233208
uses: actions/upload-artifact@v4
234209
with:
235-
name: operator-image
236-
path: operator-image.tar
210+
name: ${{ inputs.image }}-${{ steps.meta.outputs.version }}
211+
path: ${{ inputs.image }}-${{ steps.meta.outputs.version }}.tar

.github/workflows/ci.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,10 +412,15 @@ jobs:
412412
openshift-certification:
413413
name: OpenShift Certification
414414
needs: [build-oss, build-plus, build-operator]
415+
strategy:
416+
fail-fast: false
417+
matrix:
418+
image: [ngf, nginx, operator]
415419
# if: ${{ github.event_name == 'pull_request' && github.event_pull_request.base.ref == 'main' || (github.event_name == 'push' && github.ref == 'refs/heads/main') || (inputs.is_production_release == true) }}
416420
uses: ./.github/workflows/openshift-certification.yml
417421
with:
418422
runner: ubuntu-24.04
423+
image_version: ${{ jobs.build.outputs.image_version }}
419424
permissions:
420425
contents: read
421426
packages: read

.github/workflows/openshift-certification.yml

Lines changed: 21 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ on:
77
required: false
88
type: string
99
default: 'ubuntu-24.04'
10+
image_version:
11+
required: true
12+
type: string
13+
image:
14+
required: true
15+
type: string
1016

1117
defaults:
1218
run:
@@ -28,77 +34,31 @@ jobs:
2834
chmod +x preflight-linux-amd64
2935
sudo mv preflight-linux-amd64 /usr/local/bin/preflight
3036
31-
- name: Download NGINX Gateway Fabric image artifact
32-
uses: actions/download-artifact@v4
33-
with:
34-
name: ngf-image
35-
36-
- name: Load NGINX Gateway Fabric image into Docker
37-
run: docker load -i ngf-image.tar
38-
39-
- name: Load NGINX Gateway Fabric image into Docker
40-
run: docker load -i ngf-image.tar
41-
42-
- name: Retag image for preflight
43-
run: |
44-
IMAGE_ID=$(docker images --format '{{.Repository}}:{{.Tag}}' | grep '^localhost:5000/nginx-gateway-fabric/ngf:' | head -n 1)
45-
docker tag $IMAGE_ID nginx-gateway-fabric:ubi
46-
47-
48-
- name: Run preflight for NGINX Gateway Fabric
49-
env:
50-
PYXIS_API_TOKEN: ${{ secrets.PYXIS_API_TOKEN }}
51-
run: preflight check container nginx-gateway-fabric:ubi > ngf-preflight-result.json
52-
53-
- name: Download NGINX NGINX OSS image artifact
54-
uses: actions/download-artifact@v4
55-
with:
56-
name: nginx-oss-image
57-
58-
- name: Load NGINX OSS image into Docker
59-
run: docker load -i nginx-oss-image.tar
60-
61-
- name: Retag image for preflight
62-
run: |
63-
IMAGE_ID=$(docker images --format '{{.Repository}}:{{.Tag}}' | grep '^localhost:5000/nginx-gateway-fabric/nginx:' | head -n 1)
64-
docker tag $IMAGE_ID nginx-oss:ubi
65-
66-
67-
- name: Run preflight for NGINX OSS
68-
env:
69-
PYXIS_API_TOKEN: ${{ secrets.PYXIS_API_TOKEN }}
70-
run: preflight check container nginx:ubi > ngf-oss-preflight-result.json
71-
72-
- name: Download NGINX Gateway Fabric Operator image artifact
37+
- name: Download image artifact
7338
uses: actions/download-artifact@v4
7439
with:
75-
name: operator-image
40+
name: ${{ inputs.image }}-${{ inputs.image_version }}
7641

77-
- name: Load NGINX Gateway Fabric Operator image into Docker
78-
run: docker load -i operator-image.tar
42+
- name: Load image into Docker
43+
run: docker load -i ${{ inputs.image }}-${{ inputs.image_version }}.tar
7944

8045
- name: Retag image for preflight
8146
run: |
82-
IMAGE_ID=$(docker images --format '{{.Repository}}:{{.Tag}}' | grep '^localhost:5000/nginx-gateway-fabric/operator:' | head -n 1)
83-
docker tag $IMAGE_ID ngf-operator:ubi
47+
loaded_tag="localhost:5000/nginx-gateway-fabric/${{ inputs.image }}:${{ inputs.image_version }}"
48+
preflight_tag="${{ inputs.image }}:ubi"
49+
docker tag "$loaded_tag" "$preflight_tag"
8450
85-
- name: Run preflight for NGINX Gateway Fabric Operator
51+
- name: Run preflight
8652
env:
8753
PYXIS_API_TOKEN: ${{ secrets.PYXIS_API_TOKEN }}
88-
run: preflight check container ngf-operator:ubi > ngf-operator-preflight-result.json
54+
run: preflight check container ${{ inputs.image }}:ubi > preflight-result.json
8955

90-
- name: Aggregate preflight results and fail if any checks failed
56+
- name: Check preflight results
9157
run: |
92-
total_failed=0
93-
for result in ngf-preflight-result.json ngf-oss-preflight-result.json ngf-operator-preflight-result.json; do
94-
failed_count=$(jq '.results.failed | length' "$result")
95-
total_failed=$((total_failed + failed_count))
96-
done
97-
if [ "$total_failed" -ne 0 ]; then
98-
echo "Preflight checks failed: $total_failed failed checks across all images"
99-
for result in ngf-preflight-result.json ngf-oss-preflight-result.json ngf-operator-preflight-result.json; do
100-
echo "Results for $result:"
101-
jq '.results.failed' "$result"
102-
done
58+
failed_count=$(jq '.results.failed | length' preflight-result.json)
59+
if [ "$failed_count" -ne 0 ]; then
60+
echo "Preflight checks failed: $failed_count failed checks"
61+
echo "Results for preflight-result.json:"
62+
jq '.results.failed' preflight-result.json
10363
exit 1
10464
fi

0 commit comments

Comments
 (0)