diff --git a/teps/0105-enable-stoppedrunfinally-from-tekton-dashboard.md b/teps/0105-enable-stoppedrunfinally-from-tekton-dashboard.md new file mode 100644 index 000000000..922af34b1 --- /dev/null +++ b/teps/0105-enable-stoppedrunfinally-from-tekton-dashboard.md @@ -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 + + +- [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) + + +## 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 + + +## Drawbacks +None that I can think of. + +## Alternatives +From the dashboard, there are no alternatives. + + +## Implementation Pull request(s) + + diff --git a/teps/README.md b/teps/README.md index d89d0625f..6d3bc23fd 100644 --- a/teps/README.md +++ b/teps/README.md @@ -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 |