Search in sources :

Example 1 with CodeLocationAccumulator

use of com.synopsys.integration.detect.workflow.blackduck.codelocation.CodeLocationAccumulator in project synopsys-detect by blackducksoftware.

the class IntelligentModeStepRunner method runOnline.

// TODO: Change black duck post options to a decision and stick it in Run Data somewhere.
// TODO: Change detect tool filter to a decision and stick it in Run Data somewhere
public void runOnline(BlackDuckRunData blackDuckRunData, BdioResult bdioResult, NameVersion projectNameVersion, DetectToolFilter detectToolFilter, DockerTargetData dockerTargetData) throws OperationException {
    ProjectVersionWrapper projectVersion = stepHelper.runAsGroup("Create or Locate Project", OperationType.INTERNAL, () -> new BlackDuckProjectVersionStepRunner(operationFactory).runAll(projectNameVersion, blackDuckRunData));
    logger.debug("Completed project and version actions.");
    logger.debug("Processing Detect Code Locations.");
    CodeLocationAccumulator codeLocationAccumulator = new CodeLocationAccumulator();
    stepHelper.runAsGroup("Upload Bdio", OperationType.INTERNAL, () -> uploadBdio(blackDuckRunData, bdioResult, codeLocationAccumulator, operationFactory.calculateDetectTimeout()));
    logger.debug("Completed Detect Code Location processing.");
    stepHelper.runToolIfIncluded(DetectTool.SIGNATURE_SCAN, "Signature Scanner", () -> {
        SignatureScanStepRunner signatureScanStepRunner = new SignatureScanStepRunner(operationFactory);
        SignatureScannerCodeLocationResult signatureScannerCodeLocationResult = signatureScanStepRunner.runSignatureScannerOnline(blackDuckRunData, projectNameVersion, dockerTargetData);
        codeLocationAccumulator.addWaitableCodeLocations(signatureScannerCodeLocationResult.getWaitableCodeLocationData());
        codeLocationAccumulator.addNonWaitableCodeLocation(signatureScannerCodeLocationResult.getNonWaitableCodeLocationData());
    });
    stepHelper.runToolIfIncluded(DetectTool.BINARY_SCAN, "Binary Scanner", () -> {
        BinaryScanStepRunner binaryScanStepRunner = new BinaryScanStepRunner(operationFactory);
        binaryScanStepRunner.runBinaryScan(dockerTargetData, projectNameVersion, blackDuckRunData).ifPresent(codeLocationAccumulator::addWaitableCodeLocations);
    });
    stepHelper.runToolIfIncludedWithCallbacks(DetectTool.IMPACT_ANALYSIS, "Vulnerability Impact Analysis", () -> runImpactAnalysisOnline(projectNameVersion, projectVersion, codeLocationAccumulator, blackDuckRunData.getBlackDuckServicesFactory()), operationFactory::publishImpactSuccess, operationFactory::publishImpactFailure);
    stepHelper.runAsGroup("Wait for Results", OperationType.INTERNAL, () -> {
        CodeLocationResults codeLocationResults = calculateCodeLocations(codeLocationAccumulator);
        waitForCodeLocations(codeLocationResults.getCodeLocationWaitData(), projectNameVersion, blackDuckRunData);
    });
    stepHelper.runAsGroup("Black Duck Post Actions", OperationType.INTERNAL, () -> {
        checkPolicy(projectVersion.getProjectVersionView(), blackDuckRunData);
        riskReport(blackDuckRunData, projectVersion);
        noticesReport(blackDuckRunData, projectVersion);
        publishPostResults(bdioResult, projectVersion, detectToolFilter);
    });
}
Also used : SignatureScannerCodeLocationResult(com.synopsys.integration.detect.tool.signaturescanner.SignatureScannerCodeLocationResult) ProjectVersionWrapper(com.synopsys.integration.blackduck.service.model.ProjectVersionWrapper) CodeLocationResults(com.synopsys.integration.detect.workflow.blackduck.codelocation.CodeLocationResults) CodeLocationAccumulator(com.synopsys.integration.detect.workflow.blackduck.codelocation.CodeLocationAccumulator)

Aggregations

ProjectVersionWrapper (com.synopsys.integration.blackduck.service.model.ProjectVersionWrapper)1 SignatureScannerCodeLocationResult (com.synopsys.integration.detect.tool.signaturescanner.SignatureScannerCodeLocationResult)1 CodeLocationAccumulator (com.synopsys.integration.detect.workflow.blackduck.codelocation.CodeLocationAccumulator)1 CodeLocationResults (com.synopsys.integration.detect.workflow.blackduck.codelocation.CodeLocationResults)1