68
68
}
69
69
70
70
dockerImageScan () {
71
- # TODO check feasibility of mount/mountWithLayers
72
71
IMAGE=" ${BUILDKITE_PLUGIN_WIZ_IMAGE_ADDRESS:- } "
73
72
# make sure local docker has the image
74
73
docker pull " $IMAGE "
75
74
docker run \
76
75
--rm -it \
76
+ --cap-add SYS_ADMIN \
77
77
--mount type=bind,src=" $WIZ_DIR " ,dst=/cli,readonly \
78
78
--mount type=bind,src=" $PWD " ,dst=/scan \
79
- --mount type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock,readonly \
79
+ --mount type=bind,src=/var/lib/docker,dst=/var/lib/docker \
80
+ --mount type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock \
80
81
wiziocli.azurecr.io/wizcli:latest-amd64 \
81
82
docker scan --image " $IMAGE " \
83
+ --driver mount \
82
84
--policy-hits-only \
83
85
-f human \
84
86
-o /scan/docker-scan-result,human,true
@@ -88,7 +90,9 @@ dockerImageScan() {
88
90
# buildkite-agent artifact upload docker-scan-result --log-level info
89
91
case $exit_code in
90
92
0)
91
- buildAnnotation " docker" " $image_name " true " $PWD /docker-scan-result" | buildkite-agent annotate --append --style ' success' --context ' ctx-wiz-docker-success'
93
+ if [[ -n " ${BUILDKITE_PLUGIN_WIZ_ANNOTATE_SUCCESS} " ]]; then
94
+ buildAnnotation " docker" " $image_name " true " $PWD /docker-scan-result" | buildkite-agent annotate --append --style ' success' --context ' ctx-wiz-docker-success'
95
+ fi
92
96
exit 0
93
97
;;
94
98
* )
@@ -114,7 +118,9 @@ iacScan() {
114
118
exit_code=" $? "
115
119
case $exit_code in
116
120
0)
117
- buildAnnotation " iac" " $BUILDKITE_LABEL " true " $PWD /result/output" | buildkite-agent annotate --append --context ' ctx-wiz-iac-success' --style ' success'
121
+ if [[ -n " ${BUILDKITE_PLUGIN_WIZ_ANNOTATE_SUCCESS} " ]]; then
122
+ buildAnnotation " iac" " $BUILDKITE_LABEL " true " $PWD /result/output" | buildkite-agent annotate --append --context ' ctx-wiz-iac-success' --style ' success'
123
+ fi
118
124
;;
119
125
* )
120
126
buildAnnotation " iac" " $BUILDKITE_LABEL " false " $PWD /result/output" | buildkite-agent annotate --append --context ' ctx-wiz-iac-warning' --style ' warning'
0 commit comments