Skip to content

Commit add0dae

Browse files
committed
Remove deprecated PipelineRunSpecStatusCancelledDeprecated
Fixes #4611. We deprecated the original cancelled status (with the value `PipelineRunCancelled`) in #3915, and we're now at the time for it to be removed in favor of the value `Cancelled`. Signed-off-by: Andrew Bayer <[email protected]>
1 parent e13e6bf commit add0dae

File tree

11 files changed

+122
-168
lines changed

11 files changed

+122
-168
lines changed

docs/deprecations.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ being deprecated.
1919

2020
| Feature Being Deprecated | Deprecation Announcement | [API Compatibility Policy](https://github.com/tektoncd/pipeline/tree/main/api_compatibility_policy.md) | Earliest Date or Release of Removal |
2121
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------|-------------------------------------|
22-
| [`PipelineRunCancelled` is deprecated and will be removed](https://github.com/tektoncd/pipeline/issues/4611) | [v0.25.0](https://github.com/tektoncd/pipeline/releases/tag/v0.25.0) | Beta | July 12 2022 |
2322
| [`PipelineResources` are deprecated.](https://github.com/tektoncd/community/blob/main/teps/0074-deprecate-pipelineresources.md) | [v0.30.0](https://github.com/tektoncd/pipeline/releases/tag/v0.30.0) | Alpha | Dec 20 2021 |
2423
| [The `PipelineRun.Status.TaskRuns` and `PipelineRun.Status.Runs` fields are deprecated and will be removed.](https://github.com/tektoncd/community/blob/main/teps/0100-embedded-taskruns-and-runs-status-in-pipelineruns.md) | v0.35.0 | Beta | Jan 25, 2023 |
2524
| [PipelineRun.Timeout is deprecated and will be removed](https://github.com/tektoncd/community/blob/main/teps/0046-finallytask-execution-post-timeout.md) | v0.36.0 (to be released) | Beta | Feb 25, 2023 |

pkg/apis/pipeline/v1beta1/pipelinerun_types.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func (pr *PipelineRun) HasStarted() bool {
8383

8484
// IsCancelled returns true if the PipelineRun's spec status is set to Cancelled state
8585
func (pr *PipelineRun) IsCancelled() bool {
86-
return pr.Spec.Status == PipelineRunSpecStatusCancelled || pr.Spec.Status == PipelineRunSpecStatusCancelledDeprecated
86+
return pr.Spec.Status == PipelineRunSpecStatusCancelled
8787
}
8888

8989
// IsGracefullyCancelled returns true if the PipelineRun's spec status is set to CancelledRunFinally state
@@ -242,10 +242,6 @@ type TimeoutFields struct {
242242
type PipelineRunSpecStatus string
243243

244244
const (
245-
// PipelineRunSpecStatusCancelledDeprecated Deprecated: indicates that the user wants to cancel the task,
246-
// if not already cancelled or terminated (replaced by "Cancelled")
247-
PipelineRunSpecStatusCancelledDeprecated = "PipelineRunCancelled"
248-
249245
// PipelineRunSpecStatusCancelled indicates that the user wants to cancel the task,
250246
// if not already cancelled or terminated
251247
PipelineRunSpecStatusCancelled = "Cancelled"

pkg/apis/pipeline/v1beta1/pipelinerun_validation.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,7 @@ func validateSpecStatus(ctx context.Context, status PipelineRunSpecStatus) *apis
121121
switch status {
122122
case "":
123123
return nil
124-
case PipelineRunSpecStatusPending,
125-
PipelineRunSpecStatusCancelledDeprecated:
124+
case PipelineRunSpecStatusPending:
126125
return nil
127126
case PipelineRunSpecStatusCancelled,
128127
PipelineRunSpecStatusCancelledRunFinally,

pkg/apis/pipeline/v1beta1/pipelinerun_validation_test.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -280,19 +280,6 @@ func TestPipelineRun_Validate(t *testing.T) {
280280
},
281281
},
282282
},
283-
}, {
284-
name: "pipelinerun cancelled deprecated",
285-
pr: v1beta1.PipelineRun{
286-
ObjectMeta: metav1.ObjectMeta{
287-
Name: "pipelinerunname",
288-
},
289-
Spec: v1beta1.PipelineRunSpec{
290-
Status: v1beta1.PipelineRunSpecStatusCancelledDeprecated,
291-
PipelineRef: &v1beta1.PipelineRef{
292-
Name: "prname",
293-
},
294-
},
295-
},
296283
}, {
297284
name: "pipelinerun gracefully cancelled",
298285
pr: v1beta1.PipelineRun{

pkg/pipelinerunmetrics/metrics.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ var (
6464
const (
6565
// ReasonCancelled indicates that a PipelineRun was cancelled.
6666
ReasonCancelled = "Cancelled"
67-
// ReasonCancelledDeprecated Deprecated: "PipelineRunCancelled" indicates that a PipelineRun was cancelled.
68-
ReasonCancelledDeprecated = "PipelineRunCancelled"
6967
)
7068

7169
// Recorder holds keys for Tekton metrics
@@ -236,7 +234,7 @@ func (r *Recorder) DurationAndCount(pr *v1beta1.PipelineRun, beforeCondition *ap
236234
status := "success"
237235
if cond := pr.Status.GetCondition(apis.ConditionSucceeded); cond.Status == corev1.ConditionFalse {
238236
status = "failed"
239-
if cond.Reason == ReasonCancelled || cond.Reason == ReasonCancelledDeprecated {
237+
if cond.Reason == ReasonCancelled {
240238
status = "cancelled"
241239
}
242240
}

pkg/reconciler/pipelinerun/cancel.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,6 @@ func cancelPipelineRun(ctx context.Context, logger *zap.SugaredLogger, pr *v1bet
7171
// If we successfully cancelled all the TaskRuns and Runs, we can consider the PipelineRun cancelled.
7272
if len(errs) == 0 {
7373
reason := ReasonCancelled
74-
if pr.Spec.Status == v1beta1.PipelineRunSpecStatusCancelledDeprecated {
75-
reason = ReasonCancelledDeprecated
76-
}
7774

7875
pr.Status.SetCondition(&apis.Condition{
7976
Type: apis.ConditionSucceeded,

pkg/reconciler/pipelinerun/cancel_test.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -108,15 +108,6 @@ func TestCancelPipelineRun(t *testing.T) {
108108
{ObjectMeta: metav1.ObjectMeta{Name: "t1"}},
109109
{ObjectMeta: metav1.ObjectMeta{Name: "t2"}},
110110
},
111-
}, {
112-
name: "deprecated-state",
113-
embeddedStatus: config.DefaultEmbeddedStatus,
114-
pipelineRun: &v1beta1.PipelineRun{
115-
ObjectMeta: metav1.ObjectMeta{Name: "test-pipeline-run-cancelled"},
116-
Spec: v1beta1.PipelineRunSpec{
117-
Status: v1beta1.PipelineRunSpecStatusCancelledDeprecated,
118-
},
119-
},
120111
}, {
121112
name: "child-references-with-both",
122113
embeddedStatus: config.BothEmbeddedStatus,

pkg/reconciler/pipelinerun/pipelinerun.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,6 @@ const (
104104
ReasonInvalidGraph = "PipelineInvalidGraph"
105105
// ReasonCancelled indicates that a PipelineRun was cancelled.
106106
ReasonCancelled = pipelinerunmetrics.ReasonCancelled
107-
// ReasonCancelledDeprecated Deprecated: "PipelineRunCancelled" indicates that a PipelineRun was cancelled.
108-
ReasonCancelledDeprecated = pipelinerunmetrics.ReasonCancelledDeprecated
109107
// ReasonPending indicates that a PipelineRun is pending.
110108
ReasonPending = "PipelineRunPending"
111109
// ReasonCouldntCancel indicates that a PipelineRun was cancelled but attempting to update

pkg/reconciler/pipelinerun/pipelinerun_test.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1512,11 +1512,6 @@ func runTestReconcileOnCancelledPipelineRun(t *testing.T, embeddedStatus string)
15121512
specStatus: v1beta1.PipelineRunSpecStatusCancelled,
15131513
reason: ReasonCancelled,
15141514
},
1515-
{
1516-
name: "cancelled deprecated",
1517-
specStatus: v1beta1.PipelineRunSpecStatusCancelledDeprecated,
1518-
reason: ReasonCancelledDeprecated,
1519-
},
15201515
}
15211516

15221517
for _, tc := range testCases {

pkg/reconciler/pipelinerun/resources/pipelinerunstate.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,8 +361,7 @@ func (facts *PipelineRunFacts) IsRunning() bool {
361361

362362
// IsCancelled returns true if the PipelineRun was cancelled
363363
func (facts *PipelineRunFacts) IsCancelled() bool {
364-
return facts.SpecStatus == v1beta1.PipelineRunSpecStatusCancelledDeprecated ||
365-
facts.SpecStatus == v1beta1.PipelineRunSpecStatusCancelled
364+
return facts.SpecStatus == v1beta1.PipelineRunSpecStatusCancelled
366365
}
367366

368367
// IsGracefullyCancelled returns true if the PipelineRun was gracefully cancelled

0 commit comments

Comments
 (0)