RFR: 1173: Dependent PR feature does not work with protected branches in newer Gitlab version [v3]

Erik Joelsson erikj at openjdk.org
Fri Jan 13 21:15:18 UTC 2023


> In GitLab, if a branch is protected, it cannot be removed. This is preventing us from using the pr/X feature of Skara to support dependent pull requests. This patch adds the ability to dynamically protect and unprotect branch patterns when creating pr/X branches. This is controlled with a new configuration option on the prbranch notifier like this:
> 
> 
>         "prbranch": {
>           "protect": true,
>         },
> 
> The semantics needed for GitLab is to first add a pattern based protection rule, then create the branch. Unfortunately, I couldn't easily implement the same semantics for GitHubRepository. The REST API for branch protection in GitHub doesn't allow patterns, only existing branches. It could probably be done using GraphQL, but given how complicated that would be to implement, I chose not to, since we don't actually need this feature on GitHub. (GitHub branch protection is flexible enough so we can have a static configuration that allows admins to delete branches, and this is already in use today)
> 
> I have tested the basic branch protection functionality using the new manual test and I have run the notifier bot with the new configuration against a playground repository in GitLab and manually created and closed PRs.

Erik Joelsson has updated the pull request incrementally with one additional commit since the last revision:

  Renamed parameter

-------------

Changes:
  - all: https://git.openjdk.org/skara/pull/1452/files
  - new: https://git.openjdk.org/skara/pull/1452/files/68619fab..8ce0d132

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=skara&pr=1452&range=02
 - incr: https://webrevs.openjdk.org/?repo=skara&pr=1452&range=01-02

  Stats: 7 lines in 2 files changed: 0 ins; 0 del; 7 mod
  Patch: https://git.openjdk.org/skara/pull/1452.diff
  Fetch: git fetch https://git.openjdk.org/skara pull/1452/head:pull/1452

PR: https://git.openjdk.org/skara/pull/1452


More information about the skara-dev mailing list