Search in sources :

Example 21 with Builder

use of com.thoughtworks.go.domain.builder.Builder in project gocd by gocd.

the class BuildWorkEnvironmentVariablesTest method createAssignment.

private BuildAssignment createAssignment() {
    JobPlan plan = new DefaultJobPlan(new Resources(), new ArtifactPlans(), new ArtifactPropertiesGenerators(), -1, new JobIdentifier(PIPELINE_NAME, 1, "1", STAGE_NAME, "1", JOB_NAME, 123L), null, new EnvironmentVariablesConfig(), new EnvironmentVariablesConfig(), null);
    MaterialRevisions materialRevisions = materialRevisions();
    BuildCause buildCause = BuildCause.createWithModifications(materialRevisions, TRIGGERED_BY_USER);
    List<Builder> builders = new ArrayList<>();
    builders.add(new CommandBuilder("ant", "", dir, new RunIfConfigs(), new NullBuilder(), ""));
    return BuildAssignment.create(plan, buildCause, builders, dir);
}
Also used : CommandBuilder(com.thoughtworks.go.domain.builder.CommandBuilder) Builder(com.thoughtworks.go.domain.builder.Builder) NullBuilder(com.thoughtworks.go.domain.builder.NullBuilder) ArrayList(java.util.ArrayList) NullBuilder(com.thoughtworks.go.domain.builder.NullBuilder) BuildCause(com.thoughtworks.go.domain.buildcause.BuildCause) CommandBuilder(com.thoughtworks.go.domain.builder.CommandBuilder)

Example 22 with Builder

use of com.thoughtworks.go.domain.builder.Builder in project gocd by gocd.

the class BuildWorkArtifactUploadingTest method createAssignment.

private BuildAssignment createAssignment(ArtifactPlans artifactPlans, String[] fileToCreate) {
    MaterialRevisions materialRevisions = materialRevisions();
    BuildCause buildCause = BuildCause.createWithModifications(materialRevisions, "");
    List<Builder> builders = new ArrayList<>();
    builders.add(new CreateFileBuilder(fileToCreate));
    DefaultJobPlan plan = new DefaultJobPlan(new Resources(), artifactPlans, new ArtifactPropertiesGenerators(), -1, new JobIdentifier(PIPELINE_NAME, -2, "1", STAGE_NAME, "1", JOB_NAME), null, new EnvironmentVariablesConfig(), new EnvironmentVariablesConfig(), null);
    return BuildAssignment.create(plan, buildCause, builders, buildWorkingDirectory);
}
Also used : Builder(com.thoughtworks.go.domain.builder.Builder) NullBuilder(com.thoughtworks.go.domain.builder.NullBuilder) ArrayList(java.util.ArrayList) BuildCause(com.thoughtworks.go.domain.buildcause.BuildCause)

Example 23 with Builder

use of com.thoughtworks.go.domain.builder.Builder in project gocd by gocd.

the class BuildComposerTest method getAssigment.

private static BuildAssignment getAssigment(String jobXml, String pipelineName, boolean fetchMaterials, boolean cleanWorkingDir) throws Exception {
    CruiseConfig cruiseConfig = new MagicalGoConfigXmlLoader(new ConfigCache(), ConfigElementImplementationRegistryMother.withNoPlugins()).loadConfigHolder(withJob(jobXml, pipelineName)).config;
    JobConfig jobConfig = cruiseConfig.jobConfigByName(pipelineName, STAGE_NAME, JOB_PLAN_NAME, true);
    JobPlan jobPlan = JobInstanceMother.createJobPlan(jobConfig, new JobIdentifier(pipelineName, -2, PIPELINE_LABEL, STAGE_NAME, String.valueOf(STAGE_COUNTER), JOB_PLAN_NAME, 0L), new DefaultSchedulingContext());
    jobPlan.setFetchMaterials(fetchMaterials);
    jobPlan.setCleanWorkingDir(cleanWorkingDir);
    final Stage stage = StageMother.custom(STAGE_NAME, new JobInstance(JOB_PLAN_NAME));
    BuildCause buildCause = BuildCause.createWithEmptyModifications();
    final Pipeline pipeline = new Pipeline(pipelineName, buildCause, stage);
    pipeline.setLabel(PIPELINE_LABEL);
    List<Builder> builder = builderFactory.buildersForTasks(pipeline, jobConfig.getTasks(), resolver);
    return BuildAssignment.create(jobPlan, BuildCause.createWithEmptyModifications(), builder, pipeline.defaultWorkingFolder(), null, new ArtifactStores());
}
Also used : Builder(com.thoughtworks.go.domain.builder.Builder) BuildCause(com.thoughtworks.go.domain.buildcause.BuildCause)

