Search in sources :

Example 26 with BuildConfigurationAudited

use of org.jboss.pnc.model.BuildConfigurationAudited in project pnc by project-ncl.

the class RepositoryManagerDriver method collectRepoManagerResult.

@Override
public RepositoryManagerResult collectRepoManagerResult(String id) throws RepositoryManagerException {
    Base32LongID buildId = new Base32LongID(id);
    BuildRecord br = buildRecordRepository.findByIdFetchProperties(buildId);
    if (br == null) {
        return null;
    }
    BuildConfigurationAudited bc = br.getBuildConfigurationAudited();
    String buildContentId = br.getBuildContentId();
    BuildType buildType = bc.getBuildType();
    boolean tempBuild = br.isTemporaryBuild();
    Indy indy = init(null);
    String buildPromotionTarget = tempBuild ? TEMP_BUILD_PROMOTION_TARGET : BUILD_PROMOTION_TARGET;
    String packageType = getIndyPackageTypeKey(buildType.getRepoType());
    BuildCategory buildCategory = getBuildCategory(bc.getGenericParameters());
    ArtifactFilter artifactFilter = new ArtifactFilterImpl(ignoredPathPatternsPromotion, ignoredPathPatternsData, ignoredRepoPatterns);
    IndyRepositorySession session = new IndyRepositorySession(indy, indy, buildContentId, packageType, null, artifactFilter, buildPromotionTarget, buildCategory, tempBuild);
    return session.extractBuildArtifacts(false);
}
Also used : BuildConfigurationAudited(org.jboss.pnc.model.BuildConfigurationAudited) Base32LongID(org.jboss.pnc.model.Base32LongID) BuildCategory(org.jboss.pnc.enums.BuildCategory) Indy(org.commonjava.indy.client.core.Indy) BuildType(org.jboss.pnc.enums.BuildType) BuildRecord(org.jboss.pnc.model.BuildRecord)

Example 27 with BuildConfigurationAudited

use of org.jboss.pnc.model.BuildConfigurationAudited in project pnc by project-ncl.

the class DatastoreAdapter method getLatestBuildConfigurationAuditedInitializeBCDependencies.

/**
 * Get the latest audited version of the given build configuration and fetch whole dependency tree of the related BC
 *
 * @param buildConfigurationId The id of the config to check
 * @return The latest audited version of the build configuration with fetched dependency tree of the related BC
 */
public BuildConfigurationAudited getLatestBuildConfigurationAuditedInitializeBCDependencies(Integer buildConfigurationId) {
    BuildConfigurationAudited buildConfigAudited = datastore.getLatestBuildConfigurationAuditedLoadBCDependencies(buildConfigurationId);
    loadBuildConfigurations(buildConfigAudited);
    return buildConfigAudited;
}
Also used : BuildConfigurationAudited(org.jboss.pnc.model.BuildConfigurationAudited)

Example 28 with BuildConfigurationAudited

use of org.jboss.pnc.model.BuildConfigurationAudited in project pnc by project-ncl.

the class DatastoreAdapter method getLatestBuildConfigurationAudited.

/**
 * Get the latest audited revision for the given build configuration ID
 *
 * @param buildConfigurationId Build Configuration ID
 * @return The latest revision of the given build configuration
 */
public BuildConfigurationAudited getLatestBuildConfigurationAudited(Integer buildConfigurationId) {
    BuildConfigurationAudited buildConfigAudited = datastore.getLatestBuildConfigurationAudited(buildConfigurationId);
    loadBuildConfigurations(buildConfigAudited);
    return buildConfigAudited;
}
Also used : BuildConfigurationAudited(org.jboss.pnc.model.BuildConfigurationAudited)

Example 29 with BuildConfigurationAudited

use of org.jboss.pnc.model.BuildConfigurationAudited in project pnc by project-ncl.

the class DefaultBuildCoordinatorTest method testBuildBuildConfigurationSet.

@Test
public void testBuildBuildConfigurationSet() throws BuildConflictException, CoreException, DatastoreException {
    BuildConfigurationAudited bca = mockDatastoreWithBCAudited(BC_1, 5);
    BuildConfigurationAudited bcaDep = mockDatastoreWithBCAudited(BC_2, 2);
    BuildConfigurationAudited bca3 = mockDatastoreWithBCAudited(BC_3, 9);
    when(datastore.getBuildConfigurations(BCS)).thenReturn(BCS.getBuildConfigurations());
    BuildSetTask buildSetTask = coordinator.build(BCS, USER, BUILD_OPTIONS);
    assertEquals(2, buildSetTask.getBuildTasks().size());
    assertNotNull(buildSetTask.getBuildTask(bca));
    // Dependencies outside group are not build
    assertNull(buildSetTask.getBuildTask(bcaDep));
    assertNotNull(buildSetTask.getBuildTask(bca3));
    assertSame(BUILD_OPTIONS, buildSetTask.getBuildOptions());
}
Also used : BuildConfigurationAudited(org.jboss.pnc.model.BuildConfigurationAudited) BuildSetTask(org.jboss.pnc.spi.coordinator.BuildSetTask) Test(org.junit.Test)

Example 30 with BuildConfigurationAudited

use of org.jboss.pnc.model.BuildConfigurationAudited in project pnc by project-ncl.

the class DefaultBuildCoordinatorTest method toBuildConfigurationAudited.

private BuildConfigurationAudited toBuildConfigurationAudited(BuildConfiguration bc, int rev) {
    BuildConfigurationAudited bca = BuildConfigurationAudited.fromBuildConfiguration(bc, rev);
    bca.setRev(rev);
    return bca;
}
Also used : BuildConfigurationAudited(org.jboss.pnc.model.BuildConfigurationAudited)

Aggregations

BuildConfigurationAudited (org.jboss.pnc.model.BuildConfigurationAudited)35 BuildConfiguration (org.jboss.pnc.model.BuildConfiguration)12 IdRev (org.jboss.pnc.model.IdRev)12 BuildSetTask (org.jboss.pnc.spi.coordinator.BuildSetTask)10 BuildTask (org.jboss.pnc.spi.coordinator.BuildTask)10 Test (org.junit.Test)8 HashSet (java.util.HashSet)7 BuildRecord (org.jboss.pnc.model.BuildRecord)6 Date (java.util.Date)5 Logger (org.slf4j.Logger)5 LoggerFactory (org.slf4j.LoggerFactory)5 Map (java.util.Map)4 Set (java.util.Set)4 Collectors (java.util.stream.Collectors)4 Inject (javax.inject.Inject)4 Base32LongID (org.jboss.pnc.model.Base32LongID)4 Collections (java.util.Collections)3 List (java.util.List)3 Optional (java.util.Optional)3 Stateless (javax.ejb.Stateless)3