Files
k3s/scripts/image_scan.sh
Ian Cardoso a9b8c87fcc fix image_scan.sh script and download trivy version (#7950) (#7969)
Signed-off-by: Ian Cardoso <osodracnai@gmail.com>
(cherry picked from commit 58a8deb25d)
2023-07-14 09:24:11 -03:00

29 lines
537 B
Bash
Executable File

#/bin/sh
set -e
if [ -z $1 ] && [ -z $2 ]; then
echo "error: image name and arch name are required as arguments. exiting..."
exit 1
fi
ARCH=$2
# skipping image scan for 32 bits image since trivy dropped support for those https://github.com/aquasecurity/trivy/discussions/4789
if [[ "${ARCH}" = "arm" ]] || [ "${ARCH}" != "386" ]; then
exit 0
fi
if [ -n ${DEBUG} ]; then
set -x
fi
IMAGE=$1
SEVERITIES="HIGH,CRITICAL"
trivy --quiet image --severity ${SEVERITIES} --no-progress --ignore-unfixed ${IMAGE}
exit 0