Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions .github/workflows/build-and-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,30 @@ jobs:
echo "::error::CodeQL produced ${count} alerts (warning/error)."
exit 1
fi
scan-intermediate-image:
runs-on: ubuntu-latest
steps:
- name: Scan intermediate image with grype
id: scan
uses: anchore/scan-action@f6601287cdb1efc985d6b765bbf99cb4c0ac29d8 # v7.0.0
continue-on-error: true
with:
cache-db: true
image: "alpine:3.22.2" # sync this with Containerfile
output-file: grype.sarif
severity-cutoff: high
- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@e296a935590eb16afc0c0108289f68c87e2a89a5 # v4.30.7
with:
sarif_file: grype.sarif
- name: Check success or failure
if: ${{ steps.scan.outcome == 'failure' }}
run: |-
jq '.runs[0].results | map(select(.level == "error"))' grype.sarif
exit 1

build-go:
needs: [ scan-dependencies, scan-codeql ]
needs: [ scan-dependencies, scan-codeql, scan-intermediate-image ]
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down Expand Up @@ -175,7 +196,7 @@ jobs:

# grype requires that the container image be pushed already because
# the scanner runs in a container with a different local registry
- name: Scan image with grype
- name: Scan final image with grype
id: scan
uses: anchore/scan-action@f6601287cdb1efc985d6b765bbf99cb4c0ac29d8 # v7.0.0
continue-on-error: true
Expand Down
8 changes: 7 additions & 1 deletion Containerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
# Containerfile for multigres-operator

# Github workflow step anchore/scan-action scans only the final image
# sync this intermediate FROM reference with:
# build-and-release.yaml => scan-intermediate-image
FROM --platform=$BUILDPLATFORM alpine:3.22.2 AS build

ARG TARGETOS
ARG TARGETARCH

COPY dist dist
RUN cp dist/multigres-operator-${TARGETARCH}/multigres-operator-${TARGETARCH} multigres-operator
RUN chmod +x multigres-operator

FROM alpine:3.22.2
FROM gcr.io/distroless/static-debian12

COPY --from=build multigres-operator multigres-operator

Expand Down
Loading