Search in sources :

Example 1 with ArtifactoryManagerBuilder

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

the class NpmPublish method main.

/**
 * Allow running npm publish using a new Java process.
 * Used only in Jenkins to allow running 'rtNpm publish' in a docker container.
 */
public static void main(String[] ignored) {
    try {
        ArtifactoryClientConfiguration clientConfiguration = createArtifactoryClientConfiguration();
        ArtifactoryManagerBuilder artifactoryManagerBuilder = new ArtifactoryManagerBuilder().setClientConfiguration(clientConfiguration, clientConfiguration.publisher);
        ArtifactoryClientConfiguration.PackageManagerHandler npmHandler = clientConfiguration.packageManagerHandler;
        NpmPublish npmPublish = new NpmPublish(artifactoryManagerBuilder, ArrayListMultimap.create(clientConfiguration.publisher.getMatrixParams().asMultimap()), Paths.get(npmHandler.getPath() != null ? npmHandler.getPath() : "."), clientConfiguration.publisher.getRepoKey(), clientConfiguration.getLog(), clientConfiguration.getAllProperties(), npmHandler.getModule());
        npmPublish.executeAndSaveBuildInfo(clientConfiguration);
    } catch (RuntimeException e) {
        ExceptionUtils.printRootCauseStackTrace(e, System.out);
        System.exit(1);
    }
}
Also used : PackageManagerUtils.createArtifactoryClientConfiguration(org.jfrog.build.extractor.packageManager.PackageManagerUtils.createArtifactoryClientConfiguration) ArtifactoryClientConfiguration(org.jfrog.build.extractor.clientConfiguration.ArtifactoryClientConfiguration) ArtifactoryManagerBuilder(org.jfrog.build.extractor.clientConfiguration.ArtifactoryManagerBuilder)

Example 2 with ArtifactoryManagerBuilder

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

the class PipExtractorTest method setUp.

@BeforeClass
private void setUp() {
    artifactoryManagerBuilder = new ArtifactoryManagerBuilder().setServerUrl(getArtifactoryUrl()).setUsername(getUsername()).setPassword(getAdminToken()).setLog(getLog());
    // Read pip environment path variable.
    pipEnvVar = System.getenv(BITESTS_ARTIFACTORY_ENV_VAR_PREFIX + "PIP_ENV");
    if (pipEnvVar == null) {
        fail("Couldn't read pip virtual-environment variable: " + BITESTS_ARTIFACTORY_ENV_VAR_PREFIX + "PIP_ENV");
    }
    // Initialize driver and validate empty virtual-environment for pip execution.
    try {
        env = getUpdatedEnvPath();
        driver = new PipDriver("pip", env);
        validateEmptyPipEnv(driver);
    } catch (IOException e) {
        fail(e.getMessage());
    }
}
Also used : ArtifactoryManagerBuilder(org.jfrog.build.extractor.clientConfiguration.ArtifactoryManagerBuilder) PipDriver(org.jfrog.build.extractor.pip.PipDriver) IOException(java.io.IOException) BeforeClass(org.testng.annotations.BeforeClass)

Example 3 with ArtifactoryManagerBuilder

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

the class BuildDockerCreator method main.

/**
 * Allow creating build-info for a published docker image in a new Java process.
 *
 * @param ignored ignores input incoming params.
 */
public static void main(String[] ignored) {
    try {
        ArtifactoryClientConfiguration clientConfiguration = createArtifactoryClientConfiguration();
        // Client builders.
        ArtifactoryManagerBuilder artifactoryManagerBuilder = new ArtifactoryManagerBuilder().setClientConfiguration(clientConfiguration, clientConfiguration.publisher);
        // Load artifact and BuildInfo properties from publisher section in the BuildInfo.properties file.
        ArtifactoryClientConfiguration.DockerHandler dockerHandler = clientConfiguration.dockerHandler;
        String imageFile;
        ImageFileType imageFileType;
        if (StringUtils.isNotBlank(dockerHandler.getKanikoImageFile())) {
            imageFile = dockerHandler.getKanikoImageFile();
            imageFileType = ImageFileType.KANIKO;
        } else if (StringUtils.isNotBlank(dockerHandler.getJibImageFile())) {
            imageFile = dockerHandler.getJibImageFile();
            imageFileType = ImageFileType.JIB;
        } else {
            throw new RuntimeException("kaniko.image.file or jib.image.file property is expected");
        }
        // Init BuildDockerCreate.
        BuildDockerCreator dockerBuildCreate = new BuildDockerCreator(artifactoryManagerBuilder, imageFile, imageFileType, ArrayListMultimap.create(clientConfiguration.publisher.getMatrixParams().asMultimap()), clientConfiguration.publisher.getRepoKey(), clientConfiguration.getLog());
        // Exe build-docker-create & collect build info.
        dockerBuildCreate.executeAndSaveBuildInfo(clientConfiguration);
    } catch (RuntimeException e) {
        ExceptionUtils.printRootCauseStackTrace(e, System.out);
        System.exit(1);
    }
}
Also used : PackageManagerUtils.createArtifactoryClientConfiguration(org.jfrog.build.extractor.packageManager.PackageManagerUtils.createArtifactoryClientConfiguration) ArtifactoryClientConfiguration(org.jfrog.build.extractor.clientConfiguration.ArtifactoryClientConfiguration) ArtifactoryManagerBuilder(org.jfrog.build.extractor.clientConfiguration.ArtifactoryManagerBuilder)

