use of com.thoughtworks.go.domain.builder.Builder in project gocd by gocd.
the class BuildWorkTest method getWork.
private static Work getWork(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);
BuildAssignment buildAssignment = BuildAssignment.create(jobPlan, BuildCause.createWithEmptyModifications(), builder, pipeline.defaultWorkingFolder(), null, cruiseConfig.getArtifactStores());
return new BuildWork(buildAssignment, "utf-8");
}
use of com.thoughtworks.go.domain.builder.Builder in project gocd by gocd.
the class BuilderFactoryIntegrationTest method shouldCreateBuilderForFetchPluggableArtifactTask.
@Test
public void shouldCreateBuilderForFetchPluggableArtifactTask() {
final PipelineConfig pipelineConfig = goConfigService.pipelineConfigNamed(new CaseInsensitiveString("up42"));
goConfigService.artifactStores().add(new ArtifactStore("storeId", "PluginId"));
pipelineConfig.getStage("up42_stage").jobConfigByConfigName("up42_job").artifactConfigs().add(new PluggableArtifactConfig("artifactId", "storeId"));
final FetchPluggableArtifactTask pluggableArtifactTask = new FetchPluggableArtifactTask(new CaseInsensitiveString("up42"), new CaseInsensitiveString("up42_stage"), new CaseInsensitiveString("up42_job"), "artifactId");
final Pipeline pipeline = new Pipeline("up42", BuildCause.createExternal());
final Builder builder = builderFactory.builderFor(pluggableArtifactTask, pipeline, upstreamResolver);
assertThat(builder, instanceOf(FetchPluggableArtifactBuilder.class));
}
use of com.thoughtworks.go.domain.builder.Builder in project gocd by gocd.
the class BuilderMother method createBuildersAssumingAllExecTasks.
public static List<Builder> createBuildersAssumingAllExecTasks(CruiseConfig config, String pipelineName, String stageName, String jobName) {
Tasks tasks = config.jobConfigByName(pipelineName, stageName, jobName, true).getTasks();
ArrayList<Builder> builders = new ArrayList<>();
for (Task task : tasks) {
builders.add(builderFor((ExecTask) task));
}
return builders;
}
use of com.thoughtworks.go.domain.builder.Builder in project gocd by gocd.
the class JobRunnerTest method getWork.
private BuildWork getWork(JobConfig jobConfig) {
CruiseConfig config = new BasicCruiseConfig();
config.server().setArtifactsDir("logs");
String stageName = "mingle";
String pipelineName = "pipeline1";
config.addPipeline(BasicPipelineConfigs.DEFAULT_GROUP, new PipelineConfig(new CaseInsensitiveString(pipelineName), new MaterialConfigs(), new StageConfig(new CaseInsensitiveString(stageName), new JobConfigs(jobConfig))));
String pipelineLabel = "100";
JobPlan jobPlan = JobInstanceMother.createJobPlan(jobConfig, new JobIdentifier(pipelineName, -2, pipelineLabel, stageName, "100", JOB_PLAN_NAME, 0L), new DefaultSchedulingContext());
jobPlan.setFetchMaterials(true);
jobPlan.setCleanWorkingDir(false);
List<Builder> builder = BuilderMother.createBuildersAssumingAllExecTasks(config, pipelineName, stageName, JOB_PLAN_NAME);
BuildAssignment buildAssignment = BuildAssignment.create(jobPlan, BuildCause.createWithEmptyModifications(), builder, new File(CruiseConfig.WORKING_BASE_DIR + pipelineName));
return new BuildWork(buildAssignment);
}
use of com.thoughtworks.go.domain.builder.Builder in project gocd by gocd.
the class FetchTaskBuilder method createBuilder.
@Override
public Builder createBuilder(BuilderFactory builderFactory, FetchTask task, Pipeline pipeline, UpstreamPipelineResolver resolver) {
JobIdentifier fetchFrom = resolveTargetJob(task, pipeline, resolver);
Builder cancelBuilder = builderFactory.builderFor(task.cancelTask(), pipeline, resolver);
return new FetchArtifactBuilder(task.getConditions(), cancelBuilder, task.describe(), fetchFrom, task.getSrc(), task.getDest(), getHandler(task, pipeline.getName()), getChecksumHandler(task, pipeline.getName()));
}
Aggregations