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

Fix incomplete TaskRuns being deleted when --ignore-running=true #1708

Merged

Conversation

colinodell
Copy link
Contributor

@colinodell colinodell commented Sep 8, 2022

Changes

Fixes #1707 by replacing the logic used to determine if a TaskRun is "running".

Prior to this PR, we used an allowlist of reasons like Running, Pending, and Started. This did not account for some states where the TaskRun is still running, like when cancellation has been requested (but not completed), or when the TaskRun encounters a non-permanent error and is still running (like ExceededResourceQuota).

This PR fixes this by instead checking for the presence of a completionTime which would indicate that the TaskRun is no longer in a running or about-to-run state.

Additionally, to help confirm these changes work as expected in the test suite, output messages that previously said something like All TaskRuns were deleted were updated to include the actual number of TaskRuns deleted.

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)
  • Run the code checkers with make check
  • Regenerate the manpages, docs and go formatting with make generated
  • Commit messages follow commit message best practices

See the contribution guide
for more details.

Release Notes

- Fix --ignore-running=true unexpectedly deleting some TaskRuns in incomplete states
- Ensure TaskRun deletion command always shows the number of deleted objects

@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 8, 2022
@tekton-robot tekton-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Sep 8, 2022
@tekton-robot
Copy link
Contributor

Hi @colinodell. Thanks for your PR.

I'm waiting for a tektoncd member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Sep 8, 2022

CLA Signed

The committers listed above are authorized under a signed CLA.

@tekton-robot tekton-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 8, 2022
Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

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

/ok-to-test
/cc @pradeepitm12 @piyush-garg

@tekton-robot tekton-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Sep 8, 2022
@piyush-garg
Copy link
Contributor

@colinodell PR looks good, can you please squash the commits into 1

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 9, 2022
@tekton-robot tekton-robot removed the lgtm Indicates that a PR is ready to be merged. label Sep 9, 2022
@colinodell
Copy link
Contributor Author

Thanks! I've squashed the commits as requested :)

@piyush-garg
Copy link
Contributor

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 9, 2022
Copy link
Contributor

@pradeepitm12 pradeepitm12 left a comment

Choose a reason for hiding this comment

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

/lgtm

@tekton-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: pradeepitm12

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 9, 2022
@tekton-robot tekton-robot merged commit 94f424d into tektoncd:main Sep 9, 2022
pradeepitm12 added a commit to pradeepitm12/cli that referenced this pull request Oct 7, 2022
fix taskrun getting deleted of running pipelinerun tektoncd#1736

Fix incomplete TaskRuns being deleted when --ignore-running=true tektoncd#1708

Signed-off-by: Pradeep Kumar <pradkuma@redhat.com>
tekton-robot pushed a commit that referenced this pull request Oct 7, 2022
fix taskrun getting deleted of running pipelinerun #1736

Fix incomplete TaskRuns being deleted when --ignore-running=true #1708

Signed-off-by: Pradeep Kumar <pradkuma@redhat.com>
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. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. 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.

Incomplete TaskRuns deleted when --ignore-running=true
5 participants