Search in sources :

Example 6 with SignatureScannerReport

use of com.synopsys.integration.detect.tool.signaturescanner.SignatureScannerReport 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)

Example 7 with SignatureScannerReport

use of com.synopsys.integration.detect.tool.signaturescanner.SignatureScannerReport in project synopsys-detect by blackducksoftware.

the class CreateSignatureScanReports method reportResults.

public List<SignatureScannerReport> reportResults(List<SignatureScanPath> signatureScanPaths, List<ScanCommandOutput> scanCommandOutputList) {
    List<SignatureScannerReport> signatureScannerReports = new ArrayList<>();
    for (SignatureScanPath signatureScanPath : signatureScanPaths) {
        Optional<ScanCommandOutput> scanCommandOutput = scanCommandOutputList.stream().filter(output -> output.getScanTarget().equals(signatureScanPath.getTargetCanonicalPath())).findFirst();
        SignatureScannerReport signatureScannerReport = SignatureScannerReport.create(signatureScanPath, scanCommandOutput.orElse(null));
        signatureScannerReports.add(signatureScannerReport);
    }
    return signatureScannerReports;
}
Also used : ScanCommandOutput(com.synopsys.integration.blackduck.codelocation.signaturescanner.command.ScanCommandOutput) SignatureScannerReport(com.synopsys.integration.detect.tool.signaturescanner.SignatureScannerReport) List(java.util.List) Logger(org.slf4j.Logger) SignatureScanPath(com.synopsys.integration.detect.tool.signaturescanner.SignatureScanPath) LoggerFactory(org.slf4j.LoggerFactory) Optional(java.util.Optional) ArrayList(java.util.ArrayList) SignatureScanPath(com.synopsys.integration.detect.tool.signaturescanner.SignatureScanPath) ArrayList(java.util.ArrayList) ScanCommandOutput(com.synopsys.integration.blackduck.codelocation.signaturescanner.command.ScanCommandOutput) SignatureScannerReport(com.synopsys.integration.detect.tool.signaturescanner.SignatureScannerReport)

Aggregations

SignatureScannerReport (com.synopsys.integration.detect.tool.signaturescanner.SignatureScannerReport)7 List (java.util.List)4 Logger (org.slf4j.Logger)4 LoggerFactory (org.slf4j.LoggerFactory)4 ScanCommandOutput (com.synopsys.integration.blackduck.codelocation.signaturescanner.command.ScanCommandOutput)3 SignatureScanPath (com.synopsys.integration.detect.tool.signaturescanner.SignatureScanPath)3 Optional (java.util.Optional)3 ExitCodeType (com.synopsys.integration.detect.configuration.enumeration.ExitCodeType)2 ExitCodePublisher (com.synopsys.integration.detect.lifecycle.shutdown.ExitCodePublisher)2 ExitCodeRequest (com.synopsys.integration.detect.lifecycle.shutdown.ExitCodeRequest)2 SignatureScanStatusType (com.synopsys.integration.detect.tool.signaturescanner.enums.SignatureScanStatusType)2 DetectIssue (com.synopsys.integration.detect.workflow.status.DetectIssue)2 DetectIssueType (com.synopsys.integration.detect.workflow.status.DetectIssueType)2 SignatureScanStatus (com.synopsys.integration.detect.workflow.status.SignatureScanStatus)2 StatusEventPublisher (com.synopsys.integration.detect.workflow.status.StatusEventPublisher)2 StatusType (com.synopsys.integration.detect.workflow.status.StatusType)2 ArrayList (java.util.ArrayList)2 Arrays (java.util.Arrays)2 CodeLocationOutput (com.synopsys.integration.blackduck.codelocation.CodeLocationOutput)1 Result (com.synopsys.integration.blackduck.codelocation.Result)1