Search in sources :

Example 6 with Artifact

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

the class GoPublish method createAndDeployZip.

private void createAndDeployZip(ArtifactoryManager artifactoryManager) throws Exception {
    // First, we create a temporary zip file of all project files.
    File tmpZipFile = archiveProjectDir();
    // Second, filter the raw zip file according to Go rules and create deployable zip can be later resolved.
    // We use the same code as Artifactory when he resolve a Go module directly from Github.
    File deployableZipFile = File.createTempFile(LOCAL_PKG_FILENAME, PKG_ZIP_FILE_EXTENSION, path.toFile());
    try (GoZipBallStreamer pkgArchiver = new GoZipBallStreamer(new ZipFile(tmpZipFile), moduleName, version, logger)) {
        pkgArchiver.writeDeployableZip(deployableZipFile);
        Artifact deployedPackage = deploy(artifactoryManager, deployableZipFile, PKG_ZIP_FILE_EXTENSION);
        artifactList.add(deployedPackage);
    } finally {
        Files.deleteIfExists(tmpZipFile.toPath());
        Files.deleteIfExists(deployableZipFile.toPath());
    }
}
Also used : ZipFile(org.apache.commons.compress.archivers.zip.ZipFile) ZipFile(org.apache.commons.compress.archivers.zip.ZipFile) File(java.io.File) Artifact(org.jfrog.build.extractor.ci.Artifact)

Example 7 with Artifact

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

the class GoPublish method deployGoMod.

private void deployGoMod(ArtifactoryManager artifactoryManager) throws Exception {
    String modLocalPath = getModFilePath();
    Artifact deployedMod = deploy(artifactoryManager, new File(modLocalPath), PKG_MOD_FILE_EXTENSION);
    artifactList.add(deployedMod);
}
Also used : ZipFile(org.apache.commons.compress.archivers.zip.ZipFile) File(java.io.File) Artifact(org.jfrog.build.extractor.ci.Artifact)

Example 8 with Artifact

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

the class DockerExtractorTest method pushAndValidateImage.

private void pushAndValidateImage(DockerPush dockerPush, String repo, String imageTag, String shortImageTag) {
    BuildInfo buildInfo = dockerPush.execute();
    Module module = getAndValidateModule(buildInfo, SHORT_IMAGE_NAME + ":" + shortImageTag, repo);
    List<Artifact> artifacts = module.getArtifacts();
    validateImageArtifacts(artifacts, imageTag);
    assertEquals(7, artifacts.size());
    module.getArtifacts().forEach(artifact -> assertEquals(artifact.getRemotePath(), SHORT_IMAGE_NAME + "/" + shortImageTag));
    assertEquals(5, module.getDependencies().size());
}
Also used : BuildInfo(org.jfrog.build.extractor.ci.BuildInfo) Module(org.jfrog.build.extractor.ci.Module) Artifact(org.jfrog.build.extractor.ci.Artifact)

Example 9 with Artifact

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

the class NpmPublish method createBuild.

private BuildInfo createBuild() {
    String moduleID = StringUtils.isNotBlank(module) ? module : npmPackageInfo.toString();
    List<Artifact> artifactList = Collections.singletonList(deployedArtifact);
    Module module = new ModuleBuilder().type(ModuleType.NPM).id(moduleID).repository(repo).artifacts(artifactList).build();
    List<Module> modules = Collections.singletonList(module);
    BuildInfo buildInfo = new BuildInfo();
    buildInfo.setModules(modules);
    return buildInfo;
}
Also used : ModuleBuilder(org.jfrog.build.extractor.builder.ModuleBuilder) BuildInfo(org.jfrog.build.extractor.ci.BuildInfo) Module(org.jfrog.build.extractor.ci.Module) Artifact(org.jfrog.build.extractor.ci.Artifact)

Example 10 with Artifact

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

the class ArtifactBuilder method build.

/**
 * Assembles the artifact class
 *
 * @return Assembled dependency
 */
public Artifact build() {
    if (StringUtils.isBlank(name)) {
        throw new IllegalArgumentException("Artifact must have a name");
    }
    Artifact artifact = new Artifact();
    artifact.setName(name);
    artifact.setType(type);
    artifact.setSha1(sha1);
    artifact.setSha256(sha256);
    artifact.setMd5(md5);
    artifact.setRemotePath(remotePath);
    artifact.setLocalPath(localPath);
    artifact.setProperties(properties);
    return artifact;
}
Also used : Artifact(org.jfrog.build.extractor.ci.Artifact)

Aggregations

Artifact (org.jfrog.build.extractor.ci.Artifact)14 File (java.io.File)8 Module (org.jfrog.build.extractor.ci.Module)5 ZipFile (org.apache.commons.compress.archivers.zip.ZipFile)3 ArtifactBuilder (org.jfrog.build.extractor.builder.ArtifactBuilder)3 BuildInfo (org.jfrog.build.extractor.ci.BuildInfo)3 Dependency (org.jfrog.build.extractor.ci.Dependency)3 DeployDetails (org.jfrog.build.extractor.clientConfiguration.deploy.DeployDetails)3 ArtifactoryClientConfiguration (org.jfrog.build.extractor.clientConfiguration.ArtifactoryClientConfiguration)2 Test (org.testng.annotations.Test)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 IOException (java.io.IOException)1 ParseException (java.text.ParseException)1 SimpleDateFormat (java.text.SimpleDateFormat)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Date (java.util.Date)1 List (java.util.List)1 Map (java.util.Map)1 Set (java.util.Set)1