Search in sources :

Example 1 with GoConfigCloner

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);
}
Also used : MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) PipelineConfig(com.thoughtworks.go.config.PipelineConfig) GoConfigCloner(com.thoughtworks.go.config.GoConfigCloner) ConfigParamPreprocessor(com.thoughtworks.go.config.preprocessor.ConfigParamPreprocessor) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString)

Aggregations

CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)1 GoConfigCloner (com.thoughtworks.go.config.GoConfigCloner)1 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)1 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)1 ConfigParamPreprocessor (com.thoughtworks.go.config.preprocessor.ConfigParamPreprocessor)1