use of com.thoughtworks.go.domain.builder.Builder in project gocd by gocd.
the class BuildersTest method shouldNotSetAsCurrentBuilderIfNotRun.
@Test
public void shouldNotSetAsCurrentBuilderIfNotRun() throws Exception {
EnvironmentVariableContext environmentVariableContext = new EnvironmentVariableContext();
Builder builder = new CommandBuilder("echo", "", new File("."), new RunIfConfigs(FAILED), null, "");
Builders builders = new Builders(Collections.singletonList(builder), null, null, null, null);
builders.setIsCancelled(true);
builders.build(environmentVariableContext, "utf-8");
Builders expected = new Builders(Collections.singletonList(builder), null, null, null, null);
expected.setIsCancelled(true);
assertThat(builders, is(expected));
}
use of com.thoughtworks.go.domain.builder.Builder in project gocd by gocd.
the class BuildersTest method shouldNotCancelAnythingIfAllBuildersHaveRun.
@Test
public void shouldNotCancelAnythingIfAllBuildersHaveRun() throws Exception {
EnvironmentVariableContext environmentVariableContext = new EnvironmentVariableContext();
Builder builder = new StubBuilder(new RunIfConfigs(ANY));
Builders builders = new Builders(Collections.singletonList(builder), new StubGoPublisher(), null, null, null);
builders.build(environmentVariableContext, "utf-8");
builders.cancel(environmentVariableContext, "utf-8");
}
use of com.thoughtworks.go.domain.builder.Builder in project gocd by gocd.
the class AntTaskBuilder method createBuilder.
@Override
public Builder createBuilder(BuilderFactory builderFactory, AntTask task, Pipeline pipeline, UpstreamPipelineResolver resolver) {
String newWorkingDir = FileUtil.join(pipeline.defaultWorkingFolder(), task.workingDirectory());
String argument = task.arguments();
Builder cancelBuilder = builderFactory.builderFor(task.cancelTask(), pipeline, resolver);
return new CommandBuilder("ant", argument, new File(newWorkingDir), task.getConditions(), cancelBuilder, task.describe(), "BUILD FAILED");
}
use of com.thoughtworks.go.domain.builder.Builder in project gocd by gocd.
the class ExecTaskBuilder method createBuilder.
@Override
public Builder createBuilder(BuilderFactory builderFactory, ExecTask task, Pipeline pipeline, UpstreamPipelineResolver pipelineResolver) {
String workingDir = task.workingDirectory();
String command = task.command();
File newWorkingDir = workingDir == null ? pipeline.defaultWorkingFolder() : new File(applyBaseDirIfRelativeAndNormalize(pipeline.defaultWorkingFolder(), new File(workingDir)));
Builder builder = builderFactory.builderFor(task.cancelTask(), pipeline, pipelineResolver);
String description = task.describe();
if (!task.getArgList().isEmpty()) {
return new CommandBuilderWithArgList(command, task.getArgList().toStringArray(), newWorkingDir, task.getConditions(), builder, description);
} else {
return new CommandBuilder(command, task.getArgs(), newWorkingDir, task.getConditions(), builder, description);
}
}
use of com.thoughtworks.go.domain.builder.Builder in project gocd by gocd.
the class FetchTaskBuilder method createBuilder.
@Override
public Builder createBuilder(BuilderFactory builderFactory, AbstractFetchTask task, Pipeline pipeline, UpstreamPipelineResolver resolver) {
final JobIdentifier fetchFrom = resolveTargetJob(task, pipeline, resolver);
final Builder cancelBuilder = builderFactory.builderFor(task.cancelTask(), pipeline, resolver);
final ChecksumFileHandler checksumHandler = getChecksumHandler(task, pipeline.getName());
if (task instanceof FetchTask) {
return createFetchTaskBuilder((FetchTask) task, pipeline, fetchFrom, cancelBuilder, checksumHandler);
} else {
return createPluggableFetchTaskBuilder((FetchPluggableArtifactTask) task, pipeline, fetchFrom, cancelBuilder, checksumHandler);
}
}
Aggregations