Uploaded image for project: 'OpenShift Pipelines'
  1. OpenShift Pipelines
  2. SRVKP-6911

Extend Cancel-In-Progress Feature to Support Different PipelineRun Statuses

XMLWordPrintable

    • Icon: Story Story
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • Pipelines 1.18.0
    • Pipelines as Code
    • 8
    • False
    • None
    • False
    • KONFLUX-134 - Cancel PipelineRuns on PR update
    • Hide
      The pipelinesascode.tekton.dev/cancel-in-progress annotation has been enhanced to support additional cancellation statuses, allowing for more flexible and precise management of PipelineRuns:

          Cancelled: Immediately cancels the PipelineRun, skipping any finally tasks.
          CancelledRunFinally: Cancels the PipelineRun but ensures all finally tasks are executed.
          StoppedRunFinally: Gracefully stops the PipelineRun, completing ongoing TaskRuns and finally tasks but preventing new non-finally tasks from starting.


      Usage: Include the pipelinesascode.tekton.dev/cancel-in-progress annotation in the PipelineRun definition with one of the newly supported values:

      apiVersion: tekton.dev/v1
      kind: PipelineRun
      metadata:
        name: example-run
        annotations:
          pipelinesascode.tekton.dev/cancel-in-progress: "cancelledRunFinally"
      spec:
        # Other PipelineRun configurations...
      Show
      The pipelinesascode.tekton.dev/cancel-in-progress annotation has been enhanced to support additional cancellation statuses, allowing for more flexible and precise management of PipelineRuns:     Cancelled: Immediately cancels the PipelineRun, skipping any finally tasks.     CancelledRunFinally: Cancels the PipelineRun but ensures all finally tasks are executed.     StoppedRunFinally: Gracefully stops the PipelineRun, completing ongoing TaskRuns and finally tasks but preventing new non-finally tasks from starting. Usage: Include the pipelinesascode.tekton.dev/cancel-in-progress annotation in the PipelineRun definition with one of the newly supported values: apiVersion: tekton.dev/v1 kind: PipelineRun metadata:   name: example-run   annotations:     pipelinesascode.tekton.dev/cancel-in-progress: "cancelledRunFinally" spec:   # Other PipelineRun configurations...

      Overview

      The current pipelinesascode.tekton.dev/cancel-in-progress: "true" feature only allows for standard cancellation of PipelineRuns. To provide greater flexibility and control, this story proposes extending the cancel-in-progress functionality to support additional PipelineRun statuses, specifically:

      1. Cancelled: Cancels the PipelineRun, marking spawned TaskRuns as canceled, deleting associated Pods, and skipping retries. Pending finally tasks are not executed.
      1. CancelledRunFinally: Cancels the PipelineRun, marking spawned TaskRuns as canceled, deleting associated Pods, and skipping retries. Finally tasks are executed as usual.
      1. StoppedRunFinally: Gracefully stops the PipelineRun, allowing spawned TaskRuns to complete, including retries, but no new non-finally tasks are scheduled. Finally tasks are executed afterwards.

      Proposed Functionality:

      1. Annotation Enhancement: Extend the pipelinesascode.tekton.dev/cancel-in-progress annotation to accept additional options:
        • cancelled
        • cancelledRunFinally
        • stoppedRunFinally
      1. Configuration Support: Ensure these options are properly handled and passed to the status field of the PipelineRun when the annotation is applied.
      1. Backward Compatibility: Maintain support for the current behavior (cancel-in-progress: "true"), defaulting to the standard cancellation mechanism.
      1. Graceful Handling: Implement robust handling for each new status type to ensure TaskRuns, Pods, and finally tasks behave according to the defined specifications.

      Benefits:

      • Provides administrators and users with more granular control over how PipelineRuns are terminated or stopped.
      • Supports diverse workflows where different levels of cancellation or stopping are needed.
      • Enhances resource optimization and user experience by aligning PipelineRun management with specific project requirements.

      Acceptance Criteria:

      1. Users can specify cancelled, cancelledRunFinally, or stoppedRunFinally as values for the pipelinesascode.tekton.dev/cancel-in-progress annotation.
      1. PipelineRuns respond appropriately to the selected cancellation type, updating the status field and modifying TaskRun behavior as needed.
      1. Comprehensive testing ensures compatibility with existing and new behaviors.

              cboudjna@redhat.com Chmouel Boudjnah
              cboudjna@redhat.com Chmouel Boudjnah
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: