Exemplo n.º 1
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;
 }
 private Pipeline createAndLoadModifyOneFilePipeline(PipelineConfig pipelineConfig) {
   MaterialConfigs expandedConfigs =
       materialExpansionService.expandMaterialConfigsForScheduling(
           pipelineConfig.materialConfigs());
   MaterialRevisions materialRevisions =
       ModificationsMother.modifyOneFile(
           MaterialsMother.createMaterialsFromMaterialConfigs(expandedConfigs));
   Pipeline building = PipelineMother.buildingWithRevisions(pipelineConfig, materialRevisions);
   Pipeline pipeline = dbHelper.savePipelineWithMaterials(building);
   final long jobId = pipeline.getStages().get(0).getJobInstances().get(0).getId();
   return (Pipeline)
       transactionTemplate.execute(
           new TransactionCallback() {
             public Object doInTransaction(TransactionStatus status) {
               return loader.pipelineWithPasswordAwareBuildCauseByBuildId(jobId);
             }
           });
 }
Exemplo n.º 3
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);
  }
Exemplo n.º 4
0
 public Pipeline schedulePipeline(PipelineConfig pipelineConfig, Clock clock) {
   return schedulePipeline(
       pipelineConfig, ModificationsMother.modifySomeFiles(pipelineConfig), clock);
 }