Update logging scan-jar.sh

This commit is contained in:
Corneil du Plessis
2024-04-03 11:27:41 +02:00
parent 7e00148638
commit f50c3619bf

View File

@@ -3,14 +3,18 @@ SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
SCDIR=$(realpath $SCDIR)
if [[ "$1" != *"-sources.jar" ]] && [[ "$1" != *"-javadoc.jar" ]]; then
if [ "$TRIVY_UPLOAD" == "true" ]; then
echo "Scanning $1"
echo "Scanning:$1"
trivy rootfs --format sarif -o "$1.sarif" "$1"
if [ -f $SCDIR/runs.sarif ]; then
echo "," >> "$SCDIR/runs.sarif"
if [ -f "$1.sarif" ]; then
if [ -f $SCDIR/runs.sarif ]; then
echo "," >> "$SCDIR/runs.sarif"
fi
jq -c '.runs | .[]' "$1.sarif" >> "$SCDIR/runs.sarif"
else
echo "Could not find:$1.sarif"
fi
jq -c '.runs | .[]' "$1.sarif" >> "$SCDIR/runs.sarif"
else
trivy rootfs -q $1
trivy rootfs -q "$1"
fi
else
if [ "$TRIVY_UPLOAD" == "true" ]; then