Skip to content

Commit 5da5f90

Browse files
committed
ci(gha): fix container image scan step
1 parent e7cf31a commit 5da5f90

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

.github/workflows/pipeline.yml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -226,27 +226,30 @@ jobs:
226226
labels: ${{ steps.meta.outputs.labels }}
227227
cache-to: type=registry,ref=${{ env.BASE_IMAGE }}:cache
228228
cache-from: type=registry,ref=${{ env.BASE_IMAGE }}:cache,mode=max
229-
- name: Scan Image
230-
uses: aquasecurity/[email protected]
231-
with:
232-
versin: 0.66.0
233-
image-ref: ${{ steps.meta.outputs.tags }}
234-
format: 'table'
235-
exit-code: '1'
236-
ignore-unfixed: true
237-
vuln-type: 'os,library'
238-
scanners: 'vuln,secret,misconfig'
239229
- name: Validate Container Image
230+
if: ${{ steps.bump-version.outputs.is-dryrun-version-bumped == 'true' }}
240231
run: |
241-
docker run -d -p 8080:8080 ${{ steps.meta.outputs.tags }}
232+
docker run -d -p 8080:8080 ${{ env.BASE_IMAGE }}:${{ steps.bump-version.outputs.bump-version }}
242233
sleep 5 # Wait for container to start
243234
HEALTH_STATUS=$(curl -s http://localhost:8080/companieshouse/actuator/health | jq -r '.status')
244235
if [ "$HEALTH_STATUS" != "UP" ]; then
245236
echo "Health check failed. Status: $HEALTH_STATUS"
246237
exit 1
247238
fi
248239
echo "Health check passed. Status: $HEALTH_STATUS"
240+
- name: Scan Image
241+
if: ${{ steps.bump-version.outputs.is-dryrun-version-bumped == 'true' }}
242+
uses: aquasecurity/[email protected]
243+
with:
244+
version: 0.66.0
245+
image-ref: ${{ env.BASE_IMAGE }}:${{ steps.bump-version.outputs.bump-version }}
246+
format: 'table'
247+
exit-code: '1'
248+
ignore-unfixed: true
249+
vuln-type: 'os,library'
250+
scanners: 'vuln,secret,misconfig'
249251
- name: Re-Build & Push Image
252+
if: ${{ steps.bump-version.outputs.is-dryrun-version-bumped == 'true' }}
250253
uses: docker/build-push-action@v6
251254
with:
252255
push: true

0 commit comments

Comments
 (0)