Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@ can be used to ask the bot to do the following:
* when the version was bumped, generate a wheel, rsync it to a PEP 503
simple index root, or upload it to one or more indexes with twine

The bot merges one PR at a time per target branch. When a merge is already
in progress on the target branch, the command is queued (``bot merge queued``
label) and starts when the merge in progress finishes, whether it succeeds or
fails. A merge older than ``MERGE_BOT_QUEUE_TIMEOUT`` hours (default 12) does
not hold the queue anymore. The queue can be disabled by adding
``merge_bot_queue`` to ``BOT_TASKS_DISABLED``.

``/ocabot rebase`` can be used to ask the bot to do the following:

* rebase the PR on the target branch
Expand Down
6 changes: 5 additions & 1 deletion environment.sample
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ ODOO_PASSWORD=
# Number of days before the proposal can be marked as "Approved"
#MIN_PR_AGE=5

# Hours after which a merge in progress does not hold the merge queue
# of its target branch anymore
#MERGE_BOT_QUEUE_TIMEOUT=12

# Color of the github label that contains the name of the module
#MODULE_LABEL_COLOR=#ffc

Expand All @@ -42,7 +46,7 @@ ODOO_PASSWORD=
# Available tasks:
# delete_branch,tag_approved,tag_ready_to_merge,gen_addons_table,
# gen_addons_readme,gen_addons_icon,setuptools_odoo,mention_maintainer,
# merge_bot,rebase_bot,merge_bot_towncrier,tag_needs_review
# merge_bot,merge_bot_queue,rebase_bot,merge_bot_towncrier,tag_needs_review
#BOT_TASKS=all

# Coma separated list of task to ignore
Expand Down
1 change: 1 addition & 0 deletions newsfragments/377.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Merge bot: merge one PR at a time per target branch. A merge command issued while another merge is in progress on the same target branch is queued and starts when that merge finishes, instead of running the tests twice. When the final push is rejected because the target branch moved meanwhile, retry instead of failing.
4 changes: 4 additions & 0 deletions src/oca_github_bot/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ def func_wrapper(*args, **kwargs):
"What a great day to merge this nice PR. Let's do it!",
]

# A merge bot branch older than this many hours does not hold the merge queue
# of its target branch anymore (the merge is considered stuck).
MERGE_BOT_QUEUE_TIMEOUT = int(os.environ.get("MERGE_BOT_QUEUE_TIMEOUT", "12"))

APPROVALS_REQUIRED = int(os.environ.get("APPROVALS_REQUIRED", "2"))
MIN_PR_AGE = int(os.environ.get("MIN_PR_AGE", "5"))

Expand Down
5 changes: 5 additions & 0 deletions src/oca_github_bot/cron.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
"kwargs": {"build_wheels": True},
"schedule": crontab(hour="2", minute="30"),
},
"merge_bot_queue_sweep": {
"task": "oca_github_bot.tasks.merge_bot.merge_bot_queue_sweep",
"args": (org,),
"schedule": crontab(minute="*/15"),
},
"tag_ready_to_merge": {
"task": "oca_github_bot.tasks.tag_ready_to_merge.tag_ready_to_merge",
"args": (org,),
Expand Down
Loading
Loading