use of org.jboss.pnc.dto.requests.GroupBuildRequest in project bacon by project-ncl.
the class PncBuilder method run.
private GroupBuild run(GroupConfigurationRef group, boolean tempBuild, boolean tempBuildTS, RebuildMode rebuildMode, boolean dryRun) {
log.info("Performing builds of group config {} in PNC ( {} )", group.getId(), UrlGenerator.generateGroupConfigUrl(group.getId()));
if (tempBuildTS)
log.warn("Temporary builds with timestamp alignment are not supported, running temporary builds instead...");
GroupBuildParameters buildParams = new GroupBuildParameters();
buildParams.setRebuildMode(rebuildMode);
buildParams.setTemporaryBuild(tempBuild);
if (dryRun) {
buildParams.setTemporaryBuild(true);
buildParams.setAlignmentPreference(AlignmentPreference.PREFER_PERSISTENT);
}
GroupBuildRequest request = GroupBuildRequest.builder().build();
try {
return groupConfigClient.trigger(group.getId(), buildParams, request);
} catch (ClientException e) {
throw new RuntimeException("Failed to trigger build group " + group.getId(), e);
}
}
use of org.jboss.pnc.dto.requests.GroupBuildRequest in project pnc by project-ncl.
the class BuildTest method shouldTriggerGroupBuildWithBCInRevisionAndFinishWithoutProblems.
@Test
public void shouldTriggerGroupBuildWithBCInRevisionAndFinishWithoutProblems() throws ClientException {
// given
GroupConfiguration groupConfiguration = groupConfigurationClient.getAll().iterator().next();
assertThat(groupConfiguration.getBuildConfigs()).isNotEmpty();
List<BuildConfigurationRevisionRef> buildConfigurationRevisions = new ArrayList<>();
BuildConfigurationRevision buildConfigurationRevision = BuildConfigurationRevision.builder().id(groupConfiguration.getBuildConfigs().keySet().iterator().next()).rev(1).name(groupConfiguration.getName()).build();
buildConfigurationRevisions.add(buildConfigurationRevision);
GroupBuildRequest groupConfigWithAuditedBCsRest = GroupBuildRequest.builder().buildConfigurationRevisions(buildConfigurationRevisions).build();
GroupBuildParameters groupBuildParameters = new GroupBuildParameters();
groupBuildParameters.setRebuildMode(RebuildMode.FORCE);
// when
GroupBuild groupBuild = groupConfigurationClient.trigger(groupConfiguration.getId(), groupBuildParameters, groupConfigWithAuditedBCsRest);
// then
assertThat(groupBuild).isNotNull().extracting("id").isNotNull().isNotEqualTo("");
EnumSet<BuildStatus> isIn = EnumSet.of(BuildStatus.SUCCESS);
EnumSet<BuildStatus> isNotIn = EnumSet.of(BuildStatus.REJECTED);
ResponseUtils.waitSynchronouslyFor(() -> groupBuildToFinish(groupBuild.getId(), isIn, isNotIn), 15, TimeUnit.SECONDS);
}
Aggregations