예제 #1
0
 public void removeJob(String pipelineName, String stageName, String jobName) {
   CruiseConfig cruiseConfig = loadForEdit();
   PipelineConfig pipelineConfig =
       cruiseConfig.pipelineConfigByName(new CaseInsensitiveString(pipelineName));
   StageConfig stageConfig = pipelineConfig.findBy(new CaseInsensitiveString(stageName));
   JobConfig job = stageConfig.getJobs().getJob(new CaseInsensitiveString(jobName));
   stageConfig.getJobs().remove(job);
   writeConfigFile(cruiseConfig);
 }
예제 #2
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;
  }