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

Zhao Song zsong at openjdk.org
Fri Jan 13 18:36:20 UTC 2023


On Tue, 3 Jan 2023 17:37:18 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.
>
> Erik Joelsson has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Fix import

bots/tester/src/test/java/org/openjdk/skara/bots/tester/InMemoryHostedRepository.java line 177:

> 175:     @Override
> 176:     public void protectBranchPattern(String ref) {
> 177:     }

The name of this method is protectBranchPattern, but I think it actually protects a specific branch rather than a pattern.

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

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


More information about the skara-dev mailing list