Skip to content

Commit 4301f95

Browse files
author
Vitaly Korolev
committed
Add BlackDuck scan
1 parent 17d09c9 commit 4301f95

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

Jenkinsfile

+5
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,11 @@ void imageScan() {
147147
}
148148

149149
sh '''rm -f dep-image-scan.txt'''
150+
151+
// trigger BlackDuck scan
152+
def rawImageList = readFile(file: 'helm_image.list').trim()
153+
def imageList = rawImageList.endsWith(',') ? rawImageList[0..-2] : rawImageList
154+
build job: 'securityscans/Blackduck/cloud/kubernetes-helm', wait: false, parameters: [ string(name: 'branch', value: "${env.BRANCH_NAME}"), string(name: 'CONTAINER_IMAGES', value: "${imageList}") ]
150155
}
151156

152157
void publishTestResults() {

makefile

+2
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,10 @@ upgrade-test: prepare
233233
.PHONY: image-scan
234234
image-scan:
235235

236+
@rm -f helm_image.list dep-image-scan.txt
236237
@echo "=====Scan dependent Docker images in charts/values.yaml" $(if $(saveOutput), | tee -a dep-image-scan.txt,)
237238
@for depImage in $(shell grep -E "^\s*\bimage:\s+(.*)" charts/values.yaml | sed 's/image: //g' | sed 's/"//g'); do\
239+
echo -n "$${depImage}," >> helm_image.list ; \
238240
echo "= $${depImage}:" $(if $(saveOutput), | tee -a dep-image-scan.txt,) ; \
239241
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock anchore/grype:latest --output json $${depImage} | jq -r '[(.matches[] | [.artifact.name, .artifact.version, .vulnerability.id, .vulnerability.severity])] | .[] | @tsv' | sort -k4 | column -t $(if $(saveOutput), | tee -a dep-image-scan.txt,);\
240242
echo $(if $(saveOutput), | tee -a dep-image-scan.txt,) ;\

0 commit comments

Comments
 (0)