fix(ci): pin Trivy to v0.58.0 (v0.57.1 is not a real release)
The prior pin used TRIVY_VERSION=0.57.1, but Trivy never published a
v0.57.1 tag — the release sequence went v0.57.0 → v0.58.0. The CI
docker job consequently failed with `curl: (22) The requested URL
returned error: 404` when fetching trivy_0.57.1_Linux-64bit.tar.gz.
- Bump TRIVY_VERSION to 0.58.0 (the first stable release after v0.57.0).
- Factor the GitHub release base URL into TRIVY_BASE_URL.
- Add explicit `set -euo pipefail` so each curl failure surfaces
immediately instead of relying on the runner's implicit -e.
- Anchor the checksum grep with ` ${TRIVY_TARBALL}$` so a partial
filename match cannot smuggle in the wrong checksum line.
- Wrap the checksum verification in a subshell so `cd /tmp` does not
affect later commands.
ISSUES CLOSED: #1927
This commit is contained in:
@@ -621,14 +621,17 @@ jobs:
|
||||
|
||||
- name: Security scan Dockerfile.server image with Trivy
|
||||
run: |
|
||||
# Install Trivy at a pinned version with checksum verification
|
||||
# Install Trivy at a pinned version with checksum verification.
|
||||
# v0.58.0 is the first stable release after v0.57.0; v0.57.1 does
|
||||
# not exist as a Trivy release tag.
|
||||
set -euo pipefail
|
||||
apk add --no-cache curl tar
|
||||
TRIVY_VERSION="0.57.1"
|
||||
ARCH="amd64"
|
||||
TRIVY_VERSION="0.58.0"
|
||||
TRIVY_TARBALL="trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz"
|
||||
curl -fsSL "https://github.com/aquasecurity/trivy/releases/download/v${TRIVY_VERSION}/${TRIVY_TARBALL}" -o "/tmp/${TRIVY_TARBALL}"
|
||||
curl -fsSL "https://github.com/aquasecurity/trivy/releases/download/v${TRIVY_VERSION}/trivy_${TRIVY_VERSION}_checksums.txt" -o /tmp/trivy_checksums.txt
|
||||
cd /tmp && grep "${TRIVY_TARBALL}" trivy_checksums.txt | sha256sum -c
|
||||
TRIVY_BASE_URL="https://github.com/aquasecurity/trivy/releases/download/v${TRIVY_VERSION}"
|
||||
curl -fsSL "${TRIVY_BASE_URL}/${TRIVY_TARBALL}" -o "/tmp/${TRIVY_TARBALL}"
|
||||
curl -fsSL "${TRIVY_BASE_URL}/trivy_${TRIVY_VERSION}_checksums.txt" -o /tmp/trivy_checksums.txt
|
||||
( cd /tmp && grep " ${TRIVY_TARBALL}\$" trivy_checksums.txt | sha256sum -c - )
|
||||
tar -xzf "/tmp/${TRIVY_TARBALL}" -C /usr/local/bin trivy
|
||||
trivy --version
|
||||
|
||||
|
||||
Reference in New Issue
Block a user