-
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
WhenExpressions in Finally Tasks #3738
Conversation
closes #3438 |
The following is the coverage report on the affected files.
|
thanks @jerop, I haven't reviewed the PR yet but I would like to see |
i'd added reconciler tests in pipelinerun_test.go, will add more tests in pipelinefinally_test.go, thanks @pritidesai! /hold |
The following is the coverage report on the affected files.
|
@pritidesai I've added the tests in pipelinefinally_test.go, please take a look 🙏🏾 /hold cancel |
The following is the coverage report on the affected files.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: sbwsg 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:
Approvers can indicate their approval by writing |
/test check-pr-has-kind-label |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So far I've reviewed docs, examples and the end to end test - planning to come back and review the rest but dont want to lose this so far :)
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
/test check-pr-has-kind-label |
1 similar comment
/test check-pr-has-kind-label |
@jerop pipeline/pkg/reconciler/pipelinerun/resources/pipelinerunstate.go Lines 369 to 386 in 9850785
Can we please set
such that finally tasks being in the list of skipped tasks have the when expressions initialized.
After these changes:
|
The following is the coverage report on the affected files.
|
thanks for the review @pritidesai! 🙏🏾
makes sense to do it similarly to pipeline/pkg/reconciler/pipelinerun/resources/pipelinerunstate.go Lines 379 to 389 in c719b6a
|
thanks a bunch @jerop, great point 🙇♀️ |
Users can guard execution of `Tasks` using `WhenExpressions`, but that is currently not supported in `Finally Tasks`. This change adds support for `WhenExpressions` in `Finally Tasks` not only to provide efficient guarded execution but also to improve the reusability of `Tasks` in `Finally`. The proposal is described further in the [WhenExpressions in Finally Tasks TEP](https://github.com/tektoncd/community/blob/master/teps/0045-whenexpressions-in-finally-tasks.md). Given we've recently added support for `Results` and `Status` in `Finally Tasks`, this is an opportune time to enable `WhenExpressions` in `Finally Tasks`.
Thanks a bunch @jerop for this feature. I am having hard time understanding validation unit tests. I feel we have many overlapping tests. Ideally, would like to see the separate unit tests validating when expression syntax e.g. input and values are initialized, a valid operator is specified, etc. Now once we have validated the syntax, I don't see a need to have separate tests to validate the syntax again as part of either /lgtm |
The following is the coverage report on the affected files.
|
@pritidesai I agree, we need to refactor the validation testing -- can open an issue to track that |
/lgtm |
It was implemented in tektoncd/pipeline#3738
It was implemented in tektoncd/pipeline#3738
It was implemented in tektoncd/pipeline#3738
@@ -630,7 +630,7 @@ func (c *Reconciler) runNextSchedulableTask(ctx context.Context, pr *v1beta1.Pip | |||
} | |||
|
|||
for _, rprt := range nextRprts { | |||
if rprt == nil || rprt.Skip(pipelineRunFacts) { | |||
if rprt == nil || rprt.Skip(pipelineRunFacts) || rprt.IsFinallySkipped(pipelineRunFacts) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hey @jerop, based on my understanding, rprt.Skip(pipelineRunFacts)
returns false
for any finally task but rprt.IsFinallySkipped(pipelineRunFacts)
evaluates when expression and returns true
since the when expression evaluates to false
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but this would work, provided nextRprts
contains the finally tasks 🤣
Changes
Users can guard execution of
Tasks
usingWhenExpressions
, but thatis currently not supported in
Finally Tasks
.This change adds support for
WhenExpressions
inFinally Tasks
notonly to provide efficient guarded execution but also to improve the
reusability of
Tasks
inFinally
. The proposal is described further inthe WhenExpressions in Finally Tasks TEP.
Given we've recently added support for
Results
andStatus
inFinally Tasks
, this is an opportune time to enableWhenExpressions
in
Finally Tasks
./kind feature
Submitter Checklist
These are the criteria that every PR should meet, please check them off as you
review them:
See the contribution guide for more details.
Double check this list of stuff that's easy to miss:
cmd
dir, please updatethe release Task to build and release this image.
Reviewer Notes
If API changes are included, additive changes must be approved by at least two OWNERS and backwards incompatible changes must be approved by more than 50% of the OWNERS, and they must first be added in a backwards compatible way.
Release Notes