本文整理汇总了Java中org.jenkinsci.plugins.workflow.actions.ErrorAction类的典型用法代码示例。如果您正苦于以下问题:Java ErrorAction类的具体用法?Java ErrorAction怎么用?Java ErrorAction使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ErrorAction类属于org.jenkinsci.plugins.workflow.actions包,在下文中一共展示了ErrorAction类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onNewHead
import org.jenkinsci.plugins.workflow.actions.ErrorAction; //导入依赖的package包/类
@Override
public void onNewHead(FlowNode node) {
if (isNamedStageStartNode(node)) {
publishBuildStatus(build, metadata, running, getRunningContexts().push(node), "");
} else if (isStageEndNode(node, getRunningContexts().peekNodeId())) {
ErrorAction error = node.getError();
if (error != null) {
if (error.getError() instanceof FlowInterruptedException) {
publishBuildStatus(build, metadata, canceled, getRunningContexts().pop(), "");
} else {
publishBuildStatus(build, metadata, failed, getRunningContexts().pop(), "");
}
} else {
publishBuildStatus(build, metadata, success, getRunningContexts().pop(), "");
}
}
}
示例2: killingParallel
import org.jenkinsci.plugins.workflow.actions.ErrorAction; //导入依赖的package包/类
@Test
public void killingParallel() throws Exception {
story.addStep(new Statement() {
@Override
public void evaluate() throws Throwable {
WorkflowJob p = story.j.jenkins.createProject(WorkflowJob.class, "p");
p.setDefinition(new CpsFlowDefinition(""
+ "node {\n"
+ " timeout(time:5, unit:'SECONDS') {\n"
+ " parallel(\n"
+ " a: { echo 'ShouldBeHere1'; sleep 10; echo 'NotHere' },\n"
+ " b: { echo 'ShouldBeHere2'; sleep 10; echo 'NotHere' },\n"
+ " );\n"
+ " echo 'NotHere'\n"
+ " }\n"
+ " echo 'NotHere'\n"
+ "}\n", true));
WorkflowRun b = story.j.assertBuildStatus(Result.ABORTED, p.scheduleBuild2(0).get());
// make sure things that are supposed to run do, and things that are NOT supposed to run do not.
story.j.assertLogNotContains("NotHere", b);
story.j.assertLogContains("ShouldBeHere1", b);
story.j.assertLogContains("ShouldBeHere2", b);
// we expect every sleep step to have failed
FlowGraphTable t = new FlowGraphTable(b.getExecution());
t.build();
for (Row r : t.getRows()) {
if (r.getNode() instanceof StepAtomNode) {
StepAtomNode a = (StepAtomNode) r.getNode();
if (a.getDescriptor().getClass() == SleepStep.DescriptorImpl.class) {
assertTrue(a.getAction(ErrorAction.class) != null);
}
}
}
}
});
}
示例3: createErrorDTO
import org.jenkinsci.plugins.workflow.actions.ErrorAction; //导入依赖的package包/类
public static ErrorDTO createErrorDTO(ErrorAction error) {
if (error != null) {
Throwable throwable = error.getError();
if (throwable != null) {
return new ErrorDTO(throwable.getMessage(), throwable.getClass().getName());
}
}
return null;
}