Mass project edit

Hello Forum!

I’ve just imported 296 projects from gitolite to GitLab and now it is givin gm e aheadache. I have to transfer all the projects from the user I’ve imported them to, to the group that everyone uses. Plus I have to set them all to Internal instead of Private.

Question 1: Will you implement something that will allow mass modification of identical projects so I won’t have to do this project by project?

Question 2: Is there a better way to import the projects from Gitolite to GitLab than this?

I don’t represent anybody at GitLab, but what I can imagine being useful is a “command prompt” inside the Gitlab UI, or else perhaps you can figure out how to do what you want using API tokens and Gitlab’s public APIs.

If you could figure out how to make the changes you wanted from within Gitlab’s databases directly, perhaps that would be okay as well. See this issue:

I saw this and was curious how this could be done as well. I think the way to go about doing it is using something like the Gitlab API, specifically the Projects API, and see if you can do something like:

GET /projects
...
# loop through each project ID, determine what kind of visibility you want.
...
PUT /projects/:id?visibility_level=:level

Where, according to the docs, the Project Visibility Level is either 0, 10, or 20.

You could do it with GitLabForm, a tool that automates mass GitLab API calls and provides configuration as code for it, for things like: projects settings, deploy keys, branch protection etc. https://github.com/egnyte/gitlabform

Disclosure: I have written this tool and my company open-sourced it.

2 Likes

Had a situation that I had to change project visibility and I just updated the “visibility_level” column in table “projects”.
Changing group is a little bit more complicated with the database manipulation so I just used the Gitlab API using bash script to loop a curl statement calling the following api.
https://docs.gitlab.com/ee/api/groups.html#transfer-project-to-group