use of org.jboss.pnc.spi.coordinator.BuildSetTask in project pnc by project-ncl.
the class DefaultBuildCoordinatorTest method shouldUpdateBuildRecordSetIfBuildSetBuilIsRejected.
@Test
public void shouldUpdateBuildRecordSetIfBuildSetBuilIsRejected() throws DatastoreException, CoreException {
BuildConfigurationSet bcSet = BuildConfigurationSet.Builder.newBuilder().buildConfigurations(Collections.emptySet()).name("BCSet").id(1).build();
BuildSetTask bsTask = coordinator.build(bcSet, USER, BUILD_OPTIONS);
assertThat(bsTask.getBuildConfigSetRecord().get().getStatus()).isEqualTo(BuildStatus.NO_REBUILD_REQUIRED);
}
use of org.jboss.pnc.spi.coordinator.BuildSetTask in project pnc by project-ncl.
the class BuildTriggererImpl method triggerBuild.
@Override
public String triggerBuild(final int buildConfigId, OptionalInt buildConfigurationRevision, BuildOptions buildOptions) throws BuildConflictException, CoreException {
throwCoreExceptionIfInMaintenanceModeAndNonSystemUser();
BuildSetTask result = doTriggerBuild(buildConfigId, buildConfigurationRevision, buildOptions);
return selectBuildRecordIdOf(result.getBuildTasks(), buildConfigId);
}
use of org.jboss.pnc.spi.coordinator.BuildSetTask in project pnc by project-ncl.
the class BuildTriggererImpl method doTriggerBuild.
private BuildSetTask doTriggerBuild(final int buildConfigId, OptionalInt buildConfigurationRevision, BuildOptions buildOptions) throws BuildConflictException, CoreException {
BuildSetTask buildSetTask;
if (buildConfigurationRevision.isPresent()) {
final BuildConfigurationAudited buildConfigurationAudited = buildConfigurationAuditedRepository.queryById(new IdRev(buildConfigId, buildConfigurationRevision.getAsInt()));
Preconditions.checkArgument(buildConfigurationAudited != null, "Can't find Build Configuration with id=" + buildConfigId + ", rev=" + buildConfigurationRevision.getAsInt());
buildSetTask = buildCoordinator.build(hibernateLazyInitializer.initializeBuildConfigurationAuditedBeforeTriggeringIt(buildConfigurationAudited), user.currentUser(), buildOptions);
} else {
final BuildConfiguration buildConfiguration = buildConfigurationRepository.queryById(buildConfigId);
Preconditions.checkArgument(buildConfiguration != null, "Can't find Build Configuration with id=" + buildConfigId);
buildSetTask = buildCoordinator.build(hibernateLazyInitializer.initializeBuildConfigurationBeforeTriggeringIt(buildConfiguration), user.currentUser(), buildOptions);
}
logger.info("Started build of Build Configuration {}. Build Tasks: {}", buildConfigId, buildSetTask.getBuildTasks().stream().map(BuildTask::getId).collect(Collectors.joining()));
return buildSetTask;
}
use of org.jboss.pnc.spi.coordinator.BuildSetTask in project pnc by project-ncl.
the class BuildTriggererImpl method triggerGroupBuild.
@Override
public int triggerGroupBuild(int groupConfigId, Optional<GroupBuildRequest> revs, BuildOptions buildOptions) throws BuildConflictException, CoreException {
throwCoreExceptionIfInMaintenanceModeAndNonSystemUser();
BuildSetTask result = doTriggerGroupBuild(groupConfigId, revs, buildOptions);
return result.getId();
}
use of org.jboss.pnc.spi.coordinator.BuildSetTask in project pnc by project-ncl.
the class BuildTriggererImpl method doTriggerGroupBuild.
private BuildSetTask doTriggerGroupBuild(final int groupConfigId, Optional<GroupBuildRequest> revs, BuildOptions buildOptions) throws CoreException {
final BuildConfigurationSet buildConfigurationSet = buildConfigurationSetRepository.queryById(groupConfigId);
Preconditions.checkArgument(buildConfigurationSet != null, "Can't find configuration with given id=" + groupConfigId);
List<BuildConfigurationRevisionRef> revisions = revs.map(GroupBuildRequest::getBuildConfigurationRevisions).orElse(Collections.emptyList());
BuildSetTask buildSetTask = buildCoordinator.build(hibernateLazyInitializer.initializeBuildConfigurationSetBeforeTriggeringIt(buildConfigurationSet), loadAuditedsFromDB(buildConfigurationSet, revisions), user.currentUser(), buildOptions);
logger.info("Started build of Group Configuration {}. Build Tasks: {}", groupConfigId, buildSetTask.getBuildTasks().stream().map(BuildTask::getId).collect(Collectors.joining()));
return buildSetTask;
}
Aggregations