KASM-6644 Falback to ecr if ghcr.io rate limits us when downloading trivy vuln dnb

This commit is contained in:
Ian Tangney 2024-10-28 17:08:58 +00:00
parent 0a8230a74e
commit 707899f196
No known key found for this signature in database

View File

@ -3,7 +3,14 @@
set -eo pipefail
build_report() {
set +e
$trivy_cmd --exit-code 0 --format template --template "@/$trivy_dir/contrib/junit.tpl" -o "$source_dir/trivy-report.xml" "$target"
RESULT=$?
set -e
if [ $RESULT -ne 0 ]; then
echo "Trivy command failed with default db, falling back to using ECR vuln db"
$trivy_cmd --db-repository public.ecr.aws/aquasecurity/trivy-db:2 --java-db-repository public.ecr.aws/aquasecurity/trivy-java-db:1 --exit-code 0 --format template --template "@/$trivy_dir/contrib/junit.tpl" -o "$source_dir/trivy-report.xml" "$target"
fi
#$trivy_cmd --exit-code 0 --format json -o "$source_dir/report.json" "$target"
}