Is there an API to verify branch protection rules across all repositories in self-hosted OneDev? (OD-2518)
Kavish Prajapati opened 5 months ago

Hi OneDev Team,

We are currently using a self-hosted instance of OneDev and would like to automate a validation check across all repositories to ensure that our branch protection rules are properly enforced.

Specifically, for the master branch in all repositories, we want to verify the following:

  1. Branch Protection - Allowed Groups
  2. Required Reviewers
  • Robin Shen commented 5 months ago

    You may check this via the RESTful api:

    https://code.onedev.io/~help/api/io.onedev.server.rest.resource.ProjectResource

    The idea is to query all projects, and for each project, load its settings and then check the branch protection part to make sure it is propertly configured.

    Another thing want to mention is that a child project inherits branch protection settings from its parent project automatically.

  • Robin Shen changed state to 'Closed' 5 months ago
    Previous Value Current Value
    Open
    Closed
  • Kavish Prajapati commented 5 months ago

    Thanks for the info and the API reference. I understand that we can query all projects via the REST API and check the branch protection settings programmatically.

    Just to confirm — is there any way from the OneDev UI to directly filter or list only those service repositories where branch protection is enabled (or disabled), instead of checking project by project? Or perhaps some other built-in method to quickly identify such projects without relying on the API?

  • Robin Shen commented 5 months ago

    No such feature from UI.

issue 1/1
Type
Question
Priority
Normal
Assignee
Labels
No labels
Issue Votes (0)
Watchers (2)
Reference
OD-2518
Please wait...
Connection lost or session expired, reload to recover
Page is in error, reload to recover