Skip to content

Instantly share code, notes, and snippets.

Last active Jul 3, 2020
What would you like to do?
Jenkins step to run Yarn Audit exiting only on critical level vulnerabilities
// Run yarn audit and only exit 0 on critical vulnerabilities (greater than 8)
// Credit:
stage('Node dependencies') {
steps {
sh script: '/bin/bash -c "yarn audit; [[ $? -ge 8 ]] && exit 1 || exit 0"', label: "Vulnerability audit"
sh script: 'yarn', label: 'Install dependencies'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment