Example #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);
 }
Example #2
0
 public void requireApproval(String pipelineName, String stageName) {
   CruiseConfig cruiseConfig = loadForEdit();
   cruiseConfig
       .pipelineConfigByName(new CaseInsensitiveString(pipelineName))
       .findBy(new CaseInsensitiveString(stageName))
       .updateApproval(Approval.manualApproval());
   writeConfigFile(cruiseConfig);
 }
Example #3
0
 public void configureStageAsManualApproval(String pipelineName, String stage) {
   updateApproval(pipelineName, stage, Approval.manualApproval());
 }
Example #4
0
 public void configureStageAsAutoApproval(String pipelineName, String stage) {
   updateApproval(pipelineName, stage, Approval.automaticApproval());
 }