apis: allow debug.breakpoints.beforeSteps without onFailure - #10591
Open
pujitha24 wants to merge 1 commit into
Open
apis: allow debug.breakpoints.beforeSteps without onFailure#10591pujitha24 wants to merge 1 commit into
pujitha24 wants to merge 1 commit into
Conversation
Motivation:
validateDebug in pkg/apis/pipeline/{v1,v1beta1}/taskrun_validation.go
unconditionally rejected any TaskRun with a non-nil debug.breakpoints
unless breakpoints.onFailure was also explicitly set to "enabled".
onFailure and beforeSteps are independent breakpoint types (onFailure
pauses after a step fails, beforeSteps pauses before a named step for
inspection), so a TaskRun that only wants beforeSteps was forced to
also set onFailure: enabled. Valid YAML like:
spec:
debug:
breakpoints:
beforeSteps:
- my-step
was rejected at admission with "onFailure breakpoint is empty, it is
only allowed to be set as enabled".
Approach:
Remove the `OnFailure == ""` rejection in both v1 and v1beta1 (the
duplicated validateDebug implementations are kept in lockstep). The
remaining check - that a non-empty onFailure must equal "enabled" -
is unchanged, so onFailure is now optional but still validated when
set. This is a narrower, separate concern from a prior fix to this
function (see tektoncd#7787) that
addressed redundant debug volumes appearing for an empty onFailure
value: that fix gates debug-volume creation in pkg/pod/pod.go on
Debug.NeedsDebug(), which already treats a fully-empty Breakpoints{}
(and a Breakpoints without onFailure=="enabled") as a no-op
independent of admission validation, so this change does not
reintroduce the redundant-volume behavior that earlier fix addressed.
A new test case locks in that a fully empty Breakpoints{} continues
to validate as a no-op.
User-visible behavior changes only in that a TaskRun using beforeSteps
without onFailure is now accepted instead of rejected at admission;
no runtime/pod behavior changes.
Validation:
- go build ./...
- go test ./pkg/apis/pipeline/v1/... ./pkg/apis/pipeline/v1beta1/...
(all pass)
- golangci-lint run --new-from-rev=HEAD on both packages: 0 new issues
(mirrors the repo's CI lint job, which lints only the diff against
the merge base)
- gofmt -l on the four changed files: clean
- Confirmed the fix with a failing-then-passing reproduction: stashing
only the two production taskrun_validation.go changes (keeping the
new test) makes the new "beforeSteps breakpoint without onFailure"
case fail with the old "onFailure breakpoint is empty" error in both
v1 and v1beta1; restoring the fix makes it pass.
/kind bug
```release-note
**TaskRun**: `debug.breakpoints.beforeSteps` can now be set without
also setting `debug.breakpoints.onFailure`. Previously, a TaskRun with
only `beforeSteps` configured was rejected at admission requiring
`onFailure: enabled` to also be set, even though the two breakpoint
types are independent.
```
Report: tektoncd#9719
Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com>
Assisted-by: Claude Sonnet 5 (via Claude Code)
Author
|
/assign @abayer This is rebased and green — happy to address any feedback. |
pujitha24
force-pushed
the
auto/issue-9719
branch
from
August 18, 2026 19:13
9a1eba1 to
42e6019
Compare
Collaborator
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
validateDebuginpkg/apis/pipeline/{v1,v1beta1}/taskrun_validation.gounconditionallyrejected any TaskRun with a non-nil
debug.breakpointsunlessbreakpoints.onFailurewasalso explicitly set to
"enabled".onFailureandbeforeStepsare independent breakpointtypes (
onFailurepauses after a step fails,beforeStepspauses before a named step forinspection), so a TaskRun that only wanted
beforeStepswas forced to also setonFailure: enabled. Valid YAML like:was rejected at admission with
"onFailure breakpoint is empty, it is only allowed to be set as enabled".This removes the
OnFailure == ""rejection in bothv1andv1beta1(the duplicatedvalidateDebugimplementations are kept in lockstep). The remaining check - that anon-empty
onFailuremust equal"enabled"- is unchanged, soonFailureis now optionalbut still validated when set.
This is a narrower, separate concern from the volume-cleanup fix from a previous change to
this function (#7787): that fix gates debug-volume creation in
pkg/pod/pod.goonDebug.NeedsDebug(), which already treats a fully-emptyBreakpoints{}(and aBreakpointswithoutonFailure=="enabled") as a no-op independent of admissionvalidation, so this change does not reintroduce the redundant-volume behavior that earlier
fix addressed. A new test case locks in that a fully empty
Breakpoints{}continues tovalidate as a no-op.
User-visible behavior changes only in that a TaskRun using
beforeStepswithoutonFailureis now accepted instead of rejected at admission; no runtime/pod behaviorchanges.
Validation performed:
go build ./...go test ./pkg/apis/pipeline/v1/... ./pkg/apis/pipeline/v1beta1/...(all pass)golangci-lint run --new-from-rev=HEAD ./pkg/apis/pipeline/v1/... ./pkg/apis/pipeline/v1beta1/...: 0 new issues (mirrors this repo's CI lint job, which lints only the diff against the merge base)gofmt -lon the four changed files: cleantaskrun_validation.gochanges (keeping the new test) makes the new"beforeSteps breakpoint without onFailure"case fail with the old"onFailure breakpoint is empty"error in bothv1andv1beta1; restoring the fix makes it pass.Submitter Checklist
As the author of this PR, please check off the items in this checklist:
/kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tepRelease Notes
Fixes #9719