Search in sources :

Example 6 with ExitCodeRequest

use of com.synopsys.integration.detect.lifecycle.shutdown.ExitCodeRequest in project synopsys-detect by blackducksoftware.

the class PublishSignatureScanReports method publishReports.

public void publishReports(List<SignatureScannerReport> signatureScannerReports) {
    signatureScannerReports.forEach(this::publishReport);
    signatureScannerReports.stream().filter(SignatureScannerReport::isFailure).findAny().ifPresent(report -> {
        logger.error(String.format("The Signature Scanner reported an error%s. The Signature Scanner log may contain relevant information.", report.getExitCode().map(code -> " (" + code + ")").orElse(".")));
        exitCodePublisher.publishExitCode(new ExitCodeRequest(ExitCodeType.FAILURE_SCAN));
    });
    if (!treatSkippedScanAsSuccess) {
        signatureScannerReports.stream().filter(SignatureScannerReport::isSkipped).findAny().ifPresent(report -> {
            logger.error("The Signature Scanner skipped a scan because the minimum scan interval was not met.");
            exitCodePublisher.publishExitCode(new ExitCodeRequest(ExitCodeType.FAILURE_MINIMUM_INTERVAL_NOT_MET));
        });
    }
}
Also used : ExitCodeType(com.synopsys.integration.detect.configuration.enumeration.ExitCodeType) Arrays(java.util.Arrays) StatusEventPublisher(com.synopsys.integration.detect.workflow.status.StatusEventPublisher) Logger(org.slf4j.Logger) DetectIssue(com.synopsys.integration.detect.workflow.status.DetectIssue) LoggerFactory(org.slf4j.LoggerFactory) SignatureScannerReport(com.synopsys.integration.detect.tool.signaturescanner.SignatureScannerReport) StatusType(com.synopsys.integration.detect.workflow.status.StatusType) List(java.util.List) DetectIssueType(com.synopsys.integration.detect.workflow.status.DetectIssueType) SignatureScanStatus(com.synopsys.integration.detect.workflow.status.SignatureScanStatus) ExitCodePublisher(com.synopsys.integration.detect.lifecycle.shutdown.ExitCodePublisher) ExitCodeRequest(com.synopsys.integration.detect.lifecycle.shutdown.ExitCodeRequest) ExitCodeRequest(com.synopsys.integration.detect.lifecycle.shutdown.ExitCodeRequest) SignatureScannerReport(com.synopsys.integration.detect.tool.signaturescanner.SignatureScannerReport)

Aggregations

ExitCodeRequest (com.synopsys.integration.detect.lifecycle.shutdown.ExitCodeRequest)6 ExitCodeType (com.synopsys.integration.detect.configuration.enumeration.ExitCodeType)3 EventSystem (com.synopsys.integration.detect.workflow.event.EventSystem)3 ExceptionUtility (com.synopsys.integration.detect.lifecycle.shutdown.ExceptionUtility)2 ExitCodeManager (com.synopsys.integration.detect.lifecycle.shutdown.ExitCodeManager)2 ExitCodePublisher (com.synopsys.integration.detect.lifecycle.shutdown.ExitCodePublisher)2 DetectCodeLocation (com.synopsys.integration.detect.workflow.codelocation.DetectCodeLocation)2 DetectIssue (com.synopsys.integration.detect.workflow.status.DetectIssue)2 DetectStatusManager (com.synopsys.integration.detect.workflow.status.DetectStatusManager)2 StatusEventPublisher (com.synopsys.integration.detect.workflow.status.StatusEventPublisher)2 StatusType (com.synopsys.integration.detect.workflow.status.StatusType)2 CodeLocation (com.synopsys.integration.detectable.detectable.codelocation.CodeLocation)2 NameVersion (com.synopsys.integration.util.NameVersion)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Test (org.junit.jupiter.api.Test)2 Logger (org.slf4j.Logger)2 LoggerFactory (org.slf4j.LoggerFactory)2 JsonSyntaxException (com.google.gson.JsonSyntaxException)1 MissingExternalIdException (com.synopsys.integration.bdio.graph.builder.MissingExternalIdException)1