community
community copied to clipboard
TEP-0156 : when-in-steps
Description
This pull request proposes the ability to define When Expressions directly within Steps. This allows for fine-grained control over step execution based on conditions like the status of previous steps, enabling more dynamic and adaptable workflows.
Overview
- Steps accept an optional when field with a list of When Expressions.
- When Expressions are evaluated at the entrypoint level, allowing access to previous step results.
- Skipped steps due to When Expressions have an exit code of 0 and a TerminationReason of Skipped.
- Both Operator-based and CEL expressions are supported.
- Variable substitution within When Expressions includes access to Task Results, Params, Workspaces, and Step Results.
/kind tep
/assign
@ericzzzzzzz can you please leave a short description of the TEP in the opening comment?
@tektoncd/core-maintainers PTAL π
@ericzzzzzzz can you please leave a short description of the TEP in the opening comment?
done! Thanks
/assign
/assign @vdemeester PTAL since you had suggested opening this. π
@vdemeester PTAL when you have a chance π
The lines between
TaskandPipelineare bluring more and more with this. An additionnal question, what happens if a step that write aTaskResultis skipped ?
I think the core difference between the fact that Pipeline can fan-out (Matrix, DAG) vs Task is sequential will always remain. So it might appear that lines are being blurred but what you can do with Pipelines vs Tasks will always be different. If Tasks was a DAG of Steps then I agree that the lines would be truly blurred.
I think the outcome will be the same as if the Step producing a TaskResult errored out. The Task author is controlling the flow of the StepAction/Step that is producing the result so they can choose. In this case, I think that the Task will error with the message that it could not produce a result (whatever the current behavior is if the Task does not generate a result)?
I think the outcome will be the same as if the Step producing a TaskResult errored out. The Task author is controlling the flow of the StepAction/Step that is producing the result so they can choose. In this case, I think that the Task will error with the message that it could not produce a result (whatever the current behavior is if the Task does not generate a result)?
Can we discuss this in the TEP ?
I think the outcome will be the same as if the Step producing a TaskResult errored out. The Task author is controlling the flow of the StepAction/Step that is producing the result so they can choose. In this case, I think that the Task will error with the message that it could not produce a result (whatever the current behavior is if the Task does not generate a result)?
Can we discuss this in the TEP ?
I added a section to capture this.
Sorry, one more thing,Β can we dig a bit more into examples of use case it would fullfill ?
For example
- having "optional" set of caching steps (using StepAction) if a parameter is the
Task- having a "report" and fail step if the previous step fails
- β¦ other use case we envision with this feature.
Hi, I added some examples.
Hi @vdemeester , I think I've addressed all the comments you provided on tep. Could you please take another look and let me know if there's anything else you'd like to discuss? Once you're happy with the tep, could you please provide your approval? Thanks!
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: chitrangpatel, vdemeester
The full list of commands accepted by this bot can be found here.
The pull request process is described here
- ~~teps/OWNERS~~ [chitrangpatel,vdemeester]
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
Thanks for your work @ericzzzzzzz and thanks for the detailed review Vincent!!
/lgtm