Search in sources :

Example 11 with PipelineConfig

use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.

the class DatabaseAccessHelper method saveTestPipelineWithoutSchedulingBuilds.

public Pipeline saveTestPipelineWithoutSchedulingBuilds(String pipelineName, String stageName, String... jobConfigNames) throws SQLException {
    PipelineConfig pipelineConfig = configurePipeline(pipelineName, stageName, jobConfigNames);
    Pipeline pipeline = scheduleWithFileChanges(pipelineConfig);
    clearAllBuildInstances(pipeline);
    return savePipelineWithStagesAndMaterials(pipeline);
}
Also used : PipelineConfig(com.thoughtworks.go.config.PipelineConfig)

Example 12 with PipelineConfig

use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.

the class PackageMaterialAddWithExistingPackageDefinitionCommand method updateConfig.

@Override
protected void updateConfig(CruiseConfig cruiseConfig) {
    PackageDefinition packageDefinition = getPackageDefinition(cruiseConfig);
    packageMaterialConfig.setPackageDefinition(packageDefinition);
    PipelineConfig pipelineConfig = cruiseConfig.pipelineConfigByName(new CaseInsensitiveString(pipeline));
    pipelineConfig.addMaterialConfig(packageMaterialConfig);
}
Also used : PipelineConfig(com.thoughtworks.go.config.PipelineConfig) PackageDefinition(com.thoughtworks.go.domain.packagerepository.PackageDefinition) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString)

Example 13 with PipelineConfig

use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.

the class PackageMaterialAddWithNewPackageDefinitionCommand method updateConfig.

@Override
protected void updateConfig(CruiseConfig cruiseConfig) {
    PackageDefinition packageDefinition = createNewPackageDefinition(cruiseConfig);
    packageMaterialConfig.setPackageDefinition(packageDefinition);
    PipelineConfig pipelineConfig = cruiseConfig.pipelineConfigByName(new CaseInsensitiveString(pipeline));
    pipelineConfig.addMaterialConfig(packageMaterialConfig);
}
Also used : PipelineConfig(com.thoughtworks.go.config.PipelineConfig) PackageDefinition(com.thoughtworks.go.domain.packagerepository.PackageDefinition) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString)

Example 14 with PipelineConfig

use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.

the class PipelineTemplateConfigViewModelTest method shouldSetConfigAttributesBasedOnExistingPipeline.

@Test
public void shouldSetConfigAttributesBasedOnExistingPipeline() {
    StageConfig stage1 = StageConfigMother.custom("stage_foo", "foo1", "foo2");
    StageConfig stage2 = StageConfigMother.custom("stage_bar", "bar1", "bar2");
    PipelineConfig pipeline = PipelineConfigMother.pipelineConfig("pipeline", stage1, stage2);
    PipelineTemplateConfigViewModel viewModel = new PipelineTemplateConfigViewModel(new PipelineTemplateConfig(), "", Arrays.asList(PipelineConfigMother.pipelineConfig("foo_bar"), pipeline));
    Map m = m("template", m(PipelineTemplateConfig.NAME, "template_name"), PipelineTemplateConfigViewModel.USE_EXISTING_PIPELINE, "1", PipelineTemplateConfigViewModel.SELECTED_PIPELINE_NAME, pipeline.name().toString());
    viewModel.setConfigAttributes(m);
    assertThat(viewModel.useExistingPipeline(), is(true));
    assertThat(viewModel.selectedPipelineName(), is(pipeline.name().toString()));
    PipelineTemplateConfig template = viewModel.templateConfig();
    assertThat(template.name(), is(new CaseInsensitiveString("template_name")));
    assertThat(template.size(), is(2));
    assertThat(template.get(0), is(stage1));
    assertThat(template.get(1), is(stage2));
}
Also used : PipelineConfig(com.thoughtworks.go.config.PipelineConfig) PipelineTemplateConfig(com.thoughtworks.go.config.PipelineTemplateConfig) Map(java.util.Map) StageConfig(com.thoughtworks.go.config.StageConfig) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Test(org.junit.Test)

Example 15 with PipelineConfig

use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.

the class MingleConfigService method mingleConfigForPipelineNamed.

public MingleConfig mingleConfigForPipelineNamed(String pipelineName, Username user, HttpLocalizedOperationResult result) {
    if (!securityService.hasViewPermissionForPipeline(user, pipelineName)) {
        result.unauthorized(LocalizedMessage.cannotViewPipeline(pipelineName), HealthStateType.unauthorisedForPipeline(pipelineName));
        return null;
    }
    PipelineConfig pipelineConfig = goConfigService.pipelineConfigNamed(new CaseInsensitiveString(pipelineName));
    MingleConfig mingleConfig = pipelineConfig.getMingleConfig();
    return mingleConfig.equals(new MingleConfig()) ? null : mingleConfig;
}
Also used : PipelineConfig(com.thoughtworks.go.config.PipelineConfig) MingleConfig(com.thoughtworks.go.config.MingleConfig) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString)

Aggregations

PipelineConfig (com.thoughtworks.go.config.PipelineConfig)285 Test (org.junit.jupiter.api.Test)185 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)142 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)52 TimeProvider (com.thoughtworks.go.util.TimeProvider)33 DependencyMaterial (com.thoughtworks.go.config.materials.dependency.DependencyMaterial)24 Test (org.junit.Test)23 DependencyMaterialConfig (com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig)21 HgMaterial (com.thoughtworks.go.config.materials.mercurial.HgMaterial)19 PipelineConfigs (com.thoughtworks.go.config.PipelineConfigs)17 MaterialConfig (com.thoughtworks.go.domain.materials.MaterialConfig)16 PackageMaterialConfig (com.thoughtworks.go.config.materials.PackageMaterialConfig)15 Materials (com.thoughtworks.go.config.materials.Materials)14 Date (java.util.Date)14 HgMaterialConfig (com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig)13 SvnMaterial (com.thoughtworks.go.config.materials.svn.SvnMaterial)13 StageConfig (com.thoughtworks.go.config.StageConfig)12 GitMaterialConfig (com.thoughtworks.go.config.materials.git.GitMaterialConfig)12 Pipeline (com.thoughtworks.go.domain.Pipeline)12 Modification (com.thoughtworks.go.domain.materials.Modification)12