Skip to content

Commit

Permalink
Users are currently not able to gracefully stop a pipeline run from …
Browse files Browse the repository at this point in the history
…the dashboard.

    This TEP is a proposision for consiteration adding a feature to enable a graceful shutdown of a pipelinerun by updating its `spec.status` to `StoppedRunFinally` from an ui element.
  • Loading branch information
williamlfish committed Apr 12, 2022
1 parent 181f478 commit f36f929
Show file tree
Hide file tree
Showing 2 changed files with 120 additions and 0 deletions.
119 changes: 119 additions & 0 deletions teps/0105-enable-stoppedrunfinally-from-tekton-dashboard.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
---
status: proposed
title: Enable StoppedRunFinally from tekton dashboard
creation-date: '2022-04-12'
last-updated: '2022-04-12'
authors:
- '@williamlfish'
---

# TEP-0105: Enable StoppedRunFinally from tekton dashboard

<!-- toc -->
- [Summary](#summary)
- [Motivation](#motivation)
- [Goals](#goals)
- [Non-Goals](#non-goals)
- [Use Cases](#use-cases)
- [Requirements](#requirements)
- [Proposal](#proposal)
- [Notes/Caveats (optional)](#notescaveats-optional)
- [Risks and Mitigations](#risks-and-mitigations)
- [User Experience (optional)](#user-experience-optional)
- [Performance (optional)](#performance-optional)
- [Design Details](#design-details)
- [Test Plan](#test-plan)
- [Design Evaluation](#design-evaluation)
- [Drawbacks](#drawbacks)
- [Alternatives](#alternatives)
- [Implementation Pull request(s)](#implementation-pull-request-s)
<!-- /toc -->

## Summary
The finally step is expected to run at the end of any pipeline, so when canceling a pipeline run from the dashboard the option of canceling our right _or_ running the finally steps is a nice consideration. Enabling StoppedRunFinally allows developers to cancel a pipeline run, but also to have finally run ( clean-up tasks, pull-request feedback, etc )

## Motivation
The dashboard is a great resource to give developers or other organization members access to tekton without giving direct access to the cluster where tekton is running. Allowing devs to gracefully cancel a pipeline for whatever reason feels like appropriate access, especially in cases where the team managing pipelines/tasks is not the team who is consuming the tools.


### Goals
The main goal is to add a method of gracefully canceling a pipeline run, by setting its status to StoppedRunFinally.


### Non-Goals
Enabling any other status for a pipeline run.


### Use Cases
Allow developers to cancel a pipelinrun knowing the standard clean-up or whatever other tasks that would normally run, run.

Some examples of these tasks, or why they are helpful:

- Cleanup
- Feedback of status ( like in a github pr )
- Slack alerts
- Debugging pipelines ( let the pipeline run the cleanup tasks before restarting )

## Requirements
A simple method of gracefully canceling a pipeline run.

## Proposal
In the current kebab menu, there are ways to interact with a pipeline run. Adding an option called "Stop Gracefully" that is available if the menu selected corresponds to a pipeline that is running.
This option can then call the api and will set the `spec.status` to `StoppedRunFinally`. Additionally adding a tool-tip on hover will add the benefit understanding the different options.

Additionally it would be nice to have both cancel options available in the detail view of the pipeline.

### Risks and Mitigations
The main risk is confusion over what the different cancel options are.



## Design Details
A simple func, very similar to the current cancel implementation. Another acceptable approach would be to update the current `cancelPipelineRun` func to accept a status, that way if there are changes and or if more statuses are introduced that would also be nice to present to users, it would be simple to do.
```js
export function gracefulCancelPipelineRun({ name, namespace }) {
const payload = [
{ op: 'replace', path: '/spec/status', value: 'StoppedRunFinally' }
];

const uri = getTektonAPI('pipelineruns', { name, namespace });
return patch(uri, payload);
}
```
```js
export function cancelPipelineRun({ name, namespace, status }) {
const payload = [
{ op: 'replace', path: '/spec/status', value: status }
];

const uri = getTektonAPI('pipelineruns', { name, namespace });
return patch(uri, payload);
}
```
Updating the nls files with the appropriate copy for each language provided should also be done ( who approves the copy for other languages by the way :sweat_smile: )

## Test Plan
Testing can be conducted in the same way that the current `cancelPipelineRun` unit tests are written. Considering the action is an api call, being sure the json sent is correct feels adequate.


## Design Evaluation
<!--
How does this proposal affect the api conventions, reusability, simplicity, flexibility
and conformance of Tekton, as described in [design principles](https://github.com/tektoncd/community/blob/master/design-principles.md)
-->

## Drawbacks
None that I can think of.

## Alternatives
From the dashboard, there are no alternatives.


## Implementation Pull request(s)

<!--
Once the TEP is ready to be marked as implemented, list down all the Github
Pull-request(s) merged.
Note: This section is exclusively for merged pull requests, for this TEP.
It will be a quick reference for those looking for implementation of this TEP.
-->
1 change: 1 addition & 0 deletions teps/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,3 +240,4 @@ This is the complete list of Tekton teps:
|[TEP-0098](0098-workflows.md) | Workflows | proposed | 2021-12-06 |
|[TEP-0100](0100-embedded-taskruns-and-runs-status-in-pipelineruns.md) | Embedded TaskRuns and Runs Status in PipelineRuns | implementing | 2022-03-23 |
|[TEP-0102](0102-https-connection-to-triggers-interceptor.md) | HTTPS Connection to Triggers ClusterInterceptor | proposed | 2022-03-21 |
|[TEP-0105](0105-enable-stoppedrunfinally-from-tekton-dashboard.md) | Enable StoppedRunFinally from tekton dashboard | proposed | 2022-04-12 |

0 comments on commit f36f929

Please sign in to comment.