Skip to content

Commit 1a4f7e9

Browse files
committed
fail build even if violation context was provided
1 parent cefe5e2 commit 1a4f7e9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

commands/scan/scan.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,9 @@ func (scanCmd *ScanCommand) RunAndRecordResults(cmdType utils.CommandType, recor
269269
if err = cmdResults.GetErrors(); err != nil {
270270
return
271271
}
272+
// If violation context was proivded it means that context was provided, so we need to check for build violations.
272273
// If user provided --fail=false, don't fail the build.
273-
if scanCmd.fail {
274+
if scanCmd.fail && scanCmd.resultsContext.HasViolationContext() {
274275
if results.CheckIfFailBuild(cmdResults.GetScaScansXrayResults()) {
275276
return results.NewFailBuildError()
276277
}

0 commit comments

Comments
 (0)