use of com.blackducksoftware.integration.util.CIEnvironmentVariables in project hub-docker-inspector by blackducksoftware.
the class HubClient method phoneHomeNoHubConnection.
private void phoneHomeNoHubConnection(final String dockerEngineVersion) {
try {
final IntLogger intLogger = new Slf4jIntLogger(logger);
final ProxyInfo proxyInfo = new ProxyInfo(config.getHubProxyHost(), Integer.parseInt(config.getHubProxyPort()), new Credentials(config.getHubProxyUsername(), config.getHubProxyPassword()), null, null, null);
final boolean alwaysTrustServerCertificate = config.isHubAlwaysTrustCert();
final PhoneHomeClient phClient = new PhoneHomeClient(intLogger, 15, proxyInfo, alwaysTrustServerCertificate);
final Map<String, String> infoMap = new HashMap<>();
infoMap.put("blackDuckName", BlackDuckName.HUB.getName());
infoMap.put("blackDuckVersion", "None");
infoMap.put("thirdPartyName", THIRD_PARTY_NAME_DOCKER);
infoMap.put("thirdPartyVersion", dockerEngineVersion);
infoMap.put("pluginVersion", programVersion.getProgramVersion());
if (!StringUtils.isBlank(config.getCallerName())) {
infoMap.put(PHONE_HOME_METADATA_NAME_CALLER_NAME, config.getCallerName());
}
if (!StringUtils.isBlank(config.getCallerVersion())) {
infoMap.put(PHONE_HOME_METADATA_NAME_CALLER_VERSION, config.getCallerVersion());
}
final PhoneHomeRequestBody phoneHomeRequestBody = new PhoneHomeRequestBody("None", "Integrations", infoMap);
phClient.postPhoneHomeRequest(phoneHomeRequestBody, new CIEnvironmentVariables());
} catch (final Throwable t) {
logger.debug(String.format("Unable to phone home: %s", t.getMessage()));
}
}
use of com.blackducksoftware.integration.util.CIEnvironmentVariables in project hub-detect by blackducksoftware.
the class OfflineScanner method offlineScan.
boolean offlineScan(final DetectProject detectProject, final HubScanConfig hubScanConfig, final String hubSignatureScannerOfflineLocalPath) throws IllegalArgumentException, IntegrationException, DetectUserFriendlyException, InterruptedException {
final IntLogger intLogger = new Slf4jIntLogger(logger);
final HubServerConfig hubServerConfig = new HubServerConfig(null, 0, (String) null, null, false, new UriCombiner());
final CIEnvironmentVariables ciEnvironmentVariables = new CIEnvironmentVariables();
ciEnvironmentVariables.putAll(System.getenv());
final SimpleScanUtility simpleScanUtility = new SimpleScanUtility(intLogger, gson, hubServerConfig, ciEnvironmentVariables, hubScanConfig, detectProject.getProjectName(), detectProject.getProjectVersionName());
CLILocation cliLocation = new CLILocation(intLogger, hubScanConfig.getToolsDir());
if (StringUtils.isNotBlank(hubSignatureScannerOfflineLocalPath)) {
cliLocation = new OfflineCLILocation(intLogger, new File(hubSignatureScannerOfflineLocalPath));
}
boolean cliInstalledOkay = checkCliInstall(cliLocation, intLogger);
if (!cliInstalledOkay && StringUtils.isNotBlank(detectConfiguration.getHubSignatureScannerHostUrl())) {
installSignatureScannerFromUrl(intLogger, hubScanConfig, ciEnvironmentVariables);
cliInstalledOkay = checkCliInstall(cliLocation, intLogger);
}
if (!cliInstalledOkay && StringUtils.isNotBlank(hubSignatureScannerOfflineLocalPath)) {
OfflineScanner.logger.warn(String.format("The signature scanner is not correctly installed at %s", hubSignatureScannerOfflineLocalPath));
return false;
} else if (!cliInstalledOkay) {
OfflineScanner.logger.warn(String.format("The signature scanner is not correctly installed at %s", hubScanConfig.getToolsDir()));
return false;
} else {
simpleScanUtility.setupAndExecuteScan(cliLocation);
OfflineScanner.logger.info(String.format("The scan dry run files can be found in : %s", simpleScanUtility.getDataDirectory()));
return true;
}
}
Aggregations