コード例 #1
0
 public void addAuthorizedUserForStage(String pipelineName, String stageName, String... users) {
   configureStageAsManualApproval(pipelineName, stageName);
   CruiseConfig cruiseConfig = loadForEdit();
   StageConfig stageConfig =
       cruiseConfig.stageConfigByName(
           new CaseInsensitiveString(pipelineName), new CaseInsensitiveString(stageName));
   Approval approval = stageConfig.getApproval();
   for (String user : users) {
     approval.getAuthConfig().add(new AdminUser(new CaseInsensitiveString(user)));
   }
   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;
  }