示例#1
0
 public Tabs getCustomizedTabs(String pipelineName, String stageName, String buildName) {
   try {
     JobConfig plan =
         getCurrentConfig().jobConfigByName(pipelineName, stageName, buildName, false);
     return plan.getTabs();
   } catch (Exception e) {
     return new Tabs();
   }
 }
示例#2
0
 public long getUnresponsiveJobTerminationThreshold(JobIdentifier identifier) {
   JobConfig jobConfig = getJob(identifier);
   if (jobConfig == null) {
     return toMillis(Long.parseLong(serverConfig().getJobTimeout()));
   }
   String timeout = jobConfig.getTimeout();
   return timeout != null
       ? toMillis(Long.parseLong(timeout))
       : toMillis(Long.parseLong(serverConfig().getJobTimeout()));
 }
示例#3
0
 public boolean canCancelJobIfHung(JobIdentifier jobIdentifier) {
   JobConfig jobConfig = getJob(jobIdentifier);
   if (jobConfig == null) {
     return false;
   }
   String timeout = jobConfig.getTimeout();
   if ("0".equals(timeout)) {
     return false;
   }
   if (timeout == null && !"0".equals(serverConfig().getJobTimeout())) {
     return true;
   }
   return timeout != null && !"0".equals(timeout);
 }
示例#4
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);
 }