-
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
Add check for skipping in When Expressions with Result variable replacement #3197
Conversation
examples/v1beta1/pipelineruns/pipelinerun-with-when-expressions.yaml
Outdated
Show resolved
Hide resolved
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
Can you confirm that the example you updated fails without your change? I also want to check, #3196 implies this is finally related but it sounds like that's a red herring and it's actually related to variable replacement? (I'm wondering also if makes sense to have an example/test that verifies that finally works properly with this as well) |
The following is the coverage report on the affected files.
|
@jerop, please add a unit test in I am trying to reproduce it through the integration test from examples. |
The following is the coverage report on the affected files.
|
@pritidesai thank you for the review! added a task to the when expressions example that reproduced the issue, and also added checks in the unit tests to ensure the taskruns are not created when variable replacement is used -- please have a look when you have a chance |
/kind bug |
Tasks with when expressions using variables that evaluated to false were mistakenly executed because it missed an additional check to validate that the task should be skipped after variable replacement. Fixes tektoncd#3188
The following is the coverage report on the affected files.
|
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.
I agree with @pritidesai about refactoring the code a bit - and @jerop with your analysis of trying to find a way to only have to check once so we dont have to worry about checking for skipped tasks correctly in two different places!
but let's tackle that after we get this fixed :D
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bobcatfish 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 |
Changes
tasks with when expressions using variables that evaluated to false were mistakenly executed because it didn't have an additional check to validate that the task should be skipped after task result variable replacement
the point where we excluded the tasks with when expressions containing static inputs or parameter variables (which are replaced earlier as read from the pipeline) is here:
pipeline/pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go
Lines 260 to 272 in 079a6c8
at that point, when expressions containing results don't have the variables replaced so they are not excluded -- that function is used here:
pipeline/pkg/reconciler/pipelinerun/pipelinerun.go
Lines 499 to 511 in 9064142
the task results are applied later, right after which we add this additional check to exclude the when expressions containing results:
pipeline/pkg/reconciler/pipelinerun/pipelinerun.go
Lines 522 to 527 in 9064142
Fixes #3188
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