@JsonIgnore public Optional<Stage> getParentWithTimeout() { Stage current = this; Optional<Long> timeout = Optional.empty(); while (current != null && !timeout.isPresent()) { timeout = current.getTimeout(); if (!timeout.isPresent()) { current = current.getParent(); } } return timeout.isPresent() ? Optional.of(current) : Optional.empty(); }
.forEach( s -> { Integer index = execution.getStages().indexOf(s.getParent()); if (s.getSyntheticStageOwner() == STAGE_AFTER) { index++;
@VisibleForTesting Collection<String> upstreamImageIds(Stage sourceStage, Collection<String> consideredStageRefIds, String cloudProviderType) { List<Stage> ancestors = sourceStage.ancestors(); List<Stage> imageProvidingAncestorStages = ancestors.stream() .filter(stage -> { String cloudProvider = (String) stage.getContext().getOrDefault("cloudProvider", stage.getContext().get("cloudProviderType")); boolean consideredStageRefIdMatches = consideredStageRefIds == null || consideredStageRefIds.isEmpty() || consideredStageRefIds.contains(stage.getRefId()) || (stage.getParent() != null && consideredStageRefIds.contains(stage.getParent().getRefId())); return consideredStageRefIdMatches && (stage.getContext().containsKey("imageId") || stage.getContext().containsKey("amiDetails")) && cloudProviderType.equals(cloudProvider); }).collect(toList()); return imageProvidingAncestorStages.stream().map(it -> { if (it.getContext().containsKey("imageId")) { return (String) it.getContext().get("imageId"); } else { return (String) ((List<Map>) it.getContext().get("amiDetails")).get(0).get("imageId"); } }).collect(toList()); }
context.putAll(propagateParentStageContext(parent.getParent()));