use of com.thoughtworks.go.domain.BuildLogElement in project gocd by gocd.
the class BuilderTest method shouldNotBuildIfTheJobIsCancelled.
@Test
public void shouldNotBuildIfTheJobIsCancelled() throws Exception {
CommandBuilder builder = new CommandBuilder("echo", "", new File("."), new RunIfConfigs(FAILED), new StubBuilder(), "");
builder.build(new BuildLogElement(), PASSED, goPublisher, environmentVariableContext, null);
assertThat(goPublisher.getMessage(), is(""));
}
use of com.thoughtworks.go.domain.BuildLogElement in project gocd by gocd.
the class Builders method build.
public JobResult build(EnvironmentVariableContext environmentVariableContext) {
JobResult result = JobResult.Passed;
for (Builder builder : builders) {
if (cancelStarted) {
return JobResult.Cancelled;
}
synchronized (this) {
currentBuilder = builder;
}
BuildLogElement buildLogElement = new BuildLogElement();
try {
builder.build(buildLogElement, RunIfConfig.fromJobResult(result.toLowerCase()), goPublisher, environmentVariableContext, taskExtension);
} catch (Exception e) {
result = JobResult.Failed;
}
buildLog.addContent(buildLogElement.getElement());
}
synchronized (this) {
currentBuilder = new NullBuilder();
}
if (cancelStarted) {
return JobResult.Cancelled;
}
return result;
}
use of com.thoughtworks.go.domain.BuildLogElement in project gocd by gocd.
the class Builder method cancel.
public void cancel(DefaultGoPublisher publisher, EnvironmentVariableContext environmentVariableContext, TaskExtension taskExtension) {
publisher.consumeLineWithPrefix("Start to execute cancel task: " + cancelBuilder.getDescription());
try {
cancelBuilder.build(new BuildLogElement(), publisher, environmentVariableContext, taskExtension);
publisher.consumeLineWithPrefix("Task is cancelled");
} catch (Exception e) {
LOGGER.error("", e);
}
}
Aggregations