in server/src/jetbrains/buildServer/sharedResources/server/SharedResourcesContextProcessor.java [83:106]
public void updateParameters(@NotNull final BuildStartContext context) {
final SRunningBuild startingBuild = context.getBuild();
final BuildPromotionEx startingBuildPromotion = (BuildPromotionEx)startingBuild.getBuildPromotion();
final TLongHashSet compositeIds = new TLongHashSet();
// projectID -> Map of custom resources
final Map<String, Map<String, CustomResource>> projectTreeCustomResources = new HashMap<>();
// projectId -> Map of all resources
final Map<String, Map<String, Resource>> projectTreeResources = new HashMap<>();
// several locks on same resource may be taken by the chain
synchronized (o) {
if (TeamCityProperties.getBooleanOrTrue(SharedResourcesPluginConstants.RESOURCES_IN_CHAINS_ENABLED) && startingBuildPromotion.isPartOfBuildChain()) {
// get all dependent composite promotions
final List<BuildPromotionEx> depPromos = startingBuildPromotion.getDependentCompositePromotions();
// collect promotion ids of composite builds in chain.
// we don't need to check the values against them
depPromos.forEach(promo -> compositeIds.add(promo.getId()));
// some build promotions in composite chain may not have the locks stored -> we need to process and store locks
depPromos.stream()
.filter(promo -> !myLocksStorage.locksStored(promo))
.forEach(promo -> processBuild(context, promo, projectTreeResources, projectTreeCustomResources));
}
processBuild(context, startingBuild.getBuildPromotion(), projectTreeResources, projectTreeCustomResources);
}
}