Fast and easy way to make changes in multiple GitLab project based on template.
After looking for a tool to simply enforce a development practice at the scale of a GitLab instance, I didn't find anything simple so I started this little script.
- Add new task on every
.gitlab-ci.yml
(check examples) - Apply new change on particular file (e.g. gitignore)
- In the context of governance, ensure that all projects have this content on this specific file
- Optout system, user can close the merge request, Volatile considered this specific template version as optout
- Python 3 (should also work with Python 2 but it's not supported)
- Virtualenv (recommended)
Then you can clone the repository, install the dependencies and run Volatile
:
$ git clone https://github.com/Lujeni/volatile.git
$ cd volatile
# optional
$ virtualenv .venv && source .venv/bin/activate
(.venv) $ pip install -r requirements.txt
(.venv) $ python volatile/volatile.py
Volatile supports multiple environment variables for configuration:
Flag | Description | Mandatory | Default |
---|---|---|---|
GITLAB_URL |
Your GitLab instance (e.g. https://gitlab.foo.bar) | yes | N/a |
GITLAB_PRIVATE_TOKEN |
Authentication Token | yes | N/a |
GITLAB_TARGET_FILE |
The GitLab file you wanna update (e.g. .gitlab-ci.yml ) |
yes | N/a |
GITLAB_SEARCH |
Returns project matching the given pattern (default all) | no | all |
GITLAB_SEARCH_IN_GROUP |
Returns project inside this group (cant be use with GITLAB_SEARCH) | no | None |
GITLAB_MR_DESCRIPTION |
Description of MR. Limited to 1,048,576 characters | no | None |
GITLAB_EXCLUDE |
Exclude project from their name based on fnmatch pattern (e.g. foo*,bar* ) |
no | None |
VOLATILE_DRY_RUN |
It will not make any changes on remote system (GitLab) | no | True |
VOLATILE_TEMPLATE_PATH |
The path of the file with the new content (e.g. volatile/templates/example.yml ) |
yes | N/a |
VOLATILE_MERGE_REQUEST |
Create merge request, otherwise, script push on default branch | no | True |
VOLATILE_PROMETHEUS_PORT |
Prometheus HTTP port | no | 8000 |
VOLATILE_PROMETHEUS_GATEWAY |
The Prometheus Gateway address | no | N/a |
By default, Volatile expose a temporary prometheus HTTP server with few metrics. The main goal is to track the adoption of your template. If you prefer, you can use a Prometheus Gateway (check configuration above).
You can use this simple manifest, before using it, replace with your current setup (e.g. GITLAB_URL)
MIT