allow more complexe required_statuses
NargiT opened this issue · 4 comments
Hello,
Is it possible to have more complex required_statuses condition ?
Today it's a AND and I would like to have a OR ?
We are using bulldozer with policybot and everything going to prod use the PR mechanism. Unfortunately for on-call people, they cannot validate the pull request because policy expect someone else than the owner to do the validation (day workflow). So we though about adding a label "force-merge" that will allow bulldozer to merge but still wait at least for jenkins to finish in order to avoid to break production.
Do you think it's possible ? Or we can use another mechanism to achieve this goal ?
Hi @NargiT,
I can give a little more detail about how we get around this, but @bluekeyes might have a better solution.
Internally we have another bot that can add a +1 to a PR and is called by either adding a label to the PR or by adding special text to the body of the PR description. As it's a separate bot, it can be called out in the policy that it can do emergency +1s. A feature of this bot is that it can then open a ticket with our internal ticketing system to ensure a human goes back and validates the check after the fact, a useful feature for some compliance workflows.
Sadly the bot is not externally available as it's highly customised to our workflow, but hopefully that can give you some ideas
We also though about this, but this mean another custom thing to develop :).
Is your bot open source :) ?
I found this one https://github.com/dessant/label-actions which can do the job, but definitely not maintained and I guess I will have to take inspiration from it and rewrite it.
As James mentioned, our bot for this is not open source because it makes too many assumptions about our internal Jira instances and workflows.
However, you might be able to fix this entirely in policy-bot by adding a rule that approves PR that have the force-merge
label:
policy:
approval:
or:
- pr has the force-merge label
- and:
# ... existing rules ...
approval_rules:
- name: pr has the force-merge label
if:
has_labels:
- force-merge
requires:
count: 0
# ... existing rules ...
This policy means that any PR with the force-merge
label is automatically approved by policy-bot. Once policy-bot is satisfied, Bulldozer should be able to merge following the normal rules of waiting for Jenkins to complete.
I need to try this to make sure that only on call people are allowed to add labels to the pr.