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