File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ ARG FORMAT="text"
6
6
7
7
FROM golang:${GO_VERSION}-alpine AS base
8
8
WORKDIR /go/src/github.com/moby/buildkit
9
+ RUN apk add --no-cache jq moreutils
9
10
ARG GOVULNCHECK_VERSION
10
11
RUN --mount=type=cache,target=/root/.cache \
11
12
--mount=type=cache,target=/go/pkg/mod \
@@ -17,6 +18,12 @@ RUN --mount=type=bind,target=. <<EOT
17
18
set -ex
18
19
mkdir /out
19
20
govulncheck -format ${FORMAT} ./... | tee /out/govulncheck.out
21
+ if [ "${FORMAT}" = "sarif" ]; then
22
+ # Make sure "results" field is defined in SARIF output otherwise GitHub Code Scanning
23
+ # will fail when uploading report with "Invalid SARIF. Missing 'results' array in run."
24
+ # Relates to https://github.com/golang/vuln/blob/ffdef74cc44d7eb71931d8d414c478b966812488/internal/sarif/sarif.go#L69
25
+ jq '(.runs[] | select(.results == null) | .results) |= []' /out/govulncheck.out | tee >(sponge /out/govulncheck.out)
26
+ fi
20
27
EOT
21
28
22
29
FROM scratch AS output
You can’t perform that action at this time.
0 commit comments