chore(ci): install the latest Trivy release dynamically
This commit is contained in:
1 parent
833eab04af
commit
5d9e3063c5
2 files changed
+20
-6
No files matched your search
@@ -58,8 +58,6 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
env:
|
|
||||||
TRIVY_VERSION: '0.76.1'
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v7
|
uses: actions/checkout@v7
|
||||||
@@ -76,11 +74,20 @@ jobs:
|
|||||||
- name: Install uv
|
- name: Install uv
|
||||||
run: pip install uv==0.13.5
|
run: pip install uv==0.13.5
|
||||||
- name: Install Trivy
|
- name: Install Trivy
|
||||||
# Downloaded from the release and checked against its published checksums. The
|
# Always the newest Trivy release. The version is read from the release redirect when the job
|
||||||
|
# runs, and the download is checked against that release's published checksums. The
|
||||||
# aquasecurity/trivy-action version tags were repointed to malicious commits in March 2026,
|
# aquasecurity/trivy-action version tags were repointed to malicious commits in March 2026,
|
||||||
# so that action is not used.
|
# so that action is not used.
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
|
latest_url=$(curl --fail --location --silent --show-error --retry 5 --retry-delay 2 \
|
||||||
|
--output /dev/null --write-out '%{url_effective}' https://github.com/aquasecurity/trivy/releases/latest)
|
||||||
|
TRIVY_VERSION=${latest_url##*/tag/v}
|
||||||
|
if [[ ! "$TRIVY_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||||
|
echo "Could not read the latest Trivy version from $latest_url" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "Installing Trivy $TRIVY_VERSION"
|
||||||
archive="trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz"
|
archive="trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz"
|
||||||
base_url="https://github.com/aquasecurity/trivy/releases/download/v${TRIVY_VERSION}"
|
base_url="https://github.com/aquasecurity/trivy/releases/download/v${TRIVY_VERSION}"
|
||||||
|
|
||||||
|
|||||||
+10
-3
@@ -58,8 +58,6 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
env:
|
|
||||||
TRIVY_VERSION: '0.76.1'
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v7
|
uses: actions/checkout@v7
|
||||||
@@ -76,11 +74,20 @@ jobs:
|
|||||||
- name: Install uv
|
- name: Install uv
|
||||||
run: pip install uv==0.13.5
|
run: pip install uv==0.13.5
|
||||||
- name: Install Trivy
|
- name: Install Trivy
|
||||||
# Downloaded from the release and checked against its published checksums. The
|
# Always the newest Trivy release. The version is read from the release redirect when the job
|
||||||
|
# runs, and the download is checked against that release's published checksums. The
|
||||||
# aquasecurity/trivy-action version tags were repointed to malicious commits in March 2026,
|
# aquasecurity/trivy-action version tags were repointed to malicious commits in March 2026,
|
||||||
# so that action is not used.
|
# so that action is not used.
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
|
latest_url=$(curl --fail --location --silent --show-error --retry 5 --retry-delay 2 \
|
||||||
|
--output /dev/null --write-out '%{url_effective}' https://github.com/aquasecurity/trivy/releases/latest)
|
||||||
|
TRIVY_VERSION=${latest_url##*/tag/v}
|
||||||
|
if [[ ! "$TRIVY_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||||
|
echo "Could not read the latest Trivy version from $latest_url" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "Installing Trivy $TRIVY_VERSION"
|
||||||
archive="trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz"
|
archive="trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz"
|
||||||
base_url="https://github.com/aquasecurity/trivy/releases/download/v${TRIVY_VERSION}"
|
base_url="https://github.com/aquasecurity/trivy/releases/download/v${TRIVY_VERSION}"
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user