Skip to content

Commit

Permalink
CXFLW-979 Opting Out of Bitbucket comment notifications during (#1346)
Browse files Browse the repository at this point in the history
Co-authored-by: Satyam Chaurasia <[email protected]>
  • Loading branch information
1 parent 67a5c03 commit 9d9e431
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
1 change: 0 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/com/checkmarx/flow/dto/ScanRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,11 +276,13 @@ private void overrideMainProperties(Optional<CxConfig> 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);
}
Expand Down

0 comments on commit 9d9e431

Please sign in to comment.