示例#1
0
 GoAcl readAclBy(String pipelineName, String stageName) {
   PipelineConfig pipelineConfig = pipelineConfigNamed(new CaseInsensitiveString(pipelineName));
   StageConfig stageConfig = pipelineConfig.findBy(new CaseInsensitiveString(stageName));
   AdminsConfig adminsConfig = stageConfig.getApproval().getAuthConfig();
   List<CaseInsensitiveString> users = getAuthorizedUsers(adminsConfig);
   return new GoAcl(users);
 }
示例#2
0
 public JobConfigIdentifier translateToActualCase(JobConfigIdentifier identifier) {
   PipelineConfig pipelineConfig =
       getCurrentConfig()
           .pipelineConfigByName(new CaseInsensitiveString(identifier.getPipelineName()));
   String translatedPipelineName = CaseInsensitiveString.str(pipelineConfig.name());
   StageConfig stageConfig =
       pipelineConfig.findBy(new CaseInsensitiveString(identifier.getStageName()));
   if (stageConfig == null) {
     throw new StageNotFoundException(
         new CaseInsensitiveString(identifier.getPipelineName()),
         new CaseInsensitiveString(identifier.getStageName()));
   }
   String translatedStageName = CaseInsensitiveString.str(stageConfig.name());
   JobConfig plan = stageConfig.jobConfigByInstanceName(identifier.getJobName(), true);
   if (plan == null) {
     throw new JobNotFoundException(
         identifier.getPipelineName(), identifier.getStageName(), identifier.getJobName());
   }
   String translatedJobName = plan.translatedName(identifier.getJobName());
   return new JobConfigIdentifier(translatedPipelineName, translatedStageName, translatedJobName);
 }