tektoncd / community

Community documentation for the Tekton project
https://tekton.dev
Apache License 2.0
360 stars 221 forks source link

TEP-0156 : when-in-steps #1147

Closed ericzzzzzzz closed 1 month ago

ericzzzzzzz commented 3 months ago

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

chitrangpatel commented 2 months ago

/kind tep

chitrangpatel commented 2 months ago

/assign

chitrangpatel commented 2 months ago

@ericzzzzzzz can you please leave a short description of the TEP in the opening comment?

chitrangpatel commented 2 months ago

@tektoncd/core-maintainers PTAL πŸ™

ericzzzzzzz commented 2 months ago

@ericzzzzzzz can you please leave a short description of the TEP in the opening comment?

done! Thanks

afrittoli commented 2 months ago

/assign

chitrangpatel commented 2 months ago

/assign @vdemeester PTAL since you had suggested opening this. πŸ™

chitrangpatel commented 1 month ago

@vdemeester PTAL when you have a chance πŸ™

chitrangpatel commented 1 month ago

The lines between Task and Pipeline are bluring more and more with this. An additionnal question, what happens if a step that write a TaskResult is 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)?

vdemeester commented 1 month ago

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 ?

ericzzzzzzz commented 1 month ago

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.

ericzzzzzzz commented 1 month ago

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.

ericzzzzzzz commented 1 month ago

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!

tekton-robot commented 1 month ago

[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

Needs approval from an approver in each of these files: - ~~[teps/OWNERS](https://github.com/tektoncd/community/blob/main/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
chitrangpatel commented 1 month ago

Thanks for your work @ericzzzzzzz and thanks for the detailed review Vincent!!

/lgtm