@@ -20,34 +20,46 @@ spec:
2020 description : The workspace containing the source-code to scan.
2121 steps :
2222 - name : run-modelscan
23- image : python:alpine
23+ image : python:3.11-alpine
24+ imagePullPolicy : Always
2425 script : |
25- pip install 'modelscan[ tensorflow, h5py ]'
26- modelscan \
27- --path "$(workspaces.output.path)/source-code/$(params.producer-modelscan-relative-path-to-model)" \
28- --reporting-format json \
29- --output-file /scratch/out.json
26+ set -x
27+ set +e
28+
29+ pip install 'modelscan'
30+ modelscan --path "$(workspaces.output.path)/source-code/$(params.producer-modelscan-relative-path-to-model)" --reporting-format json --output-file /scratch/out.json
31+
32+ echo 'outfile:'
33+ cat /scratch/out.json
3034
3135 exitCode=$?
3236 if [[ $exitCode -eq 1 ]]; then
3337 echo "ModelScan found vulnerabilities"
3438 exit 0
35- else if [[ $exitCode -eq 2 ]]; then
39+ elif [[ $exitCode -eq 2 ]]; then
3640 echo "ModelScan failed, error while scanning"
3741 exit $exitCode
38- else if [[ $exitCode -eq 3 ]]; then
42+ elif [[ $exitCode -eq 3 ]]; then
3943 echo "ModelScan did not find any supported files while scanning"
4044 exit $exitCode
41- else if [[ $exitCode -eq 4 ]]; then
45+ elif [[ $exitCode -eq 4 ]]; then
4246 echo "ModelScan encountered an error whle parsing CLI variables, the task definition has a bug"
4347 exit $exitCode
48+ elif [[ $exitCode -eq 0 ]]; then
49+ echo "ModelScan did not find any vulnerabilities"
50+ exit $exitCode
51+ else
52+ echo "Received unexpected exit code, exiting"
53+ exit $exitCode
4454 fi
4555 volumeMounts :
4656 - mountPath : /scratch
4757 name : scratch
4858 - name : produce-issues
49- imagePullPolicy : IfNotPresent
50- image : ' {{ default "ghcr.io/ocurity/dracon" .Values.image.registry }}/components/producers/modelscan:{{ .Chart.AppVersion }}'
59+ imagePullPolicy : Always
60+ # image: '{{ default "ghcr.io/ocurity/dracon" .Values.image.registry }}/components/producers/modelscan:{{ .Chart.AppVersion }}'
61+ image : kind-registry:5000/components/producers/modelscan:v0.52.1-dad26e45-dirty
62+
5163 command : ["/app/components/producers/modelscan/modelscan-parser"]
5264 args :
5365 - " -in=/scratch/out.json"
0 commit comments