-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feedback on Conditions #2635
Comments
As noted in tektoncd#2635, it is not very clear what a Condition is in the context of a Pipeline. And it is not clear how they work or what happens after. This commit use the concept with "Guards" to explain how to guard Task execution within a Pipeline using Condition resources. An example showing the flow when a Condition is not successfully evaluated is also added. /kind documentation
As noted in tektoncd#2635, it is not very clear what a Condition is in the context of a Pipeline. And it is not clear how they work or what happens after. This commit use the concept with "Guards" to explain how to guard Task execution within a Pipeline using Condition resources. An example showing the flow when a Condition is not successfully evaluated is also added. /kind documentation
As noted in #2635, it is not very clear what a Condition is in the context of a Pipeline. And it is not clear how they work or what happens after. This commit use the concept with "Guards" to explain how to guard Task execution within a Pipeline using Condition resources. An example showing the flow when a Condition is not successfully evaluated is also added. /kind documentation
Rotten issues close after 30d of inactivity. /close Send feedback to tektoncd/plumbing. |
Stale issues rot after 30d of inactivity. /lifecycle rotten Send feedback to tektoncd/plumbing. |
@tekton-robot: Closing this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/reopen I think a lot of the points @jlpettersson brought up are being addressed in the new conditions proposal https://github.com/tektoncd/community/blob/master/teps/0007-conditions-beta.md @jerop if you get a chance could you update this issue re. which of the issues above are being addressed and how? |
@bobcatfish: Reopened this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/assign jerop |
Thank you for the feedback @jlpettersson :) These are some ways we've addressed the feedback in the Conditions Beta work:
In the example in WhenExpressions, we reference the resources directly in the
Terminology was clarified in the TEP and used "guard" in the documentation
Instead of using
The
Clarified in the documentation that happens when a
Added a flexible skipping option using
do you have some use cases for this? for now, we've disallowed |
/close |
@jerop: Closing this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Expected Behavior
That "conditions" is easy to use and easy to understand.
Actual Behavior
Things actually work, the way I expect, almost. But it is not straightforward to understand.
Proposed improvements
In the conditional pipeline example, the word
from: [first-create-file]
within aresource
is very hard to detect. This dictate the task-ordering here. It would be easier to read if therunAfter
-syntax is used.Terminology, "condition" and "conditions" is probably technically correct. But in programming I am used that "conditionals" means based on this expression do this or else do that. In Tekton, the "conditions" acts as "guards" for the Task. In programming this concept is usually called "Guards", e.g. Guards in Rust, Guards in Erlang but the syntax may be e.g.
when:
as in previous links and in e.g. Kotlin when expressionexample:
If called "conditional", I imagine that the check is located in
(a)
and then do(b)
or(c)
based on evaluation. But if called "guard" (at least conceptually), I easier understand that it can be on e.g.(b)
just before the Task executed, as how it works on Tekton today.We do not distinguish an evaluation error and when a condition is evaluated as condition-not-met. In programming this is fine, because it is just "expression" that is evaluated to
true
orfalse
. But Tekton is dealing with a distributed system and things will fail.E.g. it may make sense to do a
retry
when an evaluation fails, but not when an evaluation of a condition evaluates to condition-not-met.There is still missing pieces here to correctly distinguish between an evaluation fail and condition-not-met
Can conditional-containers write
true
orfalse
as termination message andexit 0
on successful evaluation?Be able to negate a
Condition
. I have a use-case were I want to do X (e.g. deploy) when thePipelineRun
was triggered on master git-branch, OR do Y (e.g. create preview-environment) if thePipelineRun
was not triggered on master git-branch. Here I would like to use the sameCondition
(eg.conditionRef:
<name>
in example) on both, but negate it on one. But then it is important to fail both in case of an evaluation error occur, e.g. empty-string as branch-name (that is a configuration error).Unclear flow. E.g. what happens after a condition? It is a bit unclear, but I have tested.
If "condition" is set on
(c)
- e.g(c)
is guarded by a "condition". And when evaluated to false, the steps in(c)
is not evaluated, also Task(d)
is not evaluated. (as I expected). But(b)
and(e)
is evaluated, and thePipelineRun
successfully completed.Add option to continue after a Task-not-evaluated.
If the "condition" is evaluated to
false
on(c)
, I may want to execute(d)
anyway. TherunAfter:
-syntax is very clear and it is good to use few elements to dictate task-ordering (since it must be easyli understood by authors and readers). We could introduce some twist onrunAfter: ['c']
- to execute(d)
even if the condition on(c)
evaluates tofalse
. (Not if condition-evaluationfails
e.g.err
). E.g.runAfterUnconditionally: ['c']
.Related to: Conditionals: Configure what happens when a task is skipped due to condition failure #1023, Feature to disable a task in a Pipeline #1797 (comment), Simple if/conditional support for skipping #2127
Waiting for a branch that may be executed (in case
(c)
is guarded by a condition not met), as(f)
does withrunAfter:['d', 'e']
We should handle this, e.g. with that
(f)
use arunAfterOneOf:['d', 'e']
When a task run after (using
runAfter:
) a task that actually fail, a Pipeline author should be able to declare that the failed task wasn't so important, it was allowedToFail. This is different than condition-not-met. The task after the failed, should be able to actually check if the previous task failed using aCondition
(guard).But we still need a
finally:
pipelineTask, that also can have aCondition
.Related to: Conditionals: Configure what happens when a task is skipped due to condition failure #1023, Design: Failure Strategy for TaskRuns in a PipelineRun #1684 (comment), "Finally" tasks for Pipeline #2446
/kind design
The text was updated successfully, but these errors were encountered: