25
25
description : ' Enter Bash Env Variable Overrides in `KEY=VAL KEY2=VAL2` format:'
26
26
required : false
27
27
type : string
28
- ref :
29
- description : ' Enter Git Ref:'
30
- required : true
31
- default : ' main'
32
- type : string
33
28
runner_label :
34
29
description : ' Enter Validation Runner Label:'
35
30
default : test-runner
61
56
no_start :
62
57
required : false
63
58
type : boolean
64
- ref :
65
- required : true
66
- type : string
67
59
jobs :
68
- # ###################################################################################################
69
- # Compose Build
70
- # ###################################################################################################
60
+ # ###################################################################################################
61
+ # Compose Build
62
+ # ###################################################################################################
71
63
setup-build :
72
64
outputs :
73
65
matrix : ${{ steps.build-matrix.outputs.matrix }}
78
70
with :
79
71
egress-policy : audit
80
72
- uses : actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
81
- with :
82
- ref : ${{ inputs.ref }}
83
73
- name : Set Matrix
84
74
id : build-matrix
85
75
run : echo "matrix=$(jq -c . < ${{ inputs.group_dir }}/.actions.json)" >> $GITHUB_OUTPUT
@@ -93,10 +83,10 @@ jobs:
93
83
strategy :
94
84
matrix : ${{ fromJson(needs.setup-build.outputs.matrix) }}
95
85
fail-fast : false
86
+ outputs :
87
+ group : ${{ steps.build-group.outputs.container-group }}
96
88
steps :
97
89
- uses : actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
98
- with :
99
- ref : ${{ inputs.ref }}
100
90
if : ${{ !inputs.no_build }}
101
91
- uses : docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0
102
92
with :
@@ -115,9 +105,63 @@ jobs:
115
105
repo : ${{ secrets.REPO }}
116
106
no-push : ${{ inputs.no_push }}
117
107
no-start : ${{ inputs.no_start }}
118
- # ###################################################################################################
119
- # Generic Test Runner
120
- # ###################################################################################################
108
+ # ###################################################################################################
109
+ # Trivy Scan
110
+ # ###################################################################################################
111
+ setup-scan :
112
+ needs : [build-containers]
113
+ runs-on : ubuntu-latest
114
+ outputs :
115
+ matrix : ${{ steps.scan-matrix.outputs.matrix }}
116
+ steps :
117
+ - name : Harden Runner
118
+ uses : step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
119
+ with :
120
+ egress-policy : audit
121
+ - uses : actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
122
+ with :
123
+ path : matrix
124
+ - name : Set Matrix
125
+ id : scan-matrix
126
+ run : echo "matrix=$(cat matrix/*-${{ needs.build-containers.outputs.group }}/*.txt | jq -R '.' | jq -sc '. | unique')" >> $GITHUB_OUTPUT
127
+ scan-containers :
128
+ needs : [setup-scan]
129
+ if : ${{ !inputs.no_build }}
130
+ runs-on : k8-runners
131
+ permissions :
132
+ actions : read
133
+ packages : read
134
+ pull-requests : write
135
+ security-events : write
136
+ strategy :
137
+ matrix :
138
+ container : ${{ fromJSON(needs.setup-scan.outputs.matrix) }}
139
+ fail-fast : false
140
+ steps :
141
+ - uses : actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
142
+ - uses : docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0
143
+ with :
144
+ registry : ${{ secrets.REGISTRY }}
145
+ username : ${{ secrets.REGISTRY_USER }}
146
+ password : ${{ secrets.REGISTRY_TOKEN }}
147
+ - name : Pull Image
148
+ run : docker pull ${{ secrets.REGISTRY }}/${{ secrets.REPO }}:${{ matrix.container }}
149
+ - name : Scan Container
150
+ uses : intel/ai-containers/.github/scan@5c68c9c8ff7f634fff3abcc17c46970e0b9b0dde # main
151
+ with :
152
+ image-ref : ${{ secrets.REGISTRY }}/${{ secrets.REPO }}:${{ matrix.container }}
153
+ output : ${{ matrix.container }}-scan.sarif
154
+ - name : Cleanup
155
+ if : always()
156
+ run : docker rmi -f ${{ secrets.REGISTRY }}/${{ secrets.REPO }}:${{ matrix.container }}
157
+ - uses : github/codeql-action/upload-sarif@2e230e8fe0ad3a14a340ad0815ddb96d599d2aff # v3.25.8
158
+ with :
159
+ sarif_file : ' ${{ matrix.container }}-scan.sarif'
160
+ category : ' ${{ matrix.container }}'
161
+ continue-on-error : true
162
+ # ###################################################################################################
163
+ # Generic Test Runner
164
+ # ###################################################################################################
121
165
setup-test :
122
166
needs : [build-containers]
123
167
runs-on : ubuntu-latest
@@ -129,8 +173,6 @@ jobs:
129
173
with :
130
174
egress-policy : audit
131
175
- uses : actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
132
- with :
133
- ref : ${{ inputs.ref }}
134
176
- name : Get Recipes
135
177
id : test-matrix
136
178
run : echo "matrix=$(find ${{ inputs.group_dir }} -type f -name 'tests.yaml' -exec dirname {} \; | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT
@@ -148,8 +190,6 @@ jobs:
148
190
with :
149
191
egress-policy : audit
150
192
- uses : actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
151
- with :
152
- ref : ${{ inputs.ref }}
153
193
- uses : docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0
154
194
with :
155
195
registry : ${{ secrets.REGISTRY }}
@@ -159,9 +199,8 @@ jobs:
159
199
uses : intel/ai-containers/test-runner@main
160
200
with :
161
201
cache_registry : ${{ secrets.CACHE_REGISTRY }}
162
- perf_repo : ${{ secrets.PERF_REPO }}
163
202
recipe_dir : ${{ inputs.group_dir }}
164
203
registry : ${{ secrets.REGISTRY }}
165
204
repo : ${{ secrets.REPO }}
166
205
test_dir : ${{ matrix.tests }}
167
- token : ${{ secrets.PERF_TOKEN }}
206
+ token : ${{ secrets.GITHUB_TOKEN }}
0 commit comments