Skip to content

Commit ead4c1a

Browse files
authored
Start discussion for auto-cancel functionality in github service (#180)
* Start discussion for auto-cancel functionality in github service * Updated few parts after discussion * Added suggestion to expose cancel functionality through API
1 parent 7bcf974 commit ead4c1a

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,4 @@ See [mechanics](mechanics.md) for more detail.
6565
| RFC#169 | [Easy Taskcluster Setup](rfcs/0169-Easy-Taskcluster-setup.md) |
6666
| RFC#175 | [Restricted Roles for Github Pull Requests](rfcs/0175-restricted-pull-requests.md) |
6767
| RFC#177 | [Skip CI in github integration](rfcs/0177-Skip-ci-integrations.md) |
68+
| RFC#180 | [Github cancel previous tasks](rfcs/0180-Github-cancel-previous-tasks.md) |
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# RFC 180 - Github cancel previous tasks
2+
* Comments: [#180](https://github.com/taskcluster/taskcluster-rfcs/pull/180)
3+
* Proposed by: @lotas
4+
5+
# Summary
6+
7+
Allow to automatically cancel previous pipelines for github `push` and `pull_request` events.
8+
9+
## Motivation
10+
11+
This will allow to save computing resources and give more flexibility for the Taskcluster users on Github.
12+
When several pushes happen to the same branch within a short amount of time, like hotfixes or rebases,
13+
only the last commit and pipelines matters.
14+
By cancelling previous task groups and tasks we could save significant amount of compute resources and developer hours by not running redundant tasks.
15+
16+
# Details
17+
18+
## Github hooks
19+
20+
This will only apply to non-default branches (and possible protected branches?),
21+
to allow all pushes to the default branch to have their own builds.
22+
23+
To be flexible and allow some projects to still run checks for all events, we could add new key to the `.taskcluster.yml` configuration.
24+
We can introduce top-level configuration option `authCancelPreviousChecks: true` (having `true` by default) to control if this behaviour is desired.
25+
26+
Github's webhook handler upon receiving `push` event would check if there are other task groups existing for given branch, that are not HEAD.
27+
If `authCancelPreviousChecks` is set to `true` it will cancel them.
28+
29+
Cancellation will happen for all the non-resolved tasks within the same `taskGroupId`. However, due to the fact that tasks can create their own sub-tasks, there might be cases where running tasks would still manage to create some tasks that might not be cancelled.
30+
31+
## Github API
32+
33+
To make it easier for developers to cancel running builds associated with some specific branch we can expose new API endpoint. `github.cancelBuilds({ organization, repository, branch })` would be able to find all task groups associated with this branch, find all non-resolved tasks within those groups and cancel those.
34+
35+
36+
# Implementation
37+
38+
* Original request issue [#5621](https://github.com/taskcluster/taskcluster/issues/5621)

rfcs/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,4 @@
5353
| RFC#169 | [Easy Taskcluster Setup](0169-Easy-Taskcluster-setup.md) |
5454
| RFC#175 | [Restricted Roles for Github Pull Requests](0175-restricted-pull-requests.md) |
5555
| RFC#177 | [Skip CI in github integration](0177-Skip-ci-integrations.md) |
56+
| RFC#180 | [Github cancel previous tasks](0180-Github-cancel-previous-tasks.md) |

0 commit comments

Comments
 (0)