Search in sources :

Example 6 with StageConfig

use of com.thoughtworks.go.config.StageConfig in project gocd by gocd.

the class PipelineWithMultipleStages method scheduleAndCompleteFollowingStages.

protected void scheduleAndCompleteFollowingStages(Pipeline pipeline, JobResult result) {
    for (int index = 2; index <= stagesSize; index++) {
        StageConfig stageConfig = stageConfig(index);
        Stage instance = new InstanceFactory().createStageInstance(stageConfig, new DefaultSchedulingContext("anyone"), "md5-test", new TimeProvider());
        instance.setOrderId(index);
        dbHelper.getStageDao().saveWithJobs(pipeline, instance);
        dbHelper.completeStage(instance, result);
    }
}
Also used : TimeProvider(com.thoughtworks.go.util.TimeProvider) InstanceFactory(com.thoughtworks.go.server.service.InstanceFactory) Stage(com.thoughtworks.go.domain.Stage) StageConfig(com.thoughtworks.go.config.StageConfig) DefaultSchedulingContext(com.thoughtworks.go.domain.DefaultSchedulingContext)

Example 7 with StageConfig

use of com.thoughtworks.go.config.StageConfig in project gocd by gocd.

the class PipelineWithMultipleStages method moveStageToEnd.

public void moveStageToEnd(String stageName) {
    StageConfig config = configHelper.removeStage(pipelineName, stageName);
    configHelper.addStageToPipeline(pipelineName, config);
}
Also used : StageConfig(com.thoughtworks.go.config.StageConfig)

Example 8 with StageConfig

use of com.thoughtworks.go.config.StageConfig in project gocd by gocd.

the class PipelineMother method withTwoStagesOneBuildEach.

public static PipelineConfig withTwoStagesOneBuildEach(String pipelineName, String stageName, String stageName2) {
    StageConfig stageConfig1 = com.thoughtworks.go.helper.StageConfigMother.oneBuildPlanWithResourcesAndMaterials(stageName);
    StageConfig stageConfig2 = com.thoughtworks.go.helper.StageConfigMother.oneBuildPlanWithResourcesAndMaterials(stageName2);
    MaterialConfigs materialConfigs = MaterialConfigsMother.defaultMaterialConfigs();
    return new PipelineConfig(new CaseInsensitiveString(pipelineName), materialConfigs, stageConfig1, stageConfig2);
}
Also used : MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) PipelineConfig(com.thoughtworks.go.config.PipelineConfig) StageConfig(com.thoughtworks.go.config.StageConfig) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString)

Example 9 with StageConfig

use of com.thoughtworks.go.config.StageConfig in project gocd by gocd.

the class StageMother method completedStageInstanceWithTwoPlans.

public static Stage completedStageInstanceWithTwoPlans(String stageName) {
    StageConfig scheduledStageConfig = StageConfigMother.twoBuildPlansWithResourcesAndMaterials(stageName);
    Stage completed = scheduleInstance(scheduledStageConfig);
    passBuildInstancesOfStage(completed, new Date());
    return completed;
}
Also used : StageConfig(com.thoughtworks.go.config.StageConfig) Date(java.util.Date)

Example 10 with StageConfig

use of com.thoughtworks.go.config.StageConfig in project gocd by gocd.

the class StageMother method scheduledStage.

public static Stage scheduledStage(String pipelineName, int pipelineCounter, String stageName, int stageCounter, String buildName) {
    StageConfig stageConfig = StageConfigMother.oneBuildPlanWithResourcesAndMaterials(stageName, buildName);
    Stage stage = scheduleInstance(stageConfig);
    stage.setCounter(stageCounter);
    stage.setIdentifier(new StageIdentifier(pipelineName, pipelineCounter, "LABEL-" + pipelineCounter, stageName, "" + stageCounter));
    stage.setId(fakeId());
    for (JobInstance jobInstance : stage.getJobInstances()) {
        jobInstance.setIdentifier(new JobIdentifier(pipelineName, pipelineCounter, "LABEL-" + pipelineCounter, stageName, "" + stageCounter, buildName, fakeId()));
    }
    return stage;
}
Also used : StageConfig(com.thoughtworks.go.config.StageConfig)

Aggregations

StageConfig (com.thoughtworks.go.config.StageConfig)31 Test (org.junit.Test)12 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)11 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)8 TimeProvider (com.thoughtworks.go.util.TimeProvider)4 EnvironmentVariableConfig (com.thoughtworks.go.config.EnvironmentVariableConfig)3 EnvironmentVariablesConfig (com.thoughtworks.go.config.EnvironmentVariablesConfig)3 AgentConfig (com.thoughtworks.go.config.AgentConfig)2 Agents (com.thoughtworks.go.config.Agents)2 JobConfigs (com.thoughtworks.go.config.JobConfigs)2 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)2 DefaultSchedulingContext (com.thoughtworks.go.domain.DefaultSchedulingContext)2 NullStage (com.thoughtworks.go.domain.NullStage)2 Stage (com.thoughtworks.go.domain.Stage)2 InstanceFactory (com.thoughtworks.go.server.service.InstanceFactory)2 Map (java.util.Map)2 Gson (com.google.gson.Gson)1 AdminUser (com.thoughtworks.go.config.AdminUser)1 Approval (com.thoughtworks.go.config.Approval)1 AuthConfig (com.thoughtworks.go.config.AuthConfig)1