fix: determine arch before trying to restore from cache
CI / Test Setup Trivy amd64 (pull_request) Successful in 11s
CI / Test Setup Trivy arm64 (pull_request) Successful in 36s
CI / Test Setup DB (pull_request) Successful in 12s

This commit is contained in:
2025-11-08 18:49:50 +01:00
parent d33efe2071
commit f26a0c4a9a
+10 -11
View File
@@ -14,17 +14,8 @@ inputs:
runs:
using: "composite"
steps:
- name: Cache Trivy binary
id: cache-trivy
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: /usr/local/bin/trivy
key: trivy-${{ inputs.version }}-${{ inputs.architecture }}
restore-keys: |
trivy-${{ inputs.version }}-${{ inputs.architecture }}-
trivy-${{ inputs.version }}-
- shell: bash
id: arch
run: |
set -e
case "$(uname -m)" in
@@ -36,6 +27,14 @@ runs:
;;
esac
echo "ARCH=$ARCH" >> $GITHUB_OUTPUT
- name: Cache Trivy binary
id: cache-trivy
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: /usr/local/bin/trivy
key: trivy-${{ inputs.version }}-${{ steps.arch.outputs.arch }}
restore-keys: |
trivy-${{ inputs.version }}-${{ steps.arch.outputs.arch }}
- name: Download and install Trivy
if: steps.cache-trivy.outputs.cache-hit != 'true'
shell: bash
@@ -46,7 +45,7 @@ runs:
mkdir -p /usr/local/bin
curl -sL "https://github.com/aquasecurity/trivy/releases/download/${VERSION}/trivy_${VERSION#v}_Linux-${ARCH}.tar.gz" -o trivy.tar.gz
curl -sL "https://github.com/aquasecurity/trivy/releases/download/${VERSION}/trivy_${VERSION#v}_Linux-${{ steps.arch.outputs.arch }}.tar.gz" -o trivy.tar.gz
tar -xzf trivy.tar.gz
chmod +x trivy
mv trivy /usr/local/bin/