use of com.thoughtworks.go.domain.materials.MaterialConfig in project gocd by gocd.
the class BasicCruiseConfig method materialConfigFor.
@Override
public MaterialConfig materialConfigFor(CaseInsensitiveString pipelineName, String fingerprint) {
PipelineConfig pipelineConfig = pipelineConfigByName(pipelineName);
MaterialConfigs materialConfigs = pipelineConfig.materialConfigs();
for (MaterialConfig materialConfig : materialConfigs) {
if (materialConfig.getFingerprint().equals(fingerprint)) {
return materialConfig;
}
}
return null;
}
use of com.thoughtworks.go.domain.materials.MaterialConfig in project gocd by gocd.
the class BasicCruiseConfig method getStagesUsedAsMaterials.
@Override
public Set<StageConfig> getStagesUsedAsMaterials(PipelineConfig pipelineConfig) {
Set<String> stagesUsedAsMaterials = new HashSet<>();
for (MaterialConfig materialConfig : getAllUniqueMaterials()) {
if (materialConfig instanceof DependencyMaterialConfig) {
DependencyMaterialConfig dep = (DependencyMaterialConfig) materialConfig;
stagesUsedAsMaterials.add(dep.getPipelineName() + "|" + dep.getStageName());
}
}
Set<StageConfig> stages = new HashSet<>();
for (StageConfig stage : pipelineConfig) {
if (stagesUsedAsMaterials.contains(pipelineConfig.name() + "|" + stage.name())) {
stages.add(stage);
}
}
return stages;
}
use of com.thoughtworks.go.domain.materials.MaterialConfig in project gocd by gocd.
the class BasicCruiseConfig method getUniqueMaterialConfigs.
private Set<MaterialConfig> getUniqueMaterialConfigs(boolean ignoreManualPipelines) {
Set<MaterialConfig> materialConfigs = new HashSet<>();
Set<Map> uniqueMaterials = new HashSet<>();
for (PipelineConfig pipelineConfig : pipelinesFromAllGroups()) {
for (MaterialConfig materialConfig : pipelineConfig.materialConfigs()) {
if (!uniqueMaterials.contains(materialConfig.getSqlCriteria())) {
if (ignoreManualPipelines && !materialConfig.isAutoUpdate() && materialConfig instanceof ScmMaterialConfig) {
continue;
}
materialConfigs.add(materialConfig);
uniqueMaterials.add(materialConfig.getSqlCriteria());
}
}
}
return materialConfigs;
}
use of com.thoughtworks.go.domain.materials.MaterialConfig in project gocd by gocd.
the class BasicCruiseConfig method getUniqueMaterials.
private Set<MaterialConfig> getUniqueMaterials(boolean ignoreManualPipelines, boolean ignoreConfigRepos) {
Set<MaterialConfig> materialConfigs = new HashSet<>();
Set<Map> uniqueMaterials = new HashSet<>();
for (PipelineConfig pipelineConfig : pipelinesFromAllGroups()) {
for (MaterialConfig materialConfig : pipelineConfig.materialConfigs()) {
if (!uniqueMaterials.contains(materialConfig.getSqlCriteria())) {
boolean shouldSkipPolling = !materialConfig.isAutoUpdate();
boolean scmOrPackageMaterial = !(materialConfig instanceof DependencyMaterialConfig);
if (ignoreManualPipelines && scmOrPackageMaterial && shouldSkipPolling) {
continue;
}
materialConfigs.add(materialConfig);
uniqueMaterials.add(materialConfig.getSqlCriteria());
}
}
}
if (!ignoreConfigRepos) {
for (ConfigRepoConfig configRepo : this.configRepos) {
MaterialConfig materialConfig = configRepo.getMaterialConfig();
if (!uniqueMaterials.contains(materialConfig.getSqlCriteria())) {
materialConfigs.add(materialConfig);
uniqueMaterials.add(materialConfig.getSqlCriteria());
}
}
}
return materialConfigs;
}
use of com.thoughtworks.go.domain.materials.MaterialConfig in project gocd by gocd.
the class BasicCruiseConfig method generatePipelineVsDownstreamMap.
@Override
public Map<String, List<PipelineConfig>> generatePipelineVsDownstreamMap() {
List<PipelineConfig> pipelineConfigs = getAllPipelineConfigs();
Map<String, List<PipelineConfig>> result = new HashMap<>();
for (PipelineConfig currentPipeline : pipelineConfigs) {
String currentPipelineName = currentPipeline.name().toString();
if (!result.containsKey(currentPipelineName)) {
result.put(currentPipelineName, new ArrayList<>());
}
for (MaterialConfig materialConfig : currentPipeline.materialConfigs()) {
if (materialConfig instanceof DependencyMaterialConfig) {
String pipelineWhichTriggersMe = ((DependencyMaterialConfig) materialConfig).getPipelineName().toString();
if (!result.containsKey(pipelineWhichTriggersMe)) {
result.put(pipelineWhichTriggersMe, new ArrayList<>());
}
result.get(pipelineWhichTriggersMe).add(currentPipeline);
}
}
}
return result;
}
Aggregations