#!/usr/bin/env sh
set -euo pipefail
export HOME="/tmp"
TRIVY_CACHE_DIR="/tmp/cache"
mkdir -p /tmp/.trivy
mkdir -p ${TRIVY_CACHE_DIR}
trivy plugin install scan2html
trivy k8s --report=${REPORT_TYPE:-all} \
                --exit-code=0 \
                --severity=${LEVELS:-CRITICAL,HIGH,MEDIUM} \
                -o tmp/trivy.json \
                --format json \
                --disable-node-collector \
                --parallel ${PARALLEL:-5} 
trivy scan2html generate --scan2html-flags --output tmp/report.html --from tmp/trivy.json