use of org.jfrog.build.extractor.clientConfiguration.client.artifactory.ArtifactoryManager in project build-info by JFrogDev.
the class PipInstall method execute.
public BuildInfo execute() {
try (ArtifactoryManager artifactoryManager = artifactoryManagerBuilder.build()) {
validateRepoExists(artifactoryManager, repo, "Source repo must be specified");
String artifactoryUrlWithCredentials = PackageManagerUtils.createArtifactoryUrlWithCredentials(artifactoryManager.getUrl(), username, password, ARTIFACTORY_PIP_API_START + repo + ARTIFACTORY_PIP_API_END);
// Run pip install with URL and get output.
String installLog = pipDriver.install(path.toFile(), artifactoryUrlWithCredentials, installArgs, logger);
logger.info(installLog);
// Parse output and get all dependencies.
PipBuildInfoExtractor buildInfoExtractor = new PipBuildInfoExtractor();
try {
return buildInfoExtractor.extract(artifactoryManager, repo, installLog, path, module, logger);
} catch (IOException e) {
throw new IOException("Build info collection failed", e);
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
throw new RuntimeException(e);
}
}
use of org.jfrog.build.extractor.clientConfiguration.client.artifactory.ArtifactoryManager in project build-info by JFrogDev.
the class NpmPublish method execute.
@Override
public BuildInfo execute() {
try (ArtifactoryManager artifactoryManager = artifactoryManagerBuilder.build()) {
this.artifactoryManager = artifactoryManager;
preparePrerequisites();
if (!tarballProvided) {
pack();
}
deploy();
if (!tarballProvided) {
deleteCreatedTarball();
}
return createBuild();
} catch (Exception e) {
logger.error(e.getMessage(), e);
throw new RuntimeException(e);
}
}
use of org.jfrog.build.extractor.clientConfiguration.client.artifactory.ArtifactoryManager in project build-info by JFrogDev.
the class NugetRun method prepareAndRunCmd.
private void prepareAndRunCmd() throws Exception {
try (ArtifactoryManager artifactoryManager = artifactoryManagerBuilder.build()) {
List<String> extraArgs = new ArrayList<>();
File configFile = prepareConfig(artifactoryManager);
if (configFile != null) {
String configPath = configFile.getAbsolutePath();
extraArgs = StringUtils.isBlank(configPath) ? null : Arrays.asList(toolchainDriver.getFlagSyntax(ToolchainDriverBase.CONFIG_FILE_FLAG), configPath);
}
toolchainDriver.runCmd(nugetCmdArgs, extraArgs, null, true);
}
}
use of org.jfrog.build.extractor.clientConfiguration.client.artifactory.ArtifactoryManager in project build-info by JFrogDev.
the class ArtifactoryManagerBuilder method build.
@Override
public ArtifactoryManager build() {
ArtifactoryManager client = new ArtifactoryManager(serverUrl, username, password, accessToken, log);
build(client);
return client;
}
use of org.jfrog.build.extractor.clientConfiguration.client.artifactory.ArtifactoryManager in project build-info by JFrogDev.
the class SpecsHelper method uploadArtifactsBySpec.
/**
* Upload artifacts according to a given spec, return a list describing the deployed items.
*
* @param uploadSpec The required spec represented as String
* @param numberOfThreads Number of concurrent threads to use for handling uploads
* @param workspace File object that represents the workspace
* @param buildProperties Upload properties
* @param artifactoryManagerBuilder ArtifactoryManagerBuilder which will build the ArtifactoryManager per the number of passed threads number to perform the actual upload
* @return Set of DeployDetails that was calculated from the given params
* @throws IOException Thrown if any error occurs while reading the file, calculating the
* checksums or in case of any file system exception
*/
public List<Artifact> uploadArtifactsBySpec(String uploadSpec, int numberOfThreads, File workspace, Multimap<String, String> buildProperties, ArtifactoryManagerBuilder artifactoryManagerBuilder) throws Exception {
FileSpec fileSpec = FileSpec.fromString(uploadSpec);
FileSpecsValidation.validateUploadFileSpec(fileSpec, this.log);
try (ArtifactoryManager artifactoryManager = artifactoryManagerBuilder.build()) {
// Create producer Runnable
ProducerRunnableBase[] producerRunnable = new ProducerRunnableBase[] { new SpecDeploymentProducer(fileSpec, workspace, buildProperties) };
// Create consumer Runnables
ConsumerRunnableBase[] consumerRunnables = new ConsumerRunnableBase[numberOfThreads];
for (int i = 0; i < numberOfThreads; i++) {
consumerRunnables[i] = new SpecDeploymentConsumer(artifactoryManager);
}
// Create the deployment executor
ProducerConsumerExecutor deploymentExecutor = new ProducerConsumerExecutor(log, producerRunnable, consumerRunnables, CONNECTION_POOL_SIZE);
deploymentExecutor.start();
Set<DeployDetails> deployedArtifacts = ((SpecDeploymentProducer) producerRunnable[0]).getDeployedArtifacts();
return convertDeployDetailsToArtifacts(deployedArtifacts);
}
}
Aggregations