Search in sources :

Example 86 with Pipeline

use of com.thoughtworks.go.domain.Pipeline in project gocd by gocd.

the class AutoTriggerDependencyResolutionTest method shouldResolveCorrectlyWhenAStageInvolvedInDependencyHasFailed.

/* TRIANGLE TEST END */
@Test
public void shouldResolveCorrectlyWhenAStageInvolvedInDependencyHasFailed() {
    int i = 1;
    GitMaterial git1 = u.wf(new GitMaterial("git1"), "folder");
    String[] git1_revs = { "g11", "g12" };
    u.checkinInOrder(git1, u.d(i++), git1_revs);
    GitMaterial git2 = u.wf(new GitMaterial("git2"), "folder-git2");
    String[] git2_revs = { "g21", "g22" };
    u.checkinInOrder(git2, u.d(i++), git2_revs);
    ScheduleTestUtil.AddedPipeline p1 = u.saveConfigWith("p1", u.m(git1));
    ScheduleTestUtil.AddedPipeline p2 = u.saveConfigWith("p2", u.m(p1));
    ScheduleTestUtil.AddedPipeline p3 = u.saveConfigWith("p3", u.m(p1));
    ScheduleTestUtil.AddedPipeline p4 = u.saveConfigWith("p4", u.m(git2));
    ScheduleTestUtil.AddedPipeline p5 = u.saveConfigWith("p5", u.m(p2), u.m(p3), u.m(p4));
    CruiseConfig cruiseConfig = goConfigDao.load();
    String p1_1 = u.runAndPassWithGivenMDUTimestampAndRevisionStrings(p1, u.d(i++), "g11");
    String p2_1 = u.runAndPassWithGivenMDUTimestampAndRevisionStrings(p2, u.d(i++), p1_1);
    String p3_1 = u.runAndPassWithGivenMDUTimestampAndRevisionStrings(p3, u.d(i++), p1_1);
    Pipeline p4_1 = u.runAndPassAndReturnPipelineInstance(p4, u.d(i++), "g21");
    String p4_1_2 = u.rerunStageAndCancel(p4_1, p4.config.getFirstStageConfig());
    MaterialRevisions given = u.mrs(u.mr(p2, true, p2_1), u.mr(p3, true, p3_1), u.mr(p4, true, p4_1.getStages().get(0).getIdentifier().getStageLocator()));
    assertThat(getRevisionsBasedOnDependencies(p5, cruiseConfig, given), is(given));
}
Also used : GitMaterial(com.thoughtworks.go.config.materials.git.GitMaterial) MaterialRevisions(com.thoughtworks.go.domain.MaterialRevisions) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) CruiseConfig(com.thoughtworks.go.config.CruiseConfig) Pipeline(com.thoughtworks.go.domain.Pipeline) Test(org.junit.Test)

Example 87 with Pipeline

use of com.thoughtworks.go.domain.Pipeline in project gocd by gocd.

the class BackupServiceH2IntegrationTest method saveAPipeline.

private Pipeline saveAPipeline() {
    PipelineConfig pipelineConfig = PipelineConfigMother.pipelineConfig("pipeline", new StageConfig(new CaseInsensitiveString("stage"), new JobConfigs(new JobConfig("job-one"))));
    pipelineConfig.materialConfigs().clear();
    SvnMaterialConfig onDirOne = MaterialConfigsMother.svnMaterialConfig("google.com", "dirOne", "loser", "boozer", false, "**/*.html");
    pipelineConfig.addMaterialConfig(onDirOne);
    Pipeline building = PipelineMother.building(pipelineConfig);
    return dbHelper.savePipelineWithMaterials(building);
}
Also used : SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig) Pipeline(com.thoughtworks.go.domain.Pipeline)

Example 88 with Pipeline

use of com.thoughtworks.go.domain.Pipeline in project gocd by gocd.

the class PipelineWithTwoStages method createPipelineWithFirstStageAssigned.

public Pipeline createPipelineWithFirstStageAssigned(String agentId) {
    Pipeline pipeline = createPipelineWithFirstStageScheduled();
    JobInstances instances = pipeline.getStages().byName(devStage).getJobInstances();
    for (JobInstance instance : instances) {
        dbHelper.assignToAgent(instance, agentId);
    }
    return dbHelper.getPipelineDao().loadPipeline(pipeline.getId());
}
Also used : JobInstance(com.thoughtworks.go.domain.JobInstance) Pipeline(com.thoughtworks.go.domain.Pipeline) JobInstances(com.thoughtworks.go.domain.JobInstances)

Example 89 with Pipeline

use of com.thoughtworks.go.domain.Pipeline in project gocd by gocd.

the class PipelineWithTwoStages method createPipelineWithFirstStageScheduled.

public Pipeline createPipelineWithFirstStageScheduled() {
    Pipeline mostRecent = dbHelper.getPipelineDao().mostRecentPipeline(pipelineName);
    bombIf(mostRecent.getStages().byName(devStage).isActive(), "Can not schedule new pipeline: the first stage is still running");
    Pipeline pipeline = schedulePipeline();
    dbHelper.savePipelineWithStagesAndMaterials(pipeline);
    return pipeline;
}
Also used : Pipeline(com.thoughtworks.go.domain.Pipeline)

Example 90 with Pipeline

use of com.thoughtworks.go.domain.Pipeline in project gocd by gocd.

the class PipelineWithRunOnAllJob method createPipelineWithFirstStagePassedAndSecondStageRunning.

public Pipeline createPipelineWithFirstStagePassedAndSecondStageRunning() {
    Pipeline pipeline = createPipelineWithFirstStageScheduled();
    dbHelper.passStage(pipeline.getFirstStage());
    dbHelper.scheduleStage(pipeline, pipelineConfig().findBy(new CaseInsensitiveString(ftStage)));
    return dbHelper.getPipelineDao().mostRecentPipeline(pipeline.getName());
}
Also used : Pipeline(com.thoughtworks.go.domain.Pipeline)

Aggregations

Pipeline (com.thoughtworks.go.domain.Pipeline)184 Test (org.junit.Test)122 Stage (com.thoughtworks.go.domain.Stage)33 Username (com.thoughtworks.go.server.domain.Username)30 MaterialRevision (com.thoughtworks.go.domain.MaterialRevision)29 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)24 HttpLocalizedOperationResult (com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult)24 PipelineMaterialRevision (com.thoughtworks.go.domain.PipelineMaterialRevision)21 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)20 JobInstance (com.thoughtworks.go.domain.JobInstance)19 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)13 JobIdentifier (com.thoughtworks.go.domain.JobIdentifier)13 Modification (com.thoughtworks.go.domain.materials.Modification)13 ServerHealthStateOperationResult (com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult)13 Date (java.util.Date)13 DependencyMaterial (com.thoughtworks.go.config.materials.dependency.DependencyMaterial)11 StageIdentifier (com.thoughtworks.go.domain.StageIdentifier)10 DependencyMaterialConfig (com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig)8 PipelineConfigDependencyGraph (com.thoughtworks.go.server.domain.PipelineConfigDependencyGraph)7 PipelineState (com.thoughtworks.go.domain.PipelineState)6