gitlab-getlists
Scripts to download list of Projects, status, License, owners (with e-mail) from gitlab.geant.org (production mode) or k8s-gitlab.software.geant.org (developer mode). The output of the script is three files: json, html and CVS.
Installation
Script written in Python 3, install and use latest version.
After python installation, install The Python Package Index (PyPI) - latest version
All dependencies are stored in the file requirements.txt, install them:
pip install -r requirements.txt
Configuration
Sample configuration file is env_example. You should rename it to .env This file should contain tokens from gitlab:
PRODUCTION_TOKEN=glpat-ABCdefGhIj123xyz4567
DEVELOPER_TOKEN=glpat-ABCdefGhIj123xyz4567
Token can be generated from gitlab.geant.org (for production) or k8s-gitlab.software.geant.org (for developer): Edit profile -> Access Token Minimum is: read_api
The token looks similar to this: glpat-ABCdefGhIj123xyz4567 -> string 'glpat-' and 20 random numbers and characters
Usage
Script have two flags: -- production - take data from gitlab.geant.org -- developer - take date from k8s-gitlab.software.geant.org
Start Bash or CMD/PowerShell on your local computer and open folder with this project. Example run (Windows):
C:\...\gitlab-getlists> python.exe .\main.py --developer
C:\...\gitlab-getlists> python.exe .\main.py --production
Output
Three files:
- gitlab-projects.html
- gitlab-projects.json
- gitlab-projects.csv
We can find various variables in these files (project_name, groups, etc.), the most important is license_file, which can have three values:
- LICENSE - found LICENSE file in the Repository
- 404 File Not Found - not found LICENSE in the Repository
- No created repository - the project has no Repository created, no LICENSE file
Export / import Users
- get-users.py - export users from Gitlab Instance to file ultimate_users.json
- put-users.py - import users from file ultimate_users.json to Gitlab CE
- delete_users.py - USE WITH CAUTION, delete users from Gitlab Instance (names from ultimae_users.json)
Export Owners and his projects
- owners_and_projects.py - export only owners and his all projects to file gitlab_owners.json
projects and groups
Script projects-and-groups.py was used during the migration Gitlab Ultimate => Gitlab CE.
- Archive selected Projects
- Disable selected Users
- create nginx rewrite rules for transferred projects