use of jetbrains.buildServer.serverSide.BuildPromotion in project teamcity-rest by JetBrains.
the class ChangeRequest method getChangeFirstBuilds.
/**
* Experimental support only!
*/
@GET
@Path("/{changeLocator}/firstBuilds")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Get first builds of the matching change.", nickname = "getChangeFirstBuilds", hidden = true)
public Builds getChangeFirstBuilds(@ApiParam(format = LocatorName.CHANGE) @PathParam("changeLocator") String changeLocator, @QueryParam("fields") String fields) {
final SVcsModification change = myChangeFinder.getItem(changeLocator).getSVcsModification();
ChangeStatusProvider myStatusProvider = myServiceLocator.getSingletonService(ChangeStatusProvider.class);
ChangeStatus changeStatus = myStatusProvider.getMergedChangeStatus(change);
List<BuildPromotion> firstBuildsPromotions = changeStatus.getBuildTypesStatusMap().values().stream().filter(Objects::nonNull).collect(Collectors.toList());
return Builds.createFromBuildPromotions(firstBuildsPromotions, null, new Fields(fields), myBeanContext);
}
use of jetbrains.buildServer.serverSide.BuildPromotion in project teamcity-rest by JetBrains.
the class ChangeRequest method getChangeProblemsTree.
/**
* Experimental, subject to change
* @since 2021.2
*/
@GET
@Path("/{changeLocator}/problemsTree")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Get problems tree for the matching change.", nickname = "getChangeProblemsTree", hidden = true)
public ProblemOccurrencesTree getChangeProblemsTree(@ApiParam(format = LocatorName.CHANGE) @PathParam("changeLocator") String changeLocator, // todo: remove after ui migration
@QueryParam(ProblemOccurrencesTreeCollector.SUB_TREE_ROOT_ID) String subTreeRootId, @QueryParam("treeLocator") String treeLocatorText, @QueryParam("fields") String fields) {
final SVcsModification change = myChangeFinder.getItem(changeLocator).getSVcsModification();
ChangeStatusProvider myStatusProvider = myServiceLocator.getSingletonService(ChangeStatusProvider.class);
ChangeStatus changeStatus = myStatusProvider.getMergedChangeStatus(change);
Stream<BuildPromotion> firstBuildsPromotions = changeStatus.getBuildTypesStatusMap().values().stream().filter(Objects::nonNull);
Locator treeLocator = Locator.createPotentiallyEmptyLocator(treeLocatorText);
if (subTreeRootId != null) {
treeLocator.setDimension(ProblemOccurrencesTreeCollector.SUB_TREE_ROOT_ID, subTreeRootId);
}
return new ProblemOccurrencesTree(myProblemOccurrencesTreeCollector.getTreeFromBuildPromotions(firstBuildsPromotions, treeLocator), new Fields(fields), myBeanContext);
}
use of jetbrains.buildServer.serverSide.BuildPromotion in project teamcity-rest by JetBrains.
the class DownloadedArtifacts method getFilteredInfo.
@NotNull
private Map<SBuild, List<ArtifactInfo>> getFilteredInfo() {
Map<SBuild, List<ArtifactInfo>> result = new HashMap<>();
String buildLocatorText = myFields.getLocator();
FilterConditionChecker<BuildPromotion> buildFilter;
if (StringUtil.isNotEmpty(buildLocatorText)) {
Locator buildLocator = Locator.locator(buildLocatorText);
buildFilter = myBeanContext.getSingletonService(BuildPromotionFinder.class).getFilter(buildLocator);
buildLocator.checkLocatorFullyProcessed();
} else {
buildFilter = b -> true;
}
for (Map.Entry<Build, List<ArtifactInfo>> buildArtifacts : myArtifacts.getArtifacts().entrySet()) {
SBuild build = (SBuild) buildArtifacts.getKey();
if (!buildFilter.isIncluded(build.getBuildPromotion())) {
continue;
}
result.put(build, buildArtifacts.getValue());
}
return result;
}
use of jetbrains.buildServer.serverSide.BuildPromotion in project teamcity-rest by JetBrains.
the class Branch method getBuilds.
/**
* Experimental support only
*/
@XmlElement(name = "builds")
public Builds getBuilds() {
return ValueWithDefault.decideDefault(myFields.isIncluded("builds", false), () -> {
String buildsHref = null;
PagedSearchResult<BuildPromotion> builds = null;
final Fields buildsFields = myFields.getNestedField("builds");
final String buildsLocator = buildsFields.getLocator();
if (buildsLocator != null) {
builds = myBranch.getBuilds(buildsFields.getLocator());
buildsHref = BuildRequest.getBuildsHref(myBranch, buildsLocator);
} else {
buildsHref = BuildRequest.getBuildsHref(myBranch, null);
}
if (builds == null && buildsHref == null)
return null;
return Builds.createFromBuildPromotions(builds == null ? null : builds.myEntries, buildsHref == null ? null : new PagerData(buildsHref), buildsFields, myBeanContext);
});
}
use of jetbrains.buildServer.serverSide.BuildPromotion in project teamcity-rest by JetBrains.
the class ChangeRequest method getChangeFailedTestsTree.
/**
* Experimental, subject to change
* @since 2021.2
*/
@GET
@Path("/{changeLocator}/testsTree")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Get failed tests tree for the matching change.", nickname = "getChangeFailedTestsTree", hidden = true)
public TestScopeTree getChangeFailedTestsTree(@ApiParam(format = LocatorName.CHANGE) @PathParam("changeLocator") String changeLocator, // todo: remove after ui migration
@QueryParam(TestScopeTreeCollector.SUBTREE_ROOT_ID) String subTreeRootId, @QueryParam("treeLocator") String treeLocatorText, @QueryParam("fields") String fields) {
final SVcsModification change = myChangeFinder.getItem(changeLocator).getSVcsModification();
ChangeStatusProvider myStatusProvider = myServiceLocator.getSingletonService(ChangeStatusProvider.class);
ChangeStatus changeStatus = myStatusProvider.getMergedChangeStatus(change);
Stream<BuildPromotion> firstBuildsPromotions = changeStatus.getBuildTypesStatusMap().values().stream().filter(Objects::nonNull);
Locator treeLocator = Locator.createPotentiallyEmptyLocator(treeLocatorText);
if (subTreeRootId != null) {
treeLocator.setDimension(ProblemOccurrencesTreeCollector.SUB_TREE_ROOT_ID, subTreeRootId);
}
return new TestScopeTree(myTestScopeTreeCollector.getSlicedTreeFromBuildPromotions(firstBuildsPromotions, treeLocator), new Fields(fields), myBeanContext);
}
Aggregations