@@ -116,10 +116,11 @@ generate_sbom() {
116116 local filename=$2
117117 local image=$3
118118 trivy image \
119+ --debug \
119120 --format spdx-json \
120121 --output image-scan-output/${imagename} /${filename} -sbom.json \
121- $image > /dev/null 2>&1
122- echo " trivy sbom $scan_common_args \
122+ $image & > image-scan-output/ ${imagename} / ${filename} -sbom.log
123+ echo " trivy sbom $scan_common_args --debug \
123124 --output image-scan-output/${imagename} /${filename} -scan.json \
124125 image-scan-output/${imagename} /${filename} -sbom.json"
125126}
@@ -139,17 +140,20 @@ scan_image() {
139140 if $generate_sbom ; then
140141 echo " Generating SBOM for $imagename "
141142 scan_command=$( generate_sbom $imagename $filename $image )
143+ cat image-scan-output/${imagename} /${filename} -sbom.log
144+ ls -alh image-scan-output/${imagename}
142145 else
143146 scan_command=" trivy image $scan_common_args \
144147 --output image-scan-output/${imagename} /${filename} -scan.json $image "
145148 fi
146149
147150 # Run scan against image or SBOM, format output. If no results, delete files.
148151 echo " Scanning $imagename for vulnerabilities"
149- if $scan_command > /dev/null 2>&1 ; then
152+ if $scan_command >& image-scan-output/ ${imagename} / ${filename} -scan.log ; then
150153 rm -f image-scan-output/${imagename} /${filename} -scan.json
151154 echo " ${image} " >> image-scan-output/clean-images.txt
152155 else
156+ cat image-scan-output/${imagename} /${filename} -scan.log
153157 generate_summary_csv $imagename $filename
154158 categorise_image $imagename $filename $image
155159 fi
0 commit comments