Skip to content
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

When expression + affinity assistant fixes for 0.16.2 #3225

Merged
merged 5 commits into from
Sep 14, 2020

Conversation

bobcatfish
Copy link
Collaborator

@bobcatfish bobcatfish commented Sep 14, 2020

Changes

  1. Cherry-pick fixes for WhenExpressions are neglected when finally tasks are present #3196 If the WhenExpression of the task is evaluated to false immediately after the pipelinerun is started, the pipelinerun stays in "Running(Started)" state #3203 and using WhenExpressions, skipped task runs #3188 into 0.16.x branch so we can do 0.16.2 release with critical when expression fixes. Thanks @pritidesai and @jerop !!
  2. Cherry-pick fix for Failed to delete StatefulSet "affinity-assistant-9edfd8d72f" not found #3205. Thanks @jlpettersson

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

  • Includes tests (if functionality changed/added)
  • Includes docs (if user facing)
  • Commit messages follow commit message best practices
  • Release notes block has been filled in or deleted (only if no user facing changes)

See the contribution guide for more details.

Double check this list of stuff that's easy to miss:

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

Fix to honor When expressions in presence of finally tasks. When expression parameters were not getting resolved in presence of finally tasks and were causing check to skip always return false. Applied fix to when expression parameters resolution function to make sure parameters are substituted with its respective values.
Fix pipelinerun to apply task results to the leaf nodes of DAG before checking if its time to run finally tasks so that when expressions have resolved task results before the check.
Fix pipelinerun to detect and terminate by only evaluating when expressions when all its parents are visited/done instead of evaluating in advance. 
`Tasks` with `WhenExpressions` using variable replacements were not executed when the `WhenExpressions` evaluate to false
Omit potential NotFound events when cleaning up the Affinity Assistant.

jerop and others added 4 commits September 14, 2020 14:22
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

(cherry picked from commit c12b843)
Add more information to the docs about using `Results` in
`WhenExpressions`.

Specifically:

- add details and examples on how Results are used in WhenExpressions
in addition to Parameters
- change the name of the result used in the WhenExpressions examples,
from status to exists to clarify that it's not the task status

(cherry picked from commit 5b5fbb4)
- Rename the tasks to be clear when they are expected to be skipped
- Add comments describing what each task in the example is testing
- Embed the pipeline in the pipelinerun and generate the name

Co-authored-by: [email protected]
(cherry picked from commit c38c520)
Instead of creating a new empty array and appending resolved when
expression, creating an array based on the existing one and replacing
in place the resolved when expression.

Also, do not evaluate when expressions until all parents are done,
wait for parent tasks to be completed before evaluating when expressions.
This check will make sure that tasks resulting in when expressions
failures, are not declared skipped in advance before their parents are done.

With when expressions having reference to task results, evaluate and apply
task results before checking if its to run finally tasks. This change is
necessary to make sure all the leaf nodes of DAG have resolved task results in
their when expressions to evaluate whether DAG is done or not. This change
of order works today since finally tasks does not need to resolve task results
yet. Once we add task results support in finally, we will have to make one
more call to apply task results after adding finally tasks to execution queue.

(cherry picked from commit c90461f)
@tekton-robot tekton-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Sep 14, 2020
@tekton-robot tekton-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 14, 2020
@bobcatfish bobcatfish added the kind/bug Categorizes issue or PR as related to a bug. label Sep 14, 2020
@jerop
Copy link
Member

jerop commented Sep 14, 2020

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 14, 2020
The PipelineRun reconciler cleanup the affinity assistant
when the PipelineRun is completed. If the cleanup-function
is called more than once, the DELETE request will return
a NotFound response. It does not make sense to return NotFound
responses as an error, since this is what we want to achieve.

(cherry picked from commit 204a403)
@tekton-robot tekton-robot removed the lgtm Indicates that a PR is ready to be merged. label Sep 14, 2020
@bobcatfish bobcatfish changed the title When expression fixes for 0.16.2 When expression + affinity assistant fixes for 0.16.2 Sep 14, 2020
@bobcatfish
Copy link
Collaborator Author

I've added #3212 as well - will need another lgtm (+ approve!) :)

@jlpettersson
Copy link
Member

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 14, 2020
Copy link
Member

@pritidesai pritidesai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks a bunch 🥰

@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: pritidesai

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 14, 2020
@tekton-robot tekton-robot merged commit 4e23d50 into tektoncd:release-v0.16.x Sep 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants