Search in sources :

Example 6 with ArtifactoryManager

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);
    }
}
Also used : ArtifactoryManager(org.jfrog.build.extractor.clientConfiguration.client.artifactory.ArtifactoryManager) IOException(java.io.IOException) IOException(java.io.IOException)

Example 7 with ArtifactoryManager

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);
    }
}
Also used : ArtifactoryManager(org.jfrog.build.extractor.clientConfiguration.client.artifactory.ArtifactoryManager) IOException(java.io.IOException) VersionException(org.jfrog.build.util.VersionException)

Example 8 with ArtifactoryManager

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);
    }
}
Also used : ArtifactoryManager(org.jfrog.build.extractor.clientConfiguration.client.artifactory.ArtifactoryManager) File(java.io.File)

Example 9 with ArtifactoryManager

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;
}
Also used : ArtifactoryManager(org.jfrog.build.extractor.clientConfiguration.client.artifactory.ArtifactoryManager)

Example 10 with ArtifactoryManager

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);
    }
}
Also used : ProducerConsumerExecutor(org.jfrog.build.extractor.producerConsumer.ProducerConsumerExecutor) DeployDetails(org.jfrog.build.extractor.clientConfiguration.deploy.DeployDetails) FileSpec(org.jfrog.filespecs.FileSpec) ArtifactoryManager(org.jfrog.build.extractor.clientConfiguration.client.artifactory.ArtifactoryManager) ProducerRunnableBase(org.jfrog.build.extractor.producerConsumer.ProducerRunnableBase) ConsumerRunnableBase(org.jfrog.build.extractor.producerConsumer.ConsumerRunnableBase)

Aggregations

ArtifactoryManager (org.jfrog.build.extractor.clientConfiguration.client.artifactory.ArtifactoryManager)21 IOException (java.io.IOException)11 File (java.io.File)3 ArtifactoryClientConfiguration (org.jfrog.build.extractor.clientConfiguration.ArtifactoryClientConfiguration)3 DeployDetails (org.jfrog.build.extractor.clientConfiguration.deploy.DeployDetails)3 ModuleBuilder (org.jfrog.build.extractor.builder.ModuleBuilder)2 BuildInfo (org.jfrog.build.extractor.ci.BuildInfo)2 IncludeExcludePatterns (org.jfrog.build.extractor.clientConfiguration.IncludeExcludePatterns)2 ConsumerRunnableBase (org.jfrog.build.extractor.producerConsumer.ConsumerRunnableBase)2 ProducerConsumerExecutor (org.jfrog.build.extractor.producerConsumer.ProducerConsumerExecutor)2 ProducerRunnableBase (org.jfrog.build.extractor.producerConsumer.ProducerRunnableBase)2 Serializable (java.io.Serializable)1 java.util (java.util)1 Date (java.util.Date)1 Map (java.util.Map)1 Collectors (java.util.stream.Collectors)1 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)1 StringUtils (org.apache.commons.lang3.StringUtils)1 Pair (org.apache.commons.lang3.tuple.Pair)1 Header (org.apache.http.Header)1