Пример #1
0
 public PipelineTemplateConfig addTemplate(
     String pipelineName, Authorization authorization, String stageName) {
   CruiseConfig cruiseConfig = loadForEdit();
   PipelineTemplateConfig templateConfig =
       PipelineTemplateConfigMother.createTemplate(
           pipelineName, authorization, StageConfigMother.manualStage(stageName));
   cruiseConfig.getTemplates().add(templateConfig);
   writeConfigFile(cruiseConfig);
   return templateConfig;
 }
  @Test
  public void shouldReturnJsonForNullStage() throws Exception {
    final StageConfig config = StageConfigMother.oneBuildPlanWithResourcesAndMaterials("newStage");
    StageJsonPresentationModel presenter =
        new StageJsonPresentationModel(
            pipeline, NullStage.createNullStage(config), null, new Agents());
    Map json = presenter.toJson();

    new JsonTester((List) json.get("builds")).shouldContain("[{ 'current_status' : 'unknown' }]");
  }
Пример #3
0
 public PipelineConfig addPipelineWithInvalidMaterial(String pipelineName, String stageName) {
   CruiseConfig cruiseConfig = loadForEdit();
   StageConfig stageConfig = StageConfigMother.custom(stageName, defaultBuildPlans("buildName"));
   PipelineConfig pipelineConfig =
       new PipelineConfig(
           new CaseInsensitiveString(pipelineName),
           invalidRepositoryMaterialConfigs(),
           stageConfig);
   cruiseConfig.addPipeline(DEFAULT_GROUP, pipelineConfig);
   writeConfigFile(cruiseConfig);
   return pipelineConfig;
 }
Пример #4
0
  public PipelineConfig changeStagenameForToPipeline(
      String pipelineName, String oldStageName, String newStageName) {
    CruiseConfig config = loadForEdit();
    PipelineConfig pipelineConfig =
        config.pipelineConfigByName(new CaseInsensitiveString(pipelineName));

    StageConfig stage = pipelineConfig.getStage(new CaseInsensitiveString(oldStageName));
    int index = pipelineConfig.indexOf(stage);

    stage =
        StageConfigMother.custom(
            newStageName,
            stage.isFetchMaterials(),
            stage.isCleanWorkingDir(),
            stage.getJobs(),
            stage.getApproval());
    pipelineConfig.set(index, stage);

    writeConfigFile(config);
    return pipelineConfig;
  }