@@ -13,13 +13,12 @@ spec:
1313 description : >
1414 The CPU architectures on which to run tests
1515
16- # TODO(retention): We can increase the retention on scheduled pipelines after
17- # https://gitlab.com/groups/gitlab-org/-/epics/16321
16+ # https://docs.gitlab.com/ci/yaml#artifactsexpire_in
1817 retention :
1918 type : string
2019 default : 2d # Enough time to find and address MR failures the following day
2120 description : >
22- How long to keep reports; see https://docs.gitlab.com/ci/yaml#artifactsexpire_in
21+ How long to keep reports
2322 ---
2423
2524# https://docs.gitlab.com/ci/yaml/workflow
@@ -35,7 +34,6 @@ variables:
3534 # Show the duration of individual script items in the job log.
3635 FF_SCRIPT_SECTIONS : ' true'
3736
38- # See: [.github/workflows/lint.yaml]
3937# This uses a specific minor version of golangci-lint to ensure new code conforms
4038# to the rules we set when this release branch was cut. We do not want new rules
4139# suggesting sweeping changes to our release branches.
@@ -95,7 +93,6 @@ golang-lint:
9593 reports :
9694 junit : golangci-lint.junit.xml
9795
98- # See: [.github/workflows/test.yaml]
9996must-commit-generated :
10097 stage : build
10198 needs : []
@@ -107,7 +104,6 @@ must-commit-generated:
107104 - git config --global --add safe.directory "$(pwd)"
108105 - make check-generate
109106
110- # See: [.github/workflows/test.yaml]
111107# This uses the latest version of Go we have internally.
112108go-test :
113109 stage : test
@@ -146,7 +142,7 @@ go-test:
146142 reports :
147143 junit : ' *.junit.xml'
148144
149- # See: [.github/workflows /govulncheck.yaml]
145+ # https://go.dev/blog /govulncheck
150146govulncheck :
151147 stage : test
152148 needs : []
@@ -169,7 +165,7 @@ govulncheck:
169165 # This fails the job when it detects a vulnerability in called code.
170166 - go run "${TOOL}" --format text --show verbose ./...
171167
172- # See: [.github/workflows /trivy.yaml]
168+ # https:/ /trivy.dev/latest/ecosystem/cicd
173169trivy :
174170 stage : test
175171 needs : []
@@ -187,22 +183,25 @@ trivy:
187183 # Download Trivy and log its version.
188184 - |-
189185 VERSION=$(go list -m -f '{{.Version}}' github.com/aquasecurity/trivy@latest)
190- TOOL="github.com/aquasecurity/trivy/cmd/trivy@${VERSION}"
191- go run -exec true "${TOOL}"
192-
193- # Download the JUnit template for this version.
194- - curl -sSL -o /tmp/trivy-junit.tpl "https://raw.githubusercontent.com/aquasecurity/trivy/refs/tags/${VERSION}/contrib/junit.tpl"
186+ git clone --config 'advice.detachedHead=no' --depth 1 --branch "${VERSION}" --sparse \
187+ 'https://github.com/aquasecurity/trivy.git' \
188+ '.gitlab-remotes/aquasecurity-trivy'
189+ (
190+ cd '.gitlab-remotes/aquasecurity-trivy'
191+ git sparse-checkout set 'contrib'
192+ bash 'contrib/install.sh' -b "${HOME}/bin" "${VERSION}"
193+ )
195194
196195 # Generate a report and fail when there are issues that can be fixed.
197196 # Trivy needs a populated Go module cache to detect Go module licenses.
198197 - go mod download
199198 - >-
200- go run "${TOOL}" filesystem . --exit-code 1
199+ trivy filesystem . --exit-code 1
201200 --scanners license,secret,vuln
202201 --ignore-unfixed
203202 --no-progress
204203 --format template
205- --template '@/tmp/trivy- junit.tpl'
204+ --template '@.gitlab-remotes/aquasecurity-trivy/contrib/ junit.tpl'
206205 --output 'trivy.junit.xml'
207206
208207 # Send the report to GitLab.
0 commit comments