7
7
required : false
8
8
type : string
9
9
default : ' ubuntu-24.04'
10
+ image_version :
11
+ required : true
12
+ type : string
13
+ image :
14
+ required : true
15
+ type : string
10
16
11
17
defaults :
12
18
run :
@@ -28,77 +34,31 @@ jobs:
28
34
chmod +x preflight-linux-amd64
29
35
sudo mv preflight-linux-amd64 /usr/local/bin/preflight
30
36
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
73
38
uses : actions/download-artifact@v4
74
39
with :
75
- name : operator- image
40
+ name : ${{ inputs. image }}-${{ inputs.image_version }}
76
41
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
79
44
80
45
- name : Retag image for preflight
81
46
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"
84
50
85
- - name : Run preflight for NGINX Gateway Fabric Operator
51
+ - name : Run preflight
86
52
env :
87
53
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
89
55
90
- - name : Aggregate preflight results and fail if any checks failed
56
+ - name : Check preflight results
91
57
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
103
63
exit 1
104
64
fi
0 commit comments