Add on_abort to Job and Step schemas
This commit is contained in:
@@ -374,10 +374,11 @@ public class PipelineYmlSchema implements YamlSchema {
|
||||
for (AbstractType subStep : stepTypes) {
|
||||
addProp(step, subStep, "on_success", step);
|
||||
addProp(step, subStep, "on_failure", step);
|
||||
addProp(step, subStep, "on_abort", step);
|
||||
addProp(step, subStep, "ensure", step);
|
||||
addProp(step, subStep, "attempts", t_strictly_pos_integer);
|
||||
addProp(step, subStep, "tags", t_strings);
|
||||
addProp(step, subStep, "timeout", t_duration);
|
||||
addProp(step, subStep, "attempts", t_strictly_pos_integer);
|
||||
}
|
||||
models.setStepType(step);
|
||||
|
||||
@@ -392,8 +393,9 @@ public class PipelineYmlSchema implements YamlSchema {
|
||||
addProp(job, "disable_manual_trigger", t_boolean);
|
||||
addProp(job, "interruptible", t_boolean);
|
||||
addProp(job, "ensure", step);
|
||||
addProp(job, "on_failure", step);
|
||||
addProp(job, "on_success", step);
|
||||
addProp(job, "on_failure", step);
|
||||
addProp(job, "on_abort", step);
|
||||
|
||||
AbstractType resourceType = f.ybean("ResourceType");
|
||||
addProp(resourceType, "name", resourceTypeNameDef).isPrimary(true);
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
*Optional*. Step to execute when the job aborts. Equivalent to the `on_abort` step attribute.
|
||||
@@ -0,0 +1,14 @@
|
||||
Any step can have `on_abort` tacked onto it, whose value is a second step to execute only if the parent step aborts.
|
||||
If the attached step succeeds, the entire step is still `aborted`.
|
||||
|
||||
##Example: Cleanup on Abort
|
||||
|
||||
The following will perform the cleanup task only if the build is aborted while the unit task was running:
|
||||
|
||||
plan:
|
||||
- get: foo
|
||||
- task: unit
|
||||
file: foo/unit.yml
|
||||
on_abort:
|
||||
task: cleanup
|
||||
file: foo/cleanup.yml
|
||||
@@ -372,6 +372,8 @@ public class ConcourseEditorTest {
|
||||
" some_param: some_value\n" +
|
||||
" trigger: true\n" +
|
||||
" attempts: 10\n" +
|
||||
" on_abort:\n" +
|
||||
" - bogus: bad\n" +
|
||||
" on_failure:\n" +
|
||||
" - bogus: bad\n" +
|
||||
" on_success:\n" +
|
||||
@@ -384,6 +386,7 @@ public class ConcourseEditorTest {
|
||||
editor.assertHoverContains("params", "A map of arbitrary configuration");
|
||||
editor.assertHoverContains("trigger", "Set to `true` to auto-trigger");
|
||||
editor.assertHoverContains("attempts", "Any step can set the number of times it should be attempted");
|
||||
editor.assertHoverContains("on_abort", "step to execute only if the parent step aborts");
|
||||
editor.assertHoverContains("on_failure", "Any step can have `on_failure` tacked onto it");
|
||||
editor.assertHoverContains("on_success", "Any step can have `on_success` tacked onto it");
|
||||
editor.assertHoverContains("ensure", "a second step to execute regardless of the result of the parent step");
|
||||
@@ -3443,6 +3446,8 @@ public class ConcourseEditorTest {
|
||||
" put: code\n" +
|
||||
" ensure:\n" +
|
||||
" put: code\n" +
|
||||
" on_abort:\n" +
|
||||
" put: code\n" +
|
||||
"resources:\n" +
|
||||
"- name: code\n" +
|
||||
" type: git\n" +
|
||||
@@ -3461,6 +3466,7 @@ public class ConcourseEditorTest {
|
||||
editor.assertHoverContains("interruptible", "worker will not wait on the builds");
|
||||
editor.assertHoverContains("on_success", "Step to execute when the job succeeds");
|
||||
editor.assertHoverContains("on_failure", "Step to execute when the job fails");
|
||||
editor.assertHoverContains("on_abort", "Step to execute when the job aborts");
|
||||
editor.assertHoverContains("ensure", "Step to execute regardless");
|
||||
}
|
||||
|
||||
@@ -3528,6 +3534,7 @@ public class ConcourseEditorTest {
|
||||
"ensure",
|
||||
"interruptible",
|
||||
"max_in_flight",
|
||||
"on_abort",
|
||||
"on_failure",
|
||||
"on_success",
|
||||
"serial",
|
||||
@@ -3542,6 +3549,7 @@ public class ConcourseEditorTest {
|
||||
"→ file",
|
||||
"→ image",
|
||||
"→ input_mapping",
|
||||
"→ on_abort",
|
||||
"→ on_failure",
|
||||
"→ on_success",
|
||||
"→ output_mapping",
|
||||
|
||||
Reference in New Issue
Block a user