Example 4 with ArtifactoryManagerBuilder

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

the class DockerPush method main.

/**
 * Allow running docker push using a new Java process.
 *
 * @param ignored ignores input incoming params.
 */
public static void main(String[] ignored) {
    try {
        ArtifactoryClientConfiguration clientConfiguration = createArtifactoryClientConfiguration();
        // Client builders.
        ArtifactoryManagerBuilder artifactoryManagerBuilder = new ArtifactoryManagerBuilder().setClientConfiguration(clientConfiguration, clientConfiguration.publisher);
        // Load artifact and BuildInfo properties from publisher section in the BuildInfo.properties file.
        ArtifactoryClientConfiguration.DockerHandler dockerHandler = clientConfiguration.dockerHandler;
        // Init DockerPush.
        DockerPush dockerPush = new DockerPush(artifactoryManagerBuilder, dockerHandler.getImageTag(), dockerHandler.getHost(), ArrayListMultimap.create(clientConfiguration.publisher.getMatrixParams().asMultimap()), clientConfiguration.publisher.getRepoKey(), clientConfiguration.publisher.getUsername(), clientConfiguration.publisher.getPassword(), clientConfiguration.getLog(), clientConfiguration.getAllProperties());
        // Exe docker push & collect build info.
        dockerPush.executeAndSaveBuildInfo(clientConfiguration);
    } catch (RuntimeException e) {
        ExceptionUtils.printRootCauseStackTrace(e, System.out);
        System.exit(1);
    }
}
Also used : PackageManagerUtils.createArtifactoryClientConfiguration(org.jfrog.build.extractor.packageManager.PackageManagerUtils.createArtifactoryClientConfiguration) ArtifactoryClientConfiguration(org.jfrog.build.extractor.clientConfiguration.ArtifactoryClientConfiguration) ArtifactoryManagerBuilder(org.jfrog.build.extractor.clientConfiguration.ArtifactoryManagerBuilder)

Example 5 with ArtifactoryManagerBuilder

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

the class DockerPull method main.

/**
 * Allow running docker pull using a new Java process.
 *
 * @param ignored ignores input incoming params.
 */
public static void main(String[] ignored) {
    try {
        // Client builders.
        ArtifactoryClientConfiguration clientConfiguration = createArtifactoryClientConfiguration();
        ArtifactoryManagerBuilder artifactoryManagerBuilder = new ArtifactoryManagerBuilder().setClientConfiguration(clientConfiguration, clientConfiguration.resolver);
        // Load artifact and BuildInfo properties from resolver section in the BuildInfo.properties file.
        ArtifactoryClientConfiguration.DockerHandler dockerHandler = clientConfiguration.dockerHandler;
        // Init DockerPull.
        DockerPull dockerPush = new DockerPull(artifactoryManagerBuilder, dockerHandler.getImageTag(), dockerHandler.getHost(), clientConfiguration.resolver.getRepoKey(), clientConfiguration.resolver.getUsername(), clientConfiguration.resolver.getPassword(), clientConfiguration.getLog(), clientConfiguration.getAllProperties());
        // Exe docker pull & collect build info.
        dockerPush.executeAndSaveBuildInfo(clientConfiguration);
    } catch (RuntimeException e) {
        ExceptionUtils.printRootCauseStackTrace(e, System.out);
        System.exit(1);
    }
}
Also used : PackageManagerUtils.createArtifactoryClientConfiguration(org.jfrog.build.extractor.packageManager.PackageManagerUtils.createArtifactoryClientConfiguration) ArtifactoryClientConfiguration(org.jfrog.build.extractor.clientConfiguration.ArtifactoryClientConfiguration) ArtifactoryManagerBuilder(org.jfrog.build.extractor.clientConfiguration.ArtifactoryManagerBuilder)

Aggregations

ArtifactoryManagerBuilder (org.jfrog.build.extractor.clientConfiguration.ArtifactoryManagerBuilder)12 ArtifactoryClientConfiguration (org.jfrog.build.extractor.clientConfiguration.ArtifactoryClientConfiguration)9 PackageManagerUtils.createArtifactoryClientConfiguration (org.jfrog.build.extractor.packageManager.PackageManagerUtils.createArtifactoryClientConfiguration)9 BeforeClass (org.testng.annotations.BeforeClass)3 IOException (java.io.IOException)2 DependenciesDownloaderHelper (org.jfrog.build.extractor.clientConfiguration.util.DependenciesDownloaderHelper)1 PipDriver (org.jfrog.build.extractor.pip.PipDriver)1