Reputation: 1477
I want to create a VSTS build with npm package auditing capabilities using npm audit. I added a few tasks to run npm audit. The command runs and I can see the details in the console/logs for all the packages. However, the task fails complaining about not finding a logs file. Any idea on how I can get the builds to stop working if I find a high vulnerability package?
EDIT This is the final line in the result when I run npm audit locally Notice how it displays vulnerabilities in categories. I want the build to not proceed if there is a non-zero value for High vulnerability.
Upvotes: 7
Views: 19230
Reputation: 5081
I got the same error, but then realize that I am using incorrect custom command for npm task:
it was "npm install gulp -g
", but should be "install gulp -g
" (without npm).
For me it helps.
Upvotes: 13
Reputation: 33698
There isn’t the way to stop/fail build directly if there is a non-zero value for High vulnerability.
The workaround is that you can do it through PowerShell with Build log REST api to analysis whether there is related information in the log, then fail the build (Write-error …) (Run the powershell through PowerShell task)
Upvotes: 0