mirror of
https://github.com/kasmtech/workspaces-core-images.git
synced 2026-07-18 00:45:59 +00:00
This changes how the pipeline installs trivy. A scheduled job in the qa-infrastructure project will download the latest release and store it in S3. Jobs that use trivy retrieve it from there. This avoids rate limiting and gives us more control over the version of trivy we use.
18 lines
598 B
Bash
18 lines
598 B
Bash
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
arch=$(arch | sed -e 's/aarch64/arm64/g' -e 's/x86_64/x86/g')
|
|
download_dir=$( mktemp -td )
|
|
curl -fsSLO --output-dir "$download_dir" "https://${S3_BUCKET}.s3.amazonaws.com/trivy/trivy-${arch}.tar.gz"
|
|
|
|
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
|
trivy_dir="${SCRIPT_DIR}/trivy"
|
|
rm -rf $trivy_dir
|
|
mkdir $trivy_dir
|
|
cd $trivy_dir
|
|
tar -zxvf "${download_dir}/trivy-${arch}.tar.gz"
|
|
echo "Using trivy $( ./trivy --version )"
|
|
|
|
if [[ -e "${SCRIPT_DIR}/junit.tpl" ]]; then
|
|
cp -v "${SCRIPT_DIR}/junit.tpl" "${SCRIPT_DIR}/trivy/contrib/"
|
|
fi
|