Search in sources :

Example 16 with PncBuild

use of org.jboss.pnc.bacon.pig.impl.pnc.PncBuild in project bacon by project-ncl.

the class ExtraDeliverableDownloader method downloadArtifacts.

private void downloadArtifacts(String buildName, List<Map<String, String>> artifacts) {
    PncBuild build = builds.get(buildName);
    artifacts.forEach(artifact -> downloadArtifact(build, artifact.get("matching"), artifact.get("suffix")));
}
Also used : PncBuild(org.jboss.pnc.bacon.pig.impl.pnc.PncBuild)

Example 17 with PncBuild

use of org.jboss.pnc.bacon.pig.impl.pnc.PncBuild in project bacon by project-ncl.

the class MicroProfileSmallRyeCommunityDepAnalyzer method trigger.

@Override
public void trigger() {
    log.info("Running MicroProfileSmallRyeCommunityDepAnalyzer");
    Set<GAV> allGavs = new HashSet<>();
    for (PncBuild build : builds.values()) {
        Set<GAV> gavs = new BuildLogWithDependencyTrees(build.getBuildLog()).communityGavsForModules.entrySet().stream().filter(e -> !e.getKey().contains("test") && !e.getKey().contains("tck")).flatMap(e -> e.getValue().stream()).collect(Collectors.toSet());
        Path targetPath = Paths.get(extrasPath, "community-dependencies-" + build.getName() + ".csv");
        new CommunityDepAnalyzer(gavs).generateAnalysis(targetPath.toAbsolutePath().toString());
        allGavs.addAll(gavs);
    }
    Path targetPath = Paths.get(extrasPath, "community-dependencies.csv");
    new CommunityDepAnalyzer(allGavs).generateAnalysis(targetPath.toAbsolutePath().toString());
}
Also used : AddOn(org.jboss.pnc.bacon.pig.impl.addons.AddOn) CommunityDepAnalyzer(org.jboss.pnc.bacon.pig.impl.addons.runtime.CommunityDepAnalyzer) GAV(org.jboss.pnc.bacon.pig.impl.utils.GAV) Logger(org.slf4j.Logger) LoggerFactory(org.slf4j.LoggerFactory) PigConfiguration(org.jboss.pnc.bacon.pig.impl.config.PigConfiguration) Set(java.util.Set) Collectors(java.util.stream.Collectors) HashSet(java.util.HashSet) Paths(java.nio.file.Paths) Map(java.util.Map) PncBuild(org.jboss.pnc.bacon.pig.impl.pnc.PncBuild) Path(java.nio.file.Path) Path(java.nio.file.Path) CommunityDepAnalyzer(org.jboss.pnc.bacon.pig.impl.addons.runtime.CommunityDepAnalyzer) GAV(org.jboss.pnc.bacon.pig.impl.utils.GAV) PncBuild(org.jboss.pnc.bacon.pig.impl.pnc.PncBuild) HashSet(java.util.HashSet)

Example 18 with PncBuild

use of org.jboss.pnc.bacon.pig.impl.pnc.PncBuild in project bacon by project-ncl.

the class PigFacade method pushToBrew.

private static void pushToBrew(boolean reimport) {
    abortIfBuildDataAbsentFromContext();
    Map<String, PncBuild> builds = PigContext.get().getBuilds();
    String tagPrefix = getBrewTag(context().getPncImportResult().getVersion());
    List<PncBuild> buildsToPush = getBuildsToPush(builds);
    if (log.isInfoEnabled()) {
        log.info("Pushing the following builds to brew: {}", buildsToPush.stream().map(PncBuild::getId).collect(Collectors.toList()));
    }
    for (PncBuild build : buildsToPush) {
        BuildPushParameters request = BuildPushParameters.builder().tagPrefix(tagPrefix).reimport(reimport).build();
        // TODO: customize the timeout
        try (AdvancedBuildClient pushingClient = new AdvancedBuildClient(PncClientHelper.getPncConfiguration())) {
            BuildPushResult pushResult = pushingClient.executeBrewPush(build.getId(), request, 15L, TimeUnit.MINUTES);
            if (pushResult.getStatus() != BuildPushStatus.SUCCESS) {
                throw new RuntimeException("Failed to push build " + build.getId() + " to brew. Push result: " + pushResult);
            }
            log.info("{} pushed to brew ( {} ) ", build.getId(), UrlGenerator.generateBuildUrl(build.getId()));
        } catch (RemoteResourceException e) {
            throw new RuntimeException("Failed to push build " + build.getId() + " to brew (" + UrlGenerator.generateBuildUrl(build.getId()) + ")", e);
        }
    }
}
Also used : RemoteResourceException(org.jboss.pnc.client.RemoteResourceException) AdvancedBuildClient(org.jboss.pnc.restclient.AdvancedBuildClient) BuildPushParameters(org.jboss.pnc.dto.requests.BuildPushParameters) BuildPushResult(org.jboss.pnc.dto.BuildPushResult) PncBuild(org.jboss.pnc.bacon.pig.impl.pnc.PncBuild)

Example 19 with PncBuild

use of org.jboss.pnc.bacon.pig.impl.pnc.PncBuild in project bacon by project-ncl.

the class JavadocManager method addImportBOM.