Example 24 with Builder

use of com.thoughtworks.go.domain.builder.Builder in project gocd by gocd.

the class BuildWorkArtifactUploadingTest method createAssignment.

private BuildAssignment createAssignment(List<ArtifactPlan> artifactPlans, String[] fileToCreate) throws IOException {
    MaterialRevisions materialRevisions = materialRevisions();
    BuildCause buildCause = BuildCause.createWithModifications(materialRevisions, "");
    List<Builder> builders = new ArrayList<>();
    builders.add(new CreateFileBuilder(fileToCreate));
    DefaultJobPlan plan = new DefaultJobPlan(new Resources(), artifactPlans, new ArrayList<>(), -1, new JobIdentifier(PIPELINE_NAME, -2, "1", STAGE_NAME, "1", JOB_NAME), null, new EnvironmentVariables(), new EnvironmentVariables(), null);
    return BuildAssignment.create(plan, buildCause, builders, buildWorkingDirectory, new EnvironmentVariableContext(), new ArtifactStores());
}
Also used : ArtifactStores(com.thoughtworks.go.config.ArtifactStores) Builder(com.thoughtworks.go.domain.builder.Builder) NullBuilder(com.thoughtworks.go.domain.builder.NullBuilder) ArrayList(java.util.ArrayList) BuildCause(com.thoughtworks.go.domain.buildcause.BuildCause) EnvironmentVariableContext(com.thoughtworks.go.util.command.EnvironmentVariableContext)

Example 25 with Builder

use of com.thoughtworks.go.domain.builder.Builder in project gocd by gocd.

the class BuildWorkEnvironmentVariablesTest method createAssignment.

private BuildAssignment createAssignment(EnvironmentVariableContext environmentVariableContext) throws IOException {
    JobPlan plan = new DefaultJobPlan(new Resources(), new ArrayList<>(), new ArrayList<>(), -1, new JobIdentifier(PIPELINE_NAME, 1, "1", STAGE_NAME, "1", JOB_NAME, 123L), null, new EnvironmentVariables(), new EnvironmentVariables(), null);
    MaterialRevisions materialRevisions = materialRevisions();
    BuildCause buildCause = BuildCause.createWithModifications(materialRevisions, TRIGGERED_BY_USER);
    List<Builder> builders = new ArrayList<>();
    builders.add(new CommandBuilder("ant", "", dir, new RunIfConfigs(), new NullBuilder(), ""));
    return BuildAssignment.create(plan, buildCause, builders, dir, environmentVariableContext, new ArtifactStores());
}
Also used : ArtifactStores(com.thoughtworks.go.config.ArtifactStores) CommandBuilder(com.thoughtworks.go.domain.builder.CommandBuilder) Builder(com.thoughtworks.go.domain.builder.Builder) NullBuilder(com.thoughtworks.go.domain.builder.NullBuilder) ArrayList(java.util.ArrayList) NullBuilder(com.thoughtworks.go.domain.builder.NullBuilder) BuildCause(com.thoughtworks.go.domain.buildcause.BuildCause) CommandBuilder(com.thoughtworks.go.domain.builder.CommandBuilder)

Aggregations

Builder (com.thoughtworks.go.domain.builder.Builder)36 CommandBuilder (com.thoughtworks.go.domain.builder.CommandBuilder)13 Test (org.junit.Test)12 BuildCause (com.thoughtworks.go.domain.buildcause.BuildCause)9 NullBuilder (com.thoughtworks.go.domain.builder.NullBuilder)8 EnvironmentVariableContext (com.thoughtworks.go.util.command.EnvironmentVariableContext)6 File (java.io.File)6 ArrayList (java.util.ArrayList)6 Pipeline (com.thoughtworks.go.domain.Pipeline)5 TasksTest (com.thoughtworks.go.domain.TasksTest)5 FetchArtifactBuilder (com.thoughtworks.go.domain.builder.FetchArtifactBuilder)5 ArtifactStores (com.thoughtworks.go.config.ArtifactStores)4 PluggableTaskBuilder (com.thoughtworks.go.domain.builder.pluggableTask.PluggableTaskBuilder)4 ExecTask (com.thoughtworks.go.config.ExecTask)3 FetchPluggableArtifactBuilder (com.thoughtworks.go.domain.builder.FetchPluggableArtifactBuilder)3 JobResult (com.thoughtworks.go.domain.JobResult)2 RunIfConfigs (com.thoughtworks.go.domain.RunIfConfigs)2 StubGoPublisher (com.thoughtworks.go.domain.StubGoPublisher)2 StubBuilder (com.thoughtworks.go.domain.builder.StubBuilder)2 BuildWork (com.thoughtworks.go.remote.work.BuildWork)2