Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow more complexe required_statuses #206

Open
NargiT opened this issue Sep 24, 2020 · 4 comments
Open

allow more complexe required_statuses #206

NargiT opened this issue Sep 24, 2020 · 4 comments

Comments

@NargiT
Copy link

NargiT commented Sep 24, 2020

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 ?

@jamestoyer
Copy link

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

@NargiT
Copy link
Author

NargiT commented Sep 24, 2020

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.

@bluekeyes
Copy link
Member

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.

@NargiT
Copy link
Author

NargiT commented Oct 23, 2020

I need to try this to make sure that only on call people are allowed to add labels to the pr.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants