Mateusz M.
Mateusz M.

Reputation: 392

How to assign access rights to a Gerrit project using API / SSH?

I'm looking for a way to automatically add +2 permissions for certain refs for a lot of projects in Gerrit and unfortunately it seems there are no API calls to modify access rights, only to read them. Do you have any idea how to modify refs permissions for a big amount of projects?

I'm using Gerrit 2.9.

Thanks.

Upvotes: 1

Views: 1510

Answers (1)

uncletall
uncletall

Reputation: 6842

One possibility would be to create a batch script to modify the project.config for those projects and commit them back to gerrit.

This is how you can checkout the project.config for the All-Projects, it works the same for other projects: http://blog.bruin.sg/2013/04/how-to-edit-the-project-config-for-all-projects-in-gerrit/

Simply put:

  1. Create list of project you want to change
  2. Iterate over the lest
  3. Checkout the refs/meta/config ref
  4. Use script to modify project.config
  5. Commit and push back to the server

More information about the project.config: http://gerrit-review.googlesource.com/Documentation/config-project-config.html

Upvotes: 3

Related Questions