Skip to content

Adding functionality to periodically close old MR with failed pipelines

Spyros Argyropoulos requested to merge cleanmr into master

Changes introduced

Adding functionality to be able to close and delete branches which are never going to be merged. This feature can be deployed in a scheduled pipeline - it is not deployed yet (so this MR just adds the functionality).

The reason for this is the following. The commit script has to go through all branches, which means that stale branches slow it down. Besides that, it looks like several MRs have been left open for months without any action taken. In most cases, this happens because instead of fixing failed pipelines, the committers open a new MR (oftentimes without even mentioning the JIRA ticket etc). In the last week I cleaned up more than 10 MRs which were duplicates of MRs that have already been merged, but have been left open for several months.

In other (rare) cases, users leave MRs open because contacts change or for keeping track of changes. I think we want to dissuade this; this repo should be for production-ready jO, while the rest can be kept in forks (or anywhere else, which does not interfere with the scripts/CI running on the main repo).

In principle if we deploy this, a scheduled pipeline (or cron job) would mark all the MRs that are open more than X days (in the script X=30) and for which the pipeline has failed with the todelete label and make a comment that the MR will be deleted in a week. The second time it runs it would close all open MRs that are marked todelete and delete the respective branches. For cases where the user for whatever reason wants to keep the MR open, the would just need to go to the MR and remove the todelete label.

The aim is to force people to be more proactive and avoid useless MRs and branches being piled up.

FYI @ancuetog @dhirsch - I will merge this (since this just adds the functionality without deploying it) but let me know if you have thoughts about the procedure above, e.g. if you think that we shouldn't do it.

Tests

See eg !2738

Issues resolved

Closes #

Merge request reports