Example #1
0
 public Pipeline schedulePipeline(
     PipelineConfig pipelineConfig, BuildCause buildCause, String approvedBy, final Clock clock) {
   Pipeline pipeline =
       instanceFactory.createPipelineInstance(
           pipelineConfig, buildCause, new DefaultSchedulingContext(approvedBy), md5, clock);
   return scheduleJobInstancesAndSavePipeline(pipeline);
 }
Example #2
0
 public Pipeline checkinRevisionsToBuild(
     ManualBuild build, PipelineConfig pipelineConfig, List<MaterialRevision> revisions) {
   return pipelineService.save(
       instanceFactory.createPipelineInstance(
           pipelineConfig,
           build.onModifications(new MaterialRevisions(revisions), false, null),
           new DefaultSchedulingContext(),
           "md5-test",
           new TimeProvider()));
 }
Example #3
0
 private Pipeline scheduleWithFileChanges(PipelineConfig pipelineConfig) {
   BuildCause buildCause = BuildCause.createWithModifications(modifyOneFile(pipelineConfig), "");
   saveRevs(buildCause.getMaterialRevisions());
   return instanceFactory.createPipelineInstance(
       pipelineConfig,
       buildCause,
       new DefaultSchedulingContext(GoConstants.DEFAULT_APPROVED_BY),
       md5,
       new TimeProvider());
 }
Example #4
0
 public Pipeline newPipelineWithFirstStageScheduled(PipelineConfig config) throws SQLException {
   Pipeline pipeline =
       instanceFactory.createPipelineInstance(
           config,
           BuildCause.createManualForced(
               modifyOneFile(
                   MaterialsMother.createMaterialsFromMaterialConfigs(config.materialConfigs()),
                   ModificationsMother.nextRevision()),
               Username.ANONYMOUS),
           new DefaultSchedulingContext(GoConstants.DEFAULT_APPROVED_BY),
           md5,
           new TimeProvider());
   savePipelineWithStagesAndMaterials(pipeline);
   return pipeline;
 }
Example #5
0
 public Pipeline schedulePipelineWithAllStages(
     PipelineConfig pipelineConfig, BuildCause buildCause) {
   buildCause.assertMaterialsMatch(pipelineConfig.materialConfigs());
   DefaultSchedulingContext defaultSchedulingContext =
       new DefaultSchedulingContext(GoConstants.DEFAULT_APPROVED_BY);
   Stages stages = new Stages();
   Pipeline pipeline =
       instanceFactory.createPipelineInstance(
           pipelineConfig, buildCause, defaultSchedulingContext, md5, new TimeProvider());
   for (StageConfig stageConfig : pipelineConfig) {
     stages.add(
         instanceFactory.createStageInstance(
             stageConfig, defaultSchedulingContext, md5, new TimeProvider()));
   }
   pipeline.setStages(stages);
   return scheduleJobInstancesAndSavePipeline(pipeline);
 }
Example #6
0
  public Pipeline rescheduleTestPipeline(String pipelineName, String stageName, String userName)
      throws SQLException {
    String[] jobConfigNames = new String[] {};
    PipelineConfig pipelineConfig = configurePipeline(pipelineName, stageName, jobConfigNames);

    BuildCause buildCause =
        BuildCause.createManualForced(
            modifyOneFile(
                MaterialsMother.createMaterialsFromMaterialConfigs(
                    pipelineConfig.materialConfigs()),
                ModificationsMother.currentRevision()),
            Username.ANONYMOUS);

    Pipeline pipeline =
        instanceFactory.createPipelineInstance(
            pipelineConfig,
            buildCause,
            new DefaultSchedulingContext(GoConstants.DEFAULT_APPROVED_BY),
            md5,
            new TimeProvider());
    return savePipelineWithStagesAndMaterials(pipeline);
  }