klarna/bec

BEC shall not delete merge checks when enforcing hooks

robertoaloi opened this issue · 0 comments

Consider a repo with some basic PR restrictions and hooks:

pr-restrictions:
  required-approvers: 2
  required-successful-builds: 1
  required-all-approvers: true
  required-all-tasks-complete: true

hooks:
  - key: com.klarna.bitbucket.needs-work-check:needsWorkBlocker
    enabled: true
    settings: {}

In recent versions of Bitbucket the PR restrictions are implemented via merge check hooks, and are listed as hooks too on the REST interface.

The problem is that when someone changes the hooks for this repo, and BEC enforces the hooks, it also deletes the merge check hooks. Then it has to enforce the pr restrictions again.

It's just pure luck that hooks are checked before pr restrictions, so at the end we arrive to the correct config. But this should be fixed.