Skip to content

Commit afe7ef5

Browse files
committed
Force cancel when using tkn pipelinerun cancel 👼
With tektoncd/pipeline#3915, there is now a possibility to graceful cancel. As of today, the cli only supports force cancelling. When we updated the dependencies, we didn't change the constant we are using from tektoncd/pipeline and thus, we were using the new value that is only supported when alpha api are enabled — hence the CI is broken. This make the cli use the deprecated field for now, but we need to follow up to support graceful cancellation. Signed-off-by: Vincent Demeester <[email protected]>
1 parent ac520b9 commit afe7ef5

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

‎internal/builder/v1alpha1/pipeline.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ func PipelineDescription(desc string) PipelineSpecOp {
113113

114114
// PipelineRunCancelled sets the status to cancel to the TaskRunSpec.
115115
func PipelineRunCancelled(spec *v1alpha1.PipelineRunSpec) {
116-
spec.Status = v1alpha1.PipelineRunSpecStatusCancelled
116+
spec.Status = v1alpha1.PipelineRunSpecStatusCancelledDeprecated
117117
}
118118

119119
// PipelineDeclaredResource adds a resource declaration to the Pipeline Spec,

‎internal/builder/v1beta1/pipeline.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ func PipelineDescription(desc string) PipelineSpecOp {
108108

109109
// PipelineRunCancelled sets the status to cancel to the TaskRunSpec.
110110
func PipelineRunCancelled(spec *v1beta1.PipelineRunSpec) {
111-
spec.Status = v1beta1.PipelineRunSpecStatusCancelled
111+
spec.Status = v1beta1.PipelineRunSpecStatusCancelledDeprecated
112112
}
113113

114114
// PipelineDeclaredResource adds a resource declaration to the Pipeline Spec,

‎pkg/cmd/pipeline/start_test.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4538,7 +4538,7 @@ func Test_start_pipeline_use_pipelinerun_cancelled_status_v1beta1(t *testing.T)
45384538
},
45394539
},
45404540
Timeout: &metav1.Duration{Duration: timeoutDuration},
4541-
Status: v1beta1.PipelineRunSpecStatus(v1beta1.PipelineRunSpecStatusCancelled),
4541+
Status: v1beta1.PipelineRunSpecStatus(v1beta1.PipelineRunSpecStatusCancelledDeprecated),
45424542
},
45434543
Status: v1beta1.PipelineRunStatus{
45444544
Status: duckv1beta1.Status{

‎pkg/cmd/pipelinerun/cancel.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func cancelPipelineRun(p cli.Params, s *cli.Stream, prName string) error {
7474
}
7575
}
7676

77-
if _, err = pipelinerun.Patch(cs, prName, metav1.PatchOptions{}, p.Namespace()); err != nil {
77+
if _, err = pipelinerun.Cancel(cs, prName, metav1.PatchOptions{}, p.Namespace()); err != nil {
7878
return fmt.Errorf("failed to cancel PipelineRun: %s: %v", prName, err)
7979

8080
}

‎pkg/pipelinerun/pipelinerun.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,11 @@ type patchStringValue struct {
149149
Value string `json:"value"`
150150
}
151151

152-
func Patch(c *cli.Clients, prname string, opts metav1.PatchOptions, ns string) (*v1beta1.PipelineRun, error) {
152+
func Cancel(c *cli.Clients, prname string, opts metav1.PatchOptions, ns string) (*v1beta1.PipelineRun, error) {
153153
payload := []patchStringValue{{
154154
Op: "replace",
155155
Path: "/spec/status",
156-
Value: v1beta1.PipelineRunSpecStatusCancelled,
156+
Value: v1beta1.PipelineRunSpecStatusCancelledDeprecated,
157157
}}
158158

159159
data, _ := json.Marshal(payload)

0 commit comments

Comments
 (0)