コード例 #1
0
 private void updateApproval(String pipelineName, String ftStage, Approval manualApproval) {
   CruiseConfig cruiseConfig = loadForEdit();
   PipelineConfig pipelineConfig =
       cruiseConfig.pipelineConfigByName(new CaseInsensitiveString(pipelineName));
   StageConfig config = pipelineConfig.findBy(new CaseInsensitiveString(ftStage));
   config.updateApproval(manualApproval);
   writeConfigFile(cruiseConfig);
 }
コード例 #2
0
 public StageConfig removeStage(String pipelineName, String stageName) {
   CruiseConfig cruiseConfig = loadForEdit();
   PipelineConfig pipelineConfig =
       cruiseConfig.pipelineConfigByName(new CaseInsensitiveString(pipelineName));
   StageConfig stageConfig = pipelineConfig.findBy(new CaseInsensitiveString(stageName));
   pipelineConfig.remove(stageConfig);
   writeConfigFile(cruiseConfig);
   return stageConfig;
 }
コード例 #3
0
 public void addEnvironmentVariableToStage(
     String pipelineName, String stageName, EnvironmentVariablesConfig envVars) {
   CruiseConfig cruiseConfig = loadForEdit();
   PipelineConfig pipelineConfig =
       cruiseConfig.pipelineConfigByName(new CaseInsensitiveString(pipelineName));
   StageConfig stageConfig = pipelineConfig.findBy(new CaseInsensitiveString(stageName));
   stageConfig.setVariables(envVars);
   writeConfigFile(cruiseConfig);
 }
コード例 #4
0
 public void removeJob(String pipelineName, String stageName, String jobName) {
   CruiseConfig cruiseConfig = loadForEdit();
   PipelineConfig pipelineConfig =
       cruiseConfig.pipelineConfigByName(new CaseInsensitiveString(pipelineName));
   StageConfig stageConfig = pipelineConfig.findBy(new CaseInsensitiveString(stageName));
   JobConfig job = stageConfig.getJobs().getJob(new CaseInsensitiveString(jobName));
   stageConfig.getJobs().remove(job);
   writeConfigFile(cruiseConfig);
 }
コード例 #5
0
 public void setRunMultipleInstance(
     String pipelineName, String stageName, String jobName, Integer runInstanceCount) {
   CruiseConfig config = loadForEdit();
   PipelineConfig pipelineConfig =
       config.pipelineConfigByName(new CaseInsensitiveString(pipelineName));
   pipelineConfig
       .findBy(new CaseInsensitiveString(stageName))
       .jobConfigByInstanceName(jobName, true)
       .setRunInstanceCount(runInstanceCount);
   writeConfigFile(config);
 }
コード例 #6
0
 public void setRunOnAllAgents(
     String pipelineName, String stageName, String jobName, boolean runOnAllAgents) {
   CruiseConfig config = loadForEdit();
   PipelineConfig pipelineConfig =
       config.pipelineConfigByName(new CaseInsensitiveString(pipelineName));
   pipelineConfig
       .findBy(new CaseInsensitiveString(stageName))
       .jobConfigByInstanceName(jobName, true)
       .setRunOnAllAgents(runOnAllAgents);
   writeConfigFile(config);
 }
コード例 #7
0
 private StageConfig pushJobIntoStage(
     String pipelineName, String stageName, JobConfig jobConfig, boolean clearExistingJobs) {
   CruiseConfig cruiseConfig = loadForEdit();
   PipelineConfig pipelineConfig =
       cruiseConfig.pipelineConfigByName(new CaseInsensitiveString(pipelineName));
   StageConfig stageConfig = pipelineConfig.findBy(new CaseInsensitiveString(stageName));
   if (clearExistingJobs) {
     stageConfig.allBuildPlans().clear();
   }
   stageConfig.allBuildPlans().add(jobConfig);
   writeConfigFile(cruiseConfig);
   return stageConfig;
 }
コード例 #8
0
 public void addResourcesFor(
     String pipelineName, String stageName, String jobName, String... resources) {
   CruiseConfig config = loadForEdit();
   PipelineConfig pipelineConfig =
       config.pipelineConfigByName(new CaseInsensitiveString(pipelineName));
   for (String resource : resources) {
     pipelineConfig
         .findBy(new CaseInsensitiveString(stageName))
         .jobConfigByConfigName(new CaseInsensitiveString(jobName))
         .addResource(resource);
   }
   writeConfigFile(config);
 }