private boolean addImportBOM(Profile profile) {
    Dependency dep;
    PncBuild build = getBuild(generationData.getImportBom());
    if (build != null) {
        List<ArtifactWrapper> artifacts = build.getBuiltArtifacts();
        if (artifacts != null && !artifacts.isEmpty()) {
            GAV tmp = artifacts.get(0).toGAV();
            // Get the first artifact and create the dep on the pom
            dep = new Dependency();
            dep.setArtifactId(tmp.getArtifactId());
            dep.setGroupId(tmp.getGroupId());
            dep.setVersion(tmp.getVersion());
            dep.setType("pom");
            dep.setScope("import");
            profile.getDependencyManagement().addDependency(dep);
        } else {
            log.error("Error no artifacts in build for 'importBom' {}", generationData.getImportBom());
            return false;
        }
    } else {
        log.error("Error no build found for 'importBom' {}", generationData.getImportBom());
        return false;
    }
    return true;
}
Also used : ArtifactWrapper(org.jboss.pnc.bacon.pig.impl.pnc.ArtifactWrapper) Dependency(org.jboss.pnc.bacon.pig.impl.utils.pom.Dependency) PncBuild(org.jboss.pnc.bacon.pig.impl.pnc.PncBuild) GAV(org.jboss.pnc.bacon.pig.impl.utils.GAV)

Example 20 with PncBuild

use of org.jboss.pnc.bacon.pig.impl.pnc.PncBuild in project bacon by project-ncl.

the class OfflineManifestGenerator method sourceBuilds.

private Collection<PncBuild> sourceBuilds() {
    RepoGenerationData generationData = pigConfiguration.getFlow().getRepositoryGeneration();
    RepoGenerationStrategy strategy = generationData.getStrategy();
    if (!Arrays.asList(IGNORE, BUILD_GROUP).contains(strategy)) {
        return builds.values();
    }
    List<String> excludeSourceBuilds = generationData.getExcludeSourceBuilds();
    return builds.values().stream().filter(build -> !excludeSourceBuilds.contains(build.getName())).collect(Collectors.toList());
}
Also used : AddOn(org.jboss.pnc.bacon.pig.impl.addons.AddOn) GAV(org.jboss.pnc.bacon.pig.impl.utils.GAV) Arrays(java.util.Arrays) RepoGenerationStrategy(org.jboss.pnc.bacon.pig.impl.config.RepoGenerationStrategy) BuildInfoCollector(org.jboss.pnc.bacon.pig.impl.pnc.BuildInfoCollector) LoggerFactory(org.slf4j.LoggerFactory) PigConfiguration(org.jboss.pnc.bacon.pig.impl.config.PigConfiguration) HashSet(java.util.HashSet) RepositoryType(org.jboss.pnc.enums.RepositoryType) Map(java.util.Map) IGNORE(org.jboss.pnc.bacon.pig.impl.config.RepoGenerationStrategy.IGNORE) PncBuild(org.jboss.pnc.bacon.pig.impl.pnc.PncBuild) PrintWriter(java.io.PrintWriter) Logger(org.slf4j.Logger) FatalException(org.jboss.pnc.bacon.common.exception.FatalException) Collection(java.util.Collection) RepoGenerationData(org.jboss.pnc.bacon.pig.impl.config.RepoGenerationData) Collectors(java.util.stream.Collectors) FileNotFoundException(java.io.FileNotFoundException) StandardCharsets(java.nio.charset.StandardCharsets) List(java.util.List) BUILD_GROUP(org.jboss.pnc.bacon.pig.impl.config.RepoGenerationStrategy.BUILD_GROUP) Pattern(java.util.regex.Pattern) UnsupportedEncodingException(java.io.UnsupportedEncodingException) ArtifactWrapper(org.jboss.pnc.bacon.pig.impl.pnc.ArtifactWrapper) RepoGenerationStrategy(org.jboss.pnc.bacon.pig.impl.config.RepoGenerationStrategy) RepoGenerationData(org.jboss.pnc.bacon.pig.impl.config.RepoGenerationData)

Aggregations

PncBuild (org.jboss.pnc.bacon.pig.impl.pnc.PncBuild)29 File (java.io.File)10 PigConfiguration (org.jboss.pnc.bacon.pig.impl.config.PigConfiguration)8 ArtifactWrapper (org.jboss.pnc.bacon.pig.impl.pnc.ArtifactWrapper)8 GAV (org.jboss.pnc.bacon.pig.impl.utils.GAV)8 Map (java.util.Map)7 Path (java.nio.file.Path)5 ArrayList (java.util.ArrayList)5 Collectors (java.util.stream.Collectors)5 Logger (org.slf4j.Logger)5 LoggerFactory (org.slf4j.LoggerFactory)5 FileNotFoundException (java.io.FileNotFoundException)4 PrintWriter (java.io.PrintWriter)4 UnsupportedEncodingException (java.io.UnsupportedEncodingException)4 Collection (java.util.Collection)4 HashMap (java.util.HashMap)4 List (java.util.List)4 FatalException (org.jboss.pnc.bacon.common.exception.FatalException)4 RepoGenerationData (org.jboss.pnc.bacon.pig.impl.config.RepoGenerationData)4 BuildInfoCollector (org.jboss.pnc.bacon.pig.impl.pnc.BuildInfoCollector)4