diff --git a/build.gradle b/build.gradle index c1769844c..dcecbabe2 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,6 @@ import org.gradle.api.tasks.testing.Test buildscript { ext { - CxSBSDK = "0.6.7" ConfigProviderVersion = '1.0.14' //cxVersion = "8.90.5" diff --git a/src/main/java/com/checkmarx/flow/dto/ScanRequest.java b/src/main/java/com/checkmarx/flow/dto/ScanRequest.java index 57b78930a..83fd9e027 100644 --- a/src/main/java/com/checkmarx/flow/dto/ScanRequest.java +++ b/src/main/java/com/checkmarx/flow/dto/ScanRequest.java @@ -19,6 +19,11 @@ @NoArgsConstructor @AllArgsConstructor public class ScanRequest { + + @Getter @Setter + @Builder.Default + private Boolean scanSubmittedComment = true; + private String id; private String namespace; private String application; diff --git a/src/main/java/com/checkmarx/flow/service/BugTrackerEventTrigger.java b/src/main/java/com/checkmarx/flow/service/BugTrackerEventTrigger.java index 02d5b2eff..200c8ae72 100644 --- a/src/main/java/com/checkmarx/flow/service/BugTrackerEventTrigger.java +++ b/src/main/java/com/checkmarx/flow/service/BugTrackerEventTrigger.java @@ -36,43 +36,43 @@ public BugTracker.Type triggerScanStartedEvent(ScanRequest request) { switch (bugTrackerType) { case GITLABMERGE: - if (gitLabService.isScanSubmittedComment()) { + if (gitLabService.isScanSubmittedComment() && request.getScanSubmittedComment()) { gitLabService.sendMergeComment(request, SCAN_MESSAGE,gitLabService.isCommentUpdate()); } gitLabService.startBlockMerge(request); break; case GITLABCOMMIT: - if (gitLabService.isScanSubmittedComment()) { + if (gitLabService.isScanSubmittedComment() && request.getScanSubmittedComment()) { gitLabService.sendCommitComment(request, SCAN_MESSAGE); } break; case GITHUBPULL: - if (gitService.isScanSubmittedComment()) { + if (gitService.isScanSubmittedComment() && request.getScanSubmittedComment()) { gitService.sendMergeComment(request, SCAN_MESSAGE,gitService.isCommentUpdate()); } gitService.startBlockMerge(request, cxProperties.getUrl()); break; case BITBUCKETPULL: - if (bbService.isScanSubmittedComment()) { + if (bbService.isScanSubmittedComment() && request.getScanSubmittedComment()) { bbService.sendMergeComment(request, SCAN_MESSAGE); } break; case BITBUCKETSERVERPULL: - if (bbService.isScanSubmittedComment()) { + if (bbService.isScanSubmittedComment() && request.getScanSubmittedComment()) { bbService.sendServerMergeComment(request, SCAN_MESSAGE); } bbService.setBuildStartStatus(request); break; case ADOPULL: - if (adoService.isScanSubmittedComment()) { + if (adoService.isScanSubmittedComment() && request.getScanSubmittedComment()) { adoService.sendMergeComment(request, SCAN_MESSAGE); + adoService.startBlockMerge(request); } - adoService.startBlockMerge(request); break; case JIRA: diff --git a/src/main/java/com/checkmarx/flow/service/ConfigurationOverrider.java b/src/main/java/com/checkmarx/flow/service/ConfigurationOverrider.java index 62626711f..e65fca08b 100644 --- a/src/main/java/com/checkmarx/flow/service/ConfigurationOverrider.java +++ b/src/main/java/com/checkmarx/flow/service/ConfigurationOverrider.java @@ -276,11 +276,13 @@ private void overrideMainProperties(Optional override, ScanRequest req overrideReport.put("scan configuration", scanConfiguration); }); }); - override.map(CxConfig::getCustomFields).ifPresent(s -> request.setCxFields(s)); - override.map(CxConfig::getScanCustomFields).ifPresent(s -> request.setScanFields(s)); - override.map(CxConfig::getEmailNotifications).ifPresent(s -> request.setEmailNotifications(s)); + override.map(CxConfig::getCustomFields).ifPresent(request::setCxFields); + override.map(CxConfig::getScanSubmittedComment).ifPresent(request::setScanSubmittedComment); - override.map(CxConfig::getPostActionPostbackId).ifPresent(t -> request.setPostBackActionId(t)); + override.map(CxConfig::getScanCustomFields).ifPresent(request::setScanFields); + override.map(CxConfig::getEmailNotifications).ifPresent(request::setEmailNotifications); + + override.map(CxConfig::getPostActionPostbackId).ifPresent(request::setPostBackActionId); overrideUsingConfigProvider(override, overrideReport, request); }