Search in sources :

Example 1 with GroupBuildRequest

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);
    }
}
Also used : GroupBuildRequest(org.jboss.pnc.dto.requests.GroupBuildRequest) GroupBuildParameters(org.jboss.pnc.rest.api.parameters.GroupBuildParameters) ClientException(org.jboss.pnc.client.ClientException)

Example 2 with GroupBuildRequest

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);
}
Also used : GroupBuildRequest(org.jboss.pnc.dto.requests.GroupBuildRequest) GroupBuild(org.jboss.pnc.dto.GroupBuild) BuildConfigurationRevisionRef(org.jboss.pnc.dto.BuildConfigurationRevisionRef) ArrayList(java.util.ArrayList) BuildConfigurationRevision(org.jboss.pnc.dto.BuildConfigurationRevision) BuildStatus(org.jboss.pnc.enums.BuildStatus) GroupBuildParameters(org.jboss.pnc.rest.api.parameters.GroupBuildParameters) GroupConfiguration(org.jboss.pnc.dto.GroupConfiguration) ContainerTest(org.jboss.pnc.test.category.ContainerTest) Test(org.junit.Test)

Aggregations

GroupBuildRequest (org.jboss.pnc.dto.requests.GroupBuildRequest)2 GroupBuildParameters (org.jboss.pnc.rest.api.parameters.GroupBuildParameters)2 ArrayList (java.util.ArrayList)1 ClientException (org.jboss.pnc.client.ClientException)1 BuildConfigurationRevision (org.jboss.pnc.dto.BuildConfigurationRevision)1 BuildConfigurationRevisionRef (org.jboss.pnc.dto.BuildConfigurationRevisionRef)1 GroupBuild (org.jboss.pnc.dto.GroupBuild)1 GroupConfiguration (org.jboss.pnc.dto.GroupConfiguration)1 BuildStatus (org.jboss.pnc.enums.BuildStatus)1 ContainerTest (org.jboss.pnc.test.category.ContainerTest)1 Test (org.junit.Test)1