use of org.jboss.pnc.dto.Build in project pnc by project-ncl.
the class BuildTest method shouldNotTriggerANewPersistentBuildWithoutForceIfOnlyDescriptionChanged.
@Test
public void shouldNotTriggerANewPersistentBuildWithoutForceIfOnlyDescriptionChanged() throws ClientException {
BuildConfiguration buildConfiguration = buildConfigurationClient.getAll(Optional.empty(), Optional.of("name==maven-plugin-test")).iterator().next();
EnumSet<BuildStatus> isIn = EnumSet.of(BuildStatus.SUCCESS);
EnumSet<BuildStatus> isNotIn = EnumSet.of(BuildStatus.REJECTED, BuildStatus.NO_REBUILD_REQUIRED);
// Build persistent builds (parent and dependency) on new revision
Build persistentBuild = buildConfigurationClient.trigger(buildConfiguration.getId(), getPersistentParameters(true));
ResponseUtils.waitSynchronouslyFor(() -> buildToFinish(persistentBuild.getId(), isIn, isNotIn), 15, TimeUnit.SECONDS);
// Updating the description only won't create a new revision, as description is not audited anymore
Instant oldLastModDate = buildConfiguration.getModificationTime();
BuildConfiguration updatedConfiguration = buildConfiguration.toBuilder().description("Random Description to be able to trigger build again so that persistent build will be first on this revision").build();
buildConfigurationClient.update(updatedConfiguration.getId(), updatedConfiguration);
assertThat(oldLastModDate).isEqualTo(updatedConfiguration.getModificationTime());
Build build2 = buildConfigurationClient.trigger(updatedConfiguration.getId(), getPersistentParameters());
ResponseUtils.waitSynchronouslyFor(() -> buildToFinish(build2.getId(), EnumSet.of(BuildStatus.NO_REBUILD_REQUIRED), null), 15, TimeUnit.SECONDS);
}
use of org.jboss.pnc.dto.Build in project pnc by project-ncl.
the class BuildTest method shouldNotTriggerANewTemporaryBuildWithoutForceIfOnlyDescriptionChanged.
@Test
public void shouldNotTriggerANewTemporaryBuildWithoutForceIfOnlyDescriptionChanged() throws ClientException {
BuildConfiguration buildConfiguration = buildConfigurationClient.getAll(Optional.empty(), Optional.of("name==maven-plugin-test")).iterator().next();
EnumSet<BuildStatus> isIn = EnumSet.of(BuildStatus.SUCCESS);
EnumSet<BuildStatus> isNotIn = EnumSet.of(BuildStatus.REJECTED, BuildStatus.NO_REBUILD_REQUIRED);
// Build temporary builds (parent and dependency) on new revision
Build persistentBuild = buildConfigurationClient.trigger(buildConfiguration.getId(), getTemporaryParameters(true));
ResponseUtils.waitSynchronouslyFor(() -> buildToFinish(persistentBuild.getId(), isIn, isNotIn), 15, TimeUnit.SECONDS);
// Updating the description only won't create a new revision, as description is not audited anymore
Instant oldLastModDate = buildConfiguration.getModificationTime();
BuildConfiguration updatedConfiguration = buildConfiguration.toBuilder().description("Random Description to be able to trigger build again so that temporary build will be first on this revision").build();
buildConfigurationClient.update(updatedConfiguration.getId(), updatedConfiguration);
assertThat(oldLastModDate).isEqualTo(updatedConfiguration.getModificationTime());
Build build2 = buildConfigurationClient.trigger(updatedConfiguration.getId(), getTemporaryParameters());
ResponseUtils.waitSynchronouslyFor(() -> buildToFinish(build2.getId(), EnumSet.of(BuildStatus.NO_REBUILD_REQUIRED), null), 15, TimeUnit.SECONDS);
}
use of org.jboss.pnc.dto.Build in project pnc by project-ncl.
the class BuildTest method shouldTriggerPersistentWithoutForceAfterTemporaryOnTheSameRev.
@Test
public void shouldTriggerPersistentWithoutForceAfterTemporaryOnTheSameRev() throws ClientException {
BuildConfiguration buildConfiguration = buildConfigurationClient.getAll(Optional.empty(), Optional.of("name==maven-plugin-test")).iterator().next();
// Updating the description only won't create a new revision, as description is not audited anymore
Instant oldLastModDate = buildConfiguration.getModificationTime();
BuildConfiguration updatedConfiguration = buildConfiguration.toBuilder().description("Random Description to be able to trigger build again so that temporary build will be first on this revision").buildScript("mvn" + " clean deploy -DskipTests=true").build();
buildConfigurationClient.update(updatedConfiguration.getId(), updatedConfiguration);
updatedConfiguration = buildConfigurationClient.getSpecific(updatedConfiguration.getId());
assertThat(oldLastModDate).isNotEqualTo(updatedConfiguration.getModificationTime());
EnumSet<BuildStatus> isIn = EnumSet.of(BuildStatus.SUCCESS);
EnumSet<BuildStatus> isNotIn = EnumSet.of(BuildStatus.REJECTED, BuildStatus.NO_REBUILD_REQUIRED);
Build build = buildConfigurationClient.trigger(buildConfiguration.getId(), getTemporaryParameters());
ResponseUtils.waitSynchronouslyFor(() -> buildToFinish(build.getId(), isIn, isNotIn), 15, TimeUnit.SECONDS);
Build afterTempPersistentBuild = buildConfigurationClient.trigger(buildConfiguration.getId(), getPersistentParameters());
ResponseUtils.waitSynchronouslyFor(() -> buildToFinish(afterTempPersistentBuild.getId(), isIn, isNotIn), 15, TimeUnit.SECONDS);
}
use of org.jboss.pnc.dto.Build in project pnc by project-ncl.
the class BuildTest method dontRebuildTemporaryBuildWhenThereIsNewerPersistentOnSameRev.
// NCL-5192
// Replicates NCL-5192 through explicit dependency instead of implicit
@Test
public void dontRebuildTemporaryBuildWhenThereIsNewerPersistentOnSameRev() throws ClientException {
BuildConfiguration parent = buildConfigurationClient.getAll(Optional.empty(), Optional.of("name==pnc-build-agent-0.4")).iterator().next();
BuildConfiguration dependency = buildConfigurationClient.getAll(Optional.empty(), Optional.of("name==termd")).iterator().next();
Instant oldLastModDateParent = parent.getModificationTime();
BuildConfiguration updatedParent = parent.toBuilder().description("Random Description to be able to trigger build again so that temporary build will be first on this revision").buildScript("mvn" + " clean deploy -DskipTests=true").build();
buildConfigurationClient.update(updatedParent.getId(), updatedParent);
updatedParent = buildConfigurationClient.getSpecific(updatedParent.getId());
assertThat(oldLastModDateParent).isNotEqualTo(updatedParent.getModificationTime());
Instant oldLastModDateDependency = parent.getModificationTime();
BuildConfiguration updatedDependency = dependency.toBuilder().description("Random Description so it rebuilds").buildScript("mvn" + " clean deploy -DskipTests=true").build();
buildConfigurationClient.update(updatedDependency.getId(), updatedDependency);
assertThat(oldLastModDateDependency).isNotEqualTo(updatedDependency.getModificationTime());
EnumSet<BuildStatus> isIn = EnumSet.of(BuildStatus.SUCCESS);
EnumSet<BuildStatus> isNotIn = EnumSet.of(BuildStatus.REJECTED, BuildStatus.NO_REBUILD_REQUIRED);
// Build temporary builds (parent and dependency) on new revision
Build temporaryBuild = buildConfigurationClient.trigger(parent.getId(), getTemporaryParameters());
ResponseUtils.waitSynchronouslyFor(() -> buildToFinish(temporaryBuild.getId(), isIn, isNotIn), 15, TimeUnit.SECONDS);
// Build persistent build of dependency on the same revision
Build dependencyPersistentBuild = buildConfigurationClient.trigger(dependency.getId(), getPersistentParameters());
ResponseUtils.waitSynchronouslyFor(() -> buildToFinish(dependencyPersistentBuild.getId(), isIn, isNotIn), 15, TimeUnit.SECONDS);
// Build temporary build of parent and check it gets REJECTED even if it's dependency has newer record
// (in this case temp build should ignore persistent one)
Build finalRecord = buildConfigurationClient.trigger(parent.getId(), getTemporaryParameters());
ResponseUtils.waitSynchronouslyFor(() -> buildToFinish(finalRecord.getId(), EnumSet.of(BuildStatus.NO_REBUILD_REQUIRED), null), 15, TimeUnit.SECONDS);
}
use of org.jboss.pnc.dto.Build in project pnc by project-ncl.
the class ProductMilestoneEndpointTest method testGetBuilds.
@Test
public void testGetBuilds() throws ClientException {
ProductMilestoneClient client = new ProductMilestoneClient(RestClientConfiguration.asAnonymous());
RemoteCollection<Build> all = client.getBuilds(milestoneId, null);
assertThat(all).hasSize(1);
}
Aggregations