Integrated: 1173: Dependent PR feature does not work with protected branches in newer Gitlab version

Erik Joelsson erikj at openjdk.org
Thu Jan 19 19:44:03 UTC 2023


On Tue, 3 Jan 2023 17:24:36 GMT, Erik Joelsson <erikj at openjdk.org> wrote:

> 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.

This pull request has now been integrated.

Changeset: 5823b37f
Author:    Erik Joelsson <erikj at openjdk.org>
URL:       https://git.openjdk.org/skara/commit/5823b37f47256417601ec4275be6a2b3958265c6
Stats:     127 lines in 9 files changed: 122 ins; 0 del; 5 mod

1173: Dependent PR feature does not work with protected branches in newer Gitlab version

Reviewed-by: zsong, ihse

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

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


More information about the skara-dev mailing list