forked from LiveCarta/LivecartaPipelinesSharedLibraries
Added function to run security scans of newly built images
This commit is contained in:
14
vars/secops.groovy
Normal file
14
vars/secops.groovy
Normal file
@@ -0,0 +1,14 @@
|
||||
def secScan(image) {
|
||||
sh """
|
||||
mkdir -p /var/jenkins_home/secscan_reports/${env.JOB_NAME}/
|
||||
docker run \
|
||||
-v ./trivy_cache:/root/.cache \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
aquasec/trivy \
|
||||
-f template \
|
||||
--template "@contrib/html.tpl" \
|
||||
-o /dev/stdout \
|
||||
image --exit-code 1 --severity HIGH,CRITICAL \
|
||||
${image} > /var/jenkins_home/secscan_reports/${env.JOB_NAME}/secscan_report_$$(date +"%Y%m%d_%H%M%S")_${image}.html
|
||||
"""
|
||||
}
|
||||
Reference in New Issue
Block a user