use of com.thoughtworks.go.config.GoConfigCloner in project gocd by gocd.
the class AbstractMaterialTestController method performParamExpansion.
private void performParamExpansion(ScmMaterialConfig scmMaterialConfig, String pipelineName) {
PipelineConfig pipelineConfig;
// If the pipeline name is provided, find the pipeline and add the params to the new pipeline config object
if (isNotBlank(pipelineName)) {
PipelineConfig existingPipeline = goConfigService.pipelineConfigNamed(new CaseInsensitiveString(pipelineName));
pipelineConfig = new PipelineConfig(existingPipeline.name(), new MaterialConfigs());
GoConfigCloner goConfigCloner = new GoConfigCloner();
pipelineConfig.setParams(goConfigCloner.deepClone(existingPipeline.getParams()));
} else {
// If the pipeline name is not provided, this means that the pipeline is still in creation nd hence no params exist
pipelineConfig = new PipelineConfig(new CaseInsensitiveString(""), new MaterialConfigs());
}
pipelineConfig.addMaterialConfig(scmMaterialConfig);
ConfigParamPreprocessor configParamPreprocessor = new ConfigParamPreprocessor();
configParamPreprocessor.process(pipelineConfig);
}
Aggregations