Search in sources :

Example 6 with BuildConfigurationRevisionRef

use of org.jboss.pnc.dto.BuildConfigurationRevisionRef in project pnc by project-ncl.

the class BuildStatusMQNotifications method prepareHeaders.

private Map<String, String> prepareHeaders(BuildStatusChangedEvent event) {
    BuildConfigurationRevisionRef buildConfigurationAudited = event.getBuild().getBuildConfigRevision();
    Map<String, String> headers = new HashMap<>();
    headers.put("type", "BuildStateChange");
    headers.put("attribute", "state-change");
    headers.put("name", buildConfigurationAudited.getName());
    headers.put("configurationId", buildConfigurationAudited.getId());
    headers.put("configurationRevision", buildConfigurationAudited.getRev().toString());
    headers.put("oldStatus", toStringStatus(event.getOldStatus()));
    headers.put("newStatus", toStringStatus(event.getNewStatus()));
    return headers;
}
Also used : HashMap(java.util.HashMap) BuildConfigurationRevisionRef(org.jboss.pnc.dto.BuildConfigurationRevisionRef)

Example 7 with BuildConfigurationRevisionRef

use of org.jboss.pnc.dto.BuildConfigurationRevisionRef 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;
}
Also used : BuildConfigurationSet(org.jboss.pnc.model.BuildConfigurationSet) BuildTask(org.jboss.pnc.spi.coordinator.BuildTask) BuildSetTask(org.jboss.pnc.spi.coordinator.BuildSetTask) BuildConfigurationRevisionRef(org.jboss.pnc.dto.BuildConfigurationRevisionRef)

Aggregations

BuildConfigurationRevisionRef (org.jboss.pnc.dto.BuildConfigurationRevisionRef)7 ArrayList (java.util.ArrayList)2 Collections (java.util.Collections)2 HashMap (java.util.HashMap)2 List (java.util.List)2 Optional (java.util.Optional)2 Set (java.util.Set)2 Collectors (java.util.stream.Collectors)2 BuildConfigurationAudited (org.jboss.pnc.model.BuildConfigurationAudited)2 IdRev (org.jboss.pnc.model.IdRev)2 Logger (org.slf4j.Logger)2 LoggerFactory (org.slf4j.LoggerFactory)2 Preconditions (com.google.common.base.Preconditions)1 RestAssured.given (io.restassured.RestAssured.given)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 Field (java.lang.reflect.Field)1 Instant (java.time.Instant)1 Collection (java.util.Collection)1 HashSet (java.util.HashSet)1