Create Content Selector and Privileges via script

2020-07-29 02:39发布

问题:

Do you know if there is any way to create content selectors and content selector privileges via script for Nexus Repository Manager OSS?

Thanks in advance for every answer :-)

My idea is to divide a hosted Docker Repository into separated (protected) namespaces (for each product/team/project) - I do not want to do the following steps manually; a better approach is to create a script for that:

1 Create Content Selector format == "docker" && (path == "/v2/" || path =^ "/v2/PROJECTNAME/")

2 Create Content Selector Privilege Use the selector created in step 1 and choose a docker repo.

3 Create role Create a role and grant the privilege created in step 2

4 Create user Create a user with a randomly generated pwd and grant the role from step 3 to newly created user.

A project can use this user to access the docker registry only within its granted Namespace

回答1:

This gist should provide enough detail to get you rolling:

https://gist.github.com/nblair/1a0e05713c3edb7e5360c2b0222c7623

Hope this helps!



标签: nexus