use of com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig in project gocd by gocd.
the class FetchArtifactViewHelper method createPipelineConfigForTemplate.
private PipelineConfig createPipelineConfigForTemplate() {
List<PipelineConfig> pipelineConfigs = cruiseConfig.allPipelines();
PipelineConfig dummyPipeline = new PipelineConfig();
for (PipelineConfig pipelineConfig : pipelineConfigs) {
dummyPipeline.addMaterialConfig(new DependencyMaterialConfig(pipelineConfig.name(), pipelineConfig.last().name()));
}
PipelineTemplateConfig pipelineTemplateConfig = cruiseConfig.getTemplates().templateByName(pipelineName);
for (StageConfig stageConfig : pipelineTemplateConfig) {
if (stageName.equals(stageConfig.name())) {
break;
}
dummyPipeline.add(stageConfig);
}
return dummyPipeline;
}
use of com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig in project gocd by gocd.
the class DependencyFanInNode method getRevisionNthFor.
private Pair<StageIdentifier, List<FaninScmMaterial>> getRevisionNthFor(int n, FanInGraphContext context) {
List<FaninScmMaterial> scmMaterials = new ArrayList<>();
PipelineTimeline pipelineTimeline = context.pipelineTimeline;
Queue<PipelineTimelineEntry.Revision> revisionQueue = new ConcurrentLinkedQueue<>();
DependencyMaterialConfig dependencyMaterial = (DependencyMaterialConfig) materialConfig;
PipelineTimelineEntry entry = pipelineTimeline.instanceFor(dependencyMaterial.getPipelineName(), totalInstanceCount - n);
Set<CaseInsensitiveString> visitedNodes = new HashSet<>();
StageIdentifier dependentStageIdentifier = dependentStageIdentifier(context, entry, CaseInsensitiveString.str(dependencyMaterial.getStageName()));
if (!StageIdentifier.NULL.equals(dependentStageIdentifier)) {
addToRevisionQueue(entry, revisionQueue, scmMaterials, context, visitedNodes);
} else {
return null;
}
while (!revisionQueue.isEmpty()) {
PipelineTimelineEntry.Revision revision = revisionQueue.poll();
DependencyMaterialRevision dmr = DependencyMaterialRevision.create(revision.revision, null);
PipelineTimelineEntry pte = pipelineTimeline.getEntryFor(new CaseInsensitiveString(dmr.getPipelineName()), dmr.getPipelineCounter());
addToRevisionQueue(pte, revisionQueue, scmMaterials, context, visitedNodes);
}
return new Pair<>(dependentStageIdentifier, scmMaterials);
}
use of com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig in project gocd by gocd.
the class FanInGraph method buildRestOfTheGraph.
private void buildRestOfTheGraph(DependencyFanInNode root, PipelineConfig target, Set<String> scmMaterialSet, Set<DependencyMaterialConfig> visitedNodes) {
for (MaterialConfig material : target.materialConfigs()) {
FanInNode node = createNode(material);
root.children.add(node);
node.parents.add(root);
if (node instanceof DependencyFanInNode) {
DependencyMaterialConfig dependencyMaterial = (DependencyMaterialConfig) material;
fingerprintDepMaterialMap.put(dependencyMaterial.getFingerprint(), dependencyMaterial);
handleDependencyMaterial(scmMaterialSet, dependencyMaterial, (DependencyFanInNode) node, visitedNodes);
} else {
handleScmMaterial(scmMaterialSet, material);
}
}
}
use of com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig in project gocd by gocd.
the class FanInGraph method getPipelineScmDepMap.
public Map<DependencyMaterialConfig, Set<MaterialConfig>> getPipelineScmDepMap() {
Map<DependencyMaterialConfig, Set<MaterialConfig>> dependencyMaterialListMap = new HashMap<>();
for (Map.Entry<DependencyMaterialConfig, Set<String>> materialSetEntry : dependencyMaterialFingerprintMap.entrySet()) {
Set<MaterialConfig> scmMaterials = new HashSet<>();
for (String fingerprint : materialSetEntry.getValue()) {
scmMaterials.add(fingerprintScmMaterialMap.get(fingerprint));
}
dependencyMaterialListMap.put(materialSetEntry.getKey(), scmMaterials);
}
return dependencyMaterialListMap;
}
use of com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig in project gocd by gocd.
the class ReportingDependencyFanInNode method getRevisionNthFor.
private Pair<StageIdentifier, List<ReportingFaninScmMaterial>> getRevisionNthFor(int n, ReportingFanInGraphContext context) {
List<ReportingFaninScmMaterial> scmMaterials = new ArrayList<>();
PipelineTimeline pipelineTimeline = context.pipelineTimeline;
Queue<PipelineTimelineEntry.Revision> revisionQueue = new ConcurrentLinkedQueue<>();
DependencyMaterialConfig dependencyMaterial = (DependencyMaterialConfig) materialConfig;
PipelineTimelineEntry entry = pipelineTimeline.instanceFor(dependencyMaterial.getPipelineName(), totalInstanceCount - n);
StageIdentifier dependentStageIdentifier = dependentStageIdentifier(context, entry, CaseInsensitiveString.str(dependencyMaterial.getStageName()));
if (!StageIdentifier.NULL.equals(dependentStageIdentifier)) {
addToRevisionQueue(entry, revisionQueue, scmMaterials, context);
} else {
return null;
}
while (!revisionQueue.isEmpty()) {
PipelineTimelineEntry.Revision revision = revisionQueue.poll();
DependencyMaterialRevision dmr = DependencyMaterialRevision.create(revision.revision, null);
PipelineTimelineEntry pte = pipelineTimeline.getEntryFor(new CaseInsensitiveString(dmr.getPipelineName()), dmr.getPipelineCounter());
addToRevisionQueue(pte, revisionQueue, scmMaterials, context);
}
return new Pair<>(dependentStageIdentifier, scmMaterials);
}
Aggregations