Skip to content

Commit

Permalink
fix jenkinsfile
Browse files Browse the repository at this point in the history
  • Loading branch information
pcaskey committed Aug 16, 2022
1 parent dfe5d50 commit ef78ef5
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ node('docker') {
handleError(message)
}

stage('Scan') {
steps {
stage 'Scan'

try {
// Install trivy and HTML template
sh 'curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin v0.31.1'
sh 'curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/html.tpl > html.tpl'
Expand All @@ -95,9 +96,12 @@ node('docker') {

// Scan again and fail on CRITICAL vulns
sh 'trivy image --ignore-unfixed --vuln-type os,library --exit-code 1 --severity CRITICAL ${imagename}:${tag}'

}
}
} catch(error) {
def error_details = readFile('./debug');
def message = "BUILD ERROR: There was a problem scanning ${imagename}:${tag}. \n\n ${error_details}"
sh "rm -f ./debug"
handleError(message)
}

stage 'Push'

Expand Down

0 comments on commit ef78ef5

Please sign in to comment.