Search in sources :

Example 6 with PullRequestReport

use of com.checkmarx.flow.dto.report.PullRequestReport in project cx-flow by checkmarx-ltd.

the class BitBucketService method setBuildEndStatus.

public void setBuildEndStatus(ScanRequest request, ScanResults results, ScanDetails scanDetails) {
    if (properties.isBlockMerge()) {
        String status = BUILD_SUCCESSFUL;
        if (!thresholdValidator.isMergeAllowed(results, properties, new PullRequestReport(scanDetails, request))) {
            status = BUILD_FAILED;
        }
        JSONObject buildStatusBody = createBuildStatusRequestBody(status, BUILD_STATUS_KEY_FOR_CXFLOW, "Checkmarx Scan Results", results.getLink(), results.getScanSummary().toString());
        sendBuildStatus(request, buildStatusBody.toString());
    }
}
Also used : PullRequestReport(com.checkmarx.flow.dto.report.PullRequestReport) JSONObject(org.json.JSONObject)

Example 7 with PullRequestReport

use of com.checkmarx.flow.dto.report.PullRequestReport in project cx-flow by checkmarx-ltd.

the class BitBucketService method processServerMerge.

void processServerMerge(ScanRequest request, ScanResults results, ScanDetails scanDetails) throws BitBucketClientException {
    try {
        String comment = HTMLHelper.getMergeCommentMD(request, results, properties);
        log.debug(LOG_COMMENT, comment);
        if (properties.isBlockMerge()) {
            if (thresholdValidator.isMergeAllowed(results, properties, new PullRequestReport(scanDetails, request))) {
                sendServerMergeComment(request, comment);
            } else {
                sendServerMergeTask(request, comment);
            }
        } else {
            sendServerMergeComment(request, comment);
        }
    } catch (HttpClientErrorException e) {
        log.error("Error occurred while creating Merge Request comment", e);
        throw new BitBucketClientException();
    }
}
Also used : PullRequestReport(com.checkmarx.flow.dto.report.PullRequestReport) HttpClientErrorException(org.springframework.web.client.HttpClientErrorException) BitBucketClientException(com.checkmarx.flow.exception.BitBucketClientException)

Aggregations

PullRequestReport (com.checkmarx.flow.dto.report.PullRequestReport)7 FindingSeverity (com.checkmarx.flow.config.FindingSeverity)1 RepoProperties (com.checkmarx.flow.config.RepoProperties)1 CreateWorkItemAttr (com.checkmarx.flow.dto.azure.CreateWorkItemAttr)1 BitBucketClientException (com.checkmarx.flow.exception.BitBucketClientException)1 ScanResults (com.checkmarx.sdk.dto.ScanResults)1 Then (io.cucumber.java.en.Then)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 JSONObject (org.json.JSONObject)1 HttpEntity (org.springframework.http.HttpEntity)1 HttpClientErrorException (org.springframework.web.client.HttpClientErrorException)1