aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan200101 <sentrycraft123@gmail.com>2024-02-13 11:26:08 +0100
committerJan200101 <sentrycraft123@gmail.com>2024-02-13 11:26:08 +0100
commit9951d81c162e208d37a967f000549e6f872d7335 (patch)
treec559ee42db262af837af985230637eaf05b19ad6
parentf2bc17afd2977ece8963f72e3774e98263b8add8 (diff)
downloadlab-bot-9951d81c162e208d37a967f000549e6f872d7335.tar.gz
lab-bot-9951d81c162e208d37a967f000549e6f872d7335.zip
Create up to 3 stable MR before manual intervention is required
This should help prevent confusion with what the system is doing
-rw-r--r--labbot/addons/merge-stable.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/labbot/addons/merge-stable.py b/labbot/addons/merge-stable.py
index 1a2904f..a585590 100644
--- a/labbot/addons/merge-stable.py
+++ b/labbot/addons/merge-stable.py
@@ -45,19 +45,23 @@ async def issue_update_hook(event, gl, *args, **kwargs):
merge_url = f"/projects/{event.project_id}/merge_requests"
for branch, merge in branches.items():
- merge_exists = False
+ merges_exists = 0
async for merge_data in gl.getiter(merge_url, params={
"source_branch": branch,
"target_branch": config["stable_branch"]
}):
- # We have found a merge request, we cannot sanely re-merge again.
- merge_exists = True
- break
+ # We found a merge request, add it to the counter
+ merges_exists += 1
+ if merges_exists > 3:
+ break
- if merge_exists:
- log.debug(f"merge for `{branch}` already exists")
+ if merges_exists > 3:
+ log.debug(f"merges for `{branch}` already exists, not opening more than 3")
else:
+ if merges_exists:
+ log.debug(f"merge for `{branch}` already exists, opening a new one regardless")
+
merge_string = ", ".join(merge)
await gl.post(merge_url, data={
"source_branch": branch,