use of com.netflix.spinnaker.front50.api.model.pipeline.Pipeline.TYPE_TEMPLATED in project front50 by spinnaker.
the class PipelineTemplateController method getDependentConfigs.
@VisibleForTesting
List<String> getDependentConfigs(String templateId, boolean recursive) {
List<String> dependentConfigIds = new ArrayList<>();
List<String> templateIds = convertAllTemplateIdsToSources(templateId, recursive);
pipelineDAO.all().stream().filter(pipeline -> pipeline.getType() != null && pipeline.getType().equals(TYPE_TEMPLATED)).forEach(templatedPipeline -> {
String source;
try {
TemplateConfiguration config = objectMapper.convertValue(templatedPipeline.getConfig(), TemplateConfiguration.class);
source = config.getPipeline().getTemplate().getSource();
} catch (Exception e) {
return;
}
if (source != null && containsAnyIgnoreCase(source, templateIds)) {
dependentConfigIds.add(templatedPipeline.getId());
}
});
return dependentConfigIds;
}
use of com.netflix.spinnaker.front50.api.model.pipeline.Pipeline.TYPE_TEMPLATED in project front50 by spinnaker.
the class V2PipelineTemplateController method getDependentConfigs.
@VisibleForTesting
List<String> getDependentConfigs(String templateId) {
List<String> dependentConfigIds = new ArrayList<>();
String prefixedId = SPINNAKER_PREFIX + templateId;
pipelineDAO.all().stream().filter(pipeline -> pipeline.getType() != null && pipeline.getType().equals(TYPE_TEMPLATED)).forEach(templatedPipeline -> {
String source;
try {
TemplateConfiguration config = objectMapper.convertValue(templatedPipeline.getConfig(), TemplateConfiguration.class);
source = config.getPipeline().getTemplate().getSource();
} catch (Exception e) {
return;
}
if (source != null && source.equalsIgnoreCase(prefixedId)) {
dependentConfigIds.add(templatedPipeline.getId());
}
});
return dependentConfigIds;
}
Aggregations