Skip to content

Conversation

@waveywaves
Copy link
Member

Changes

fixes #8824

the validation webhook was blocking all updates when PipelineRun.IsDone() returned true, preventing from clearing finalizers

to make sure that we don't have old obj default drift we are adding a fast path check for spec equality and are normalizing the old spec with current defaults before comparison. Then we allow updates when only finalizers differ and reject spec changes

Submitter Checklist

As the author of this PR, please check off the items in this checklist:

  • Has Docs if any changes are user facing, including updates to minimum requirements e.g. Kubernetes version bumps
  • Has Tests included if any functionality added or changed
  • pre-commit Passed
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including functionality, content, code)
  • Has a kind label. You can add one by adding a comment on this PR that contains /kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep
  • Release notes block below has been updated with any user facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings). See some examples of good release notes.
  • Release notes contains the string "action required" if the change requires additional action from users switching to the new release

Release Notes

NONE

/kind bug

@tekton-robot tekton-robot added release-note-none Denotes a PR that doesnt merit a release note. kind/bug Categorizes issue or PR as related to a bug. labels Sep 2, 2025
@tekton-robot tekton-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 2, 2025
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1/pipelinerun_validation.go 93.8% 93.4% -0.4
pkg/apis/pipeline/v1beta1/pipelinerun_validation.go 95.7% 95.3% -0.4

@waveywaves waveywaves force-pushed the fix-8824-allow-finalizer-updates-completed-pipelineruns branch from c9fa199 to c1731a2 Compare September 2, 2025 19:29
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1/pipelinerun_validation.go 93.8% 93.4% -0.4
pkg/apis/pipeline/v1beta1/pipelinerun_validation.go 95.7% 95.3% -0.4

@vdemeester
Copy link
Member

/retest

1 similar comment
@waveywaves
Copy link
Member Author

/retest

@l-qing
Copy link
Member

l-qing commented Sep 3, 2025

Your implementation is very clever, avoiding unnecessary copying. 👍
Actually, TaskRun has a similar issue and needs similar handling.

I've encountered a similar problem recently, so I can close my PR #9004 and wait for yours to be merged. 😆

Copy link
Contributor

@khrm khrm left a comment

Choose a reason for hiding this comment

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

Isn't there a similar webhook validation on taskrun?

@waveywaves
Copy link
Member Author

/retest

@waveywaves
Copy link
Member Author

@l-qing looks like we opened for this issue around the same time :) also thanks for pointing out this is the same issue in taskruns, I am pusshing a commit for it now

@khrm yes looks like this issue is happening in taskruns as well, sending an update now

@tekton-robot tekton-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 4, 2025
@waveywaves waveywaves force-pushed the fix-8824-allow-finalizer-updates-completed-pipelineruns branch from 56787b8 to e48696a Compare September 4, 2025 08:52
@waveywaves waveywaves changed the title fix: allow finalizer updates on completed PipelineRuns fix: allow finalizer updates on completed TaskRun and PipelineRuns Sep 4, 2025
fixes issue tektoncd#8824 where webhook denied finalizer updates on completed
PipelineRuns. The validation webhook was blocking all updates when
PipelineRun.IsDone() returned true, preventing from
clearing finalizers

to make sure that we don't have old obj default drift we are adding
a fast path check for spec equality and are normalizing the old spec
with current defaults before comparison. Then we allow updates when
only finalizers differ and reject spec changes

Signed-off-by: Vibhav Bobade <vibhav.bobde@gmail.com>
Similar to issue tektoncd#8824 for PipelineRuns, the webhook was denying
finalizer updates on completed TaskRuns. The validation webhook was
blocking all updates when TaskRun.IsDone() returned true, preventing
tools like Tekton Chains from clearing finalizers.

To ensure we don't have old obj default drift, we are adding
a fast path check for spec equality and are normalizing the old spec
with current defaults before comparison. Then we allow updates when
only finalizers differ and reject spec changes.

This mirrors the fix applied to PipelineRun validation.
@waveywaves waveywaves force-pushed the fix-8824-allow-finalizer-updates-completed-pipelineruns branch from e48696a to ce87dde Compare September 4, 2025 08:58
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1/pipelinerun_validation.go 93.8% 93.4% -0.4
pkg/apis/pipeline/v1/taskrun_validation.go 97.4% 96.9% -0.5
pkg/apis/pipeline/v1beta1/pipelinerun_validation.go 95.7% 95.3% -0.4
pkg/apis/pipeline/v1beta1/taskrun_validation.go 98.1% 97.5% -0.6

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1/pipelinerun_validation.go 93.8% 93.4% -0.4
pkg/apis/pipeline/v1/taskrun_validation.go 97.4% 96.9% -0.5
pkg/apis/pipeline/v1beta1/pipelinerun_validation.go 95.7% 95.3% -0.4
pkg/apis/pipeline/v1beta1/taskrun_validation.go 98.1% 97.5% -0.6

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1/pipelinerun_validation.go 93.8% 93.4% -0.4
pkg/apis/pipeline/v1/taskrun_validation.go 97.4% 96.9% -0.5
pkg/apis/pipeline/v1beta1/pipelinerun_validation.go 95.7% 95.3% -0.4
pkg/apis/pipeline/v1beta1/taskrun_validation.go 98.1% 97.5% -0.6

@waveywaves
Copy link
Member Author

/retest

@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 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:

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 4, 2025
@vdemeester
Copy link
Member

/retest

Copy link
Contributor

@khrm khrm 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
Collaborator

@khrm: changing LGTM is restricted to collaborators

In response to this:

/lgtm

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.

@vdemeester
Copy link
Member

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 4, 2025
@tekton-robot tekton-robot merged commit eaf7dc1 into tektoncd:main Sep 4, 2025
64 of 69 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in Tekton Community Roadmap Sep 4, 2025
@khrm
Copy link
Contributor

khrm commented Sep 4, 2025

/cherry-pick release-v1.0.x

@khrm
Copy link
Contributor

khrm commented Sep 4, 2025

/cherry-pick release-v1.3.x

@waveywaves
Copy link
Member Author

cherry pick automation hasn't been working, manually cherry picking them

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-none Denotes a PR that doesnt merit a release note. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Unable to clear Finalizers resulting in the PR/TRs even with deletiontimestamp stuck in the cluster

5 participants