Search in sources :

Example 1 with ModuleParallelDeployHelper

use of org.jfrog.build.extractor.ModuleParallelDeployHelper in project build-info by JFrogDev.

the class BuildDeploymentHelper method deploy.

public void deploy(BuildInfo buildInfo, ArtifactoryClientConfiguration clientConf, Map<String, DeployDetails> deployableArtifactBuilders, boolean wereThereTestFailures, File basedir) {
    Map<String, Set<DeployDetails>> deployableArtifactsByModule = prepareDeployableArtifacts(buildInfo, deployableArtifactBuilders);
    logger.debug("Build Info Recorder: deploy artifacts: " + clientConf.publisher.isPublishArtifacts());
    logger.debug("Build Info Recorder: publication fork count: " + clientConf.publisher.getPublishForkCount());
    logger.debug("Build Info Recorder: publish build info: " + clientConf.publisher.isPublishBuildInfo());
    if (!StringUtils.isEmpty(clientConf.info.getGeneratedBuildInfoFilePath())) {
        try {
            BuildInfoExtractorUtils.saveBuildInfoToFile(buildInfo, new File(clientConf.info.getGeneratedBuildInfoFilePath()));
        } catch (Exception e) {
            logger.error("Failed writing build info to file: ", e);
            throw new RuntimeException("Failed writing build info to file", e);
        }
    }
    if (isDeployArtifacts(clientConf, wereThereTestFailures, deployableArtifactsByModule)) {
        try (ArtifactoryManager artifactoryManager = artifactoryManagerBuilder.resolveProperties(clientConf)) {
            new ModuleParallelDeployHelper().deployArtifacts(artifactoryManager, deployableArtifactsByModule, clientConf.publisher.getPublishForkCount());
        }
    }
    if (!StringUtils.isEmpty(clientConf.info.getDeployableArtifactsFilePath())) {
        try {
            DeployableArtifactsUtils.saveDeployableArtifactsToFile(deployableArtifactsByModule, new File(clientConf.info.getDeployableArtifactsFilePath()), false);
        } catch (Exception e) {
            logger.error("Failed writing deployable artifacts to file: ", e);
            throw new RuntimeException("Failed writing deployable artifacts to file", e);
        }
    }
    if (isPublishBuildInfo(clientConf, wereThereTestFailures)) {
        publishBuildInfo(clientConf, buildInfo);
    }
}
Also used : ArtifactoryManager(org.jfrog.build.extractor.clientConfiguration.client.artifactory.ArtifactoryManager) ModuleParallelDeployHelper(org.jfrog.build.extractor.ModuleParallelDeployHelper) File(java.io.File) IOException(java.io.IOException)

Aggregations

File (java.io.File)1 IOException (java.io.IOException)1 ModuleParallelDeployHelper (org.jfrog.build.extractor.ModuleParallelDeployHelper)1 ArtifactoryManager (org.jfrog.build.extractor.clientConfiguration.client.artifactory.ArtifactoryManager)1