Search in sources :

Example 1 with CheckmarxScanSupport

use of com.mercedesbenz.sechub.adapter.checkmarx.support.CheckmarxScanSupport in project sechub by mercedes-benz.

the class CheckmarxAdapterV1 method uploadSourceCodeAndStartScan.

private void uploadSourceCodeAndStartScan(CheckmarxOAuthSupport oauthSupport, CheckmarxContext context) throws AdapterException {
    AdapterMetaData metaData = context.getRuntimeContext().getMetaData();
    if (!metaData.hasValue(CheckmarxMetaDataID.KEY_FILEUPLOAD_DONE, true)) {
        /* upload source code */
        oauthSupport.refreshBearerTokenWhenNecessary(context);
        CheckmarxUploadSupport uploadSupport = new CheckmarxUploadSupport();
        uploadSupport.uploadZippedSourceCode(context);
        /* after this - mark file upload done, so on a restart we don't need this */
        metaData.setValue(CheckmarxMetaDataID.KEY_FILEUPLOAD_DONE, true);
        context.getRuntimeContext().getCallback().persist(metaData);
    } else {
        LOG.info("Reuse existing upload for:{}", context.getTraceID());
    }
    /* start scan */
    CheckmarxScanSupport scanSupport = new CheckmarxScanSupport();
    scanSupport.startNewScan(oauthSupport, context);
}
Also used : CheckmarxScanSupport(com.mercedesbenz.sechub.adapter.checkmarx.support.CheckmarxScanSupport) CheckmarxUploadSupport(com.mercedesbenz.sechub.adapter.checkmarx.support.CheckmarxUploadSupport) AdapterMetaData(com.mercedesbenz.sechub.adapter.AdapterMetaData)

Aggregations

AdapterMetaData (com.mercedesbenz.sechub.adapter.AdapterMetaData)1 CheckmarxScanSupport (com.mercedesbenz.sechub.adapter.checkmarx.support.CheckmarxScanSupport)1 CheckmarxUploadSupport (com.mercedesbenz.sechub.adapter.checkmarx.support.CheckmarxUploadSupport)1