예제 #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 StageConfig toStage(CRStage crStage) {
   Approval approval = toApproval(crStage.getApproval());
   StageConfig stageConfig =
       new StageConfig(
           new CaseInsensitiveString(crStage.getName()),
           crStage.isFetchMaterials(),
           crStage.isCleanWorkingDir(),
           approval,
           crStage.isArtifactCleanupProhibited(),
           toJobConfigs(crStage.getJobs()));
   EnvironmentVariablesConfig environmentVariableConfigs = stageConfig.getVariables();
   for (CREnvironmentVariable crEnvironmentVariable : crStage.getEnvironmentVariables()) {
     environmentVariableConfigs.add(toEnvironmentVariableConfig(crEnvironmentVariable));
   }
   return stageConfig;
 }
예제 #3
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);
 }