-
-
Save dibyom/92dfd6ea20f13f5c769a21389df53977 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
---- | |
# 1. change execution graph i.e. onSuccess do something onFailure do something else: | |
- name: task1 | |
taskRef: { name: "my-task" } | |
- name: runIfTask1Fails | |
runAfter: ["task1"] | |
runOn: ["failure"] | |
- name: runIfTask1Succeeds | |
runAfter: task1 | |
runOn: ["success"] | |
--- | |
# 1. change execution graph i.e. onSuccess do something onFailure do something else: | |
- name: task1 | |
conditions: | |
conditionRef: "condition-that-sometime-fails" | |
taskRef: { name: "my-task" } | |
- name: runIfTask1Fails | |
runAfter: task1 | |
runOn: ["failure"] | |
- name: runIfTask1Succeeds | |
runAfter: task1 | |
runOn: ["success"] | |
- name: runIfTask1IsSkipped | |
runAfter: task1 | |
runOn: ["skip"] | |
--- | |
# shorthand for "success", "failure", "skip" | |
- name: integration-tests | |
- name: cleanup | |
runAfter: ["integration-tests"] | |
runOn: ["always"] # can also be runOn: ["success", "failure"] | |
--- | |
# multiple tasks - e.g. results for sharded tests | |
- name: integration-tests-1 | |
- name: integration-tests-2 | |
- name: publish-test-results | |
runAfter: ["integration-tests-1", "integration-tests-2"] | |
runOn: ["always"] # can also be runOn: ["success", "failure"] | |
--- | |
# multiple tasks - combination of success or skip | |
- name: conditional-task-1 | |
- name: conditional-task-2 | |
- name: task-3 | |
runAfter: ["conditional-task-1", "conditional-task-2"] | |
runOn: ["success", "skip"] # task-3 is run if 1 and 2 are success but is not run if either of them is failure | |
--- | |
# always do something - publish results, task level updates, cleanup etc. | |
- name: task1 | |
- name: task2 | |
runAfter: task1 | |
runOn: ["always"] | |
-- | |
# I only want this task to run if some complex conditions are true | |
- name: task1 | |
- name: task2 | |
- name: task-3 | |
conditions: | |
conditionRef: "my-complex-condition" # e.g. if task1 fails but task2 does not. or if task1, task2 succeed and the moon is blue | |
runAfter: ["task-1", "task-2"] | |
runOn: ["always"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think such tasks should be classified as having "skip" state and dont see any reason to differentiate them. When a task is not run due to condition failure should be marked as skipped.