use of com.checkmarx.flow.custom.GitHubIssueTracker in project cx-flow by checkmarx-ltd.
the class IastService method createIssue.
private void createIssue(ScanVulnerabilities scanVulnerabilities, ScanRequest request, ResultInfo scansResultQuery, VulnerabilityInfo vulnerability, Scan scan) {
try {
Issue issue;
IssueTracker issueTracker;
boolean htmlDescription = false;
switch(request.getBugTracker().getType()) {
case JIRA:
String jiraIssue = postIssueToJira(scanVulnerabilities, request, scansResultQuery, vulnerability, scan);
if (jiraService.getJiraProperties() != null) {
log.info("Create jira issue: " + jiraService.getJiraProperties().getUrl() + "/browse/" + jiraIssue);
}
// jiraService is not an instance of IssueTracker, because of that the "return" here is a shortcut to stop the execution
return;
case GITHUBCOMMIT:
issueTracker = gitHubIssueTracker;
break;
case GITLABCOMMIT:
issueTracker = gitLabIssueTracker;
break;
case adopull:
case ADOPULL:
issueTracker = azureIssueTracker;
htmlDescription = true;
request.putAdditionalMetadata(Constants.ADO_ISSUE_BODY_KEY, "Description");
request.putAdditionalMetadata(Constants.ADO_ISSUE_KEY, adoProperties.getIssueType());
break;
default:
throw new NotImplementedException(request.getBugTracker().getType().getType() + ". That bug tracker not implemented.");
}
issue = postIssueToTracker(scanVulnerabilities, request, scansResultQuery, vulnerability, scan, issueTracker, htmlDescription);
log.info("Create {} issue: {}", request.getBugTracker().getType().getType(), issue.getUrl());
} catch (MachinaException e) {
log.error("Problem with creating issue.", e);
} catch (RuntimeException e) {
throw new IastBugTrackerClientException("Can't create issue", e);
}
}
use of com.checkmarx.flow.custom.GitHubIssueTracker in project cx-flow by checkmarx-ltd.
the class IastCliSteps method checkHowManyCreateIssue.
@SneakyThrows
@Then("check how many create issue {} {}")
public void checkHowManyCreateIssue(String createIssue, String bugTracker) {
int createdIssues = Integer.parseInt(removeQuotes(createIssue));
IssueTracker issueTracker = null;
switch(bugTracker) {
case "jira":
verify(jiraService, times(createdIssues)).createIssue(any(), any());
return;
case "github":
issueTracker = gitHubIssueTracker;
break;
case "gitlab":
issueTracker = gitLabIssueTracker;
break;
case "ado":
issueTracker = adoIssueTracker;
break;
}
if (issueTracker != null) {
verify(issueTracker, times(createdIssues)).createIssue(any(), any());
}
}
Aggregations