File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 6565 echo "::error::CodeQL produced ${count} alerts (warning/error)."
6666 exit 1
6767 fi
68+ scan-intermediate-image :
69+ runs-on : ubuntu-latest
70+ steps :
71+ - name : Scan intermediate image with grype
72+ id : scan
73+ uses : anchore/scan-action@f6601287cdb1efc985d6b765bbf99cb4c0ac29d8 # v7.0.0
74+ continue-on-error : true
75+ with :
76+ cache-db : true
77+ image : " alpine:3.22.2" # sync this with Containerfile
78+ output-file : grype.sarif
79+ severity-cutoff : high
80+ - name : Upload SARIF file
81+ uses : github/codeql-action/upload-sarif@e296a935590eb16afc0c0108289f68c87e2a89a5 # v4.30.7
82+ with :
83+ sarif_file : grype.sarif
84+ - name : Check success or failure
85+ if : ${{ steps.scan.outcome == 'failure' }}
86+ run : |-
87+ jq '.runs[0].results | map(select(.level == "error"))' grype.sarif
88+ exit 1
6889
6990 build-go :
70- needs : [ scan-dependencies, scan-codeql ]
91+ needs : [ scan-dependencies, scan-codeql, scan-intermediate-image ]
7192 runs-on : ubuntu-latest
7293 strategy :
7394 matrix :
@@ -175,7 +196,7 @@ jobs:
175196
176197 # grype requires that the container image be pushed already because
177198 # the scanner runs in a container with a different local registry
178- - name : Scan image with grype
199+ - name : Scan final image with grype
179200 id : scan
180201 uses : anchore/scan-action@f6601287cdb1efc985d6b765bbf99cb4c0ac29d8 # v7.0.0
181202 continue-on-error : true
Original file line number Diff line number Diff line change 1+ # Containerfile for multigres-operator
2+
3+ # Github workflow step anchore/scan-action scan onlys the final image
4+ # sync this intermediate FROM reference with:
5+ # build-and-release.yaml => scan-intermediate-image
16FROM --platform=$BUILDPLATFORM alpine:3.22.2 AS build
7+
28ARG TARGETOS
39ARG TARGETARCH
410
511COPY dist dist
612RUN cp dist/multigres-operator-${TARGETARCH}/multigres-operator-${TARGETARCH} multigres-operator
713RUN chmod +x multigres-operator
814
9- FROM alpine:3.22.2
15+ FROM gcr.io/distroless/static-debian12
1016
1117COPY --from=build multigres-operator multigres-operator
1218
You can’t perform that action at this time.
0 commit comments