git-variables - Manage GitLab Environment Variables
git-variables is a Python package designed to simplify the management of GitLab environment variables. It allows you to easily pull environment variables from your GitLab project to your local machine or push local environment variables to your GitLab project. This streamlines your development workflow by ensuring consistency between local and GitLab environments.
Installation
Install git-variables using pip:
pip install git-variables
Usage
git-variables offers two main subcommands: pull and push.
Pull
Use the pull command to retrieve environment variables from your GitLab project and store them in a local file.
git-variables pull -t <access_token> -r <repository_url> [options]
Options:
-t, --access-token: Your GitLab personal access token with sufficient permissions to access environment variables. -r, --repository-url: The URL of your GitLab repository. -s, --scope: (Optional) The scope of environment variables to pull. Valid options are project (default), group, or instance. -o, --output-file: (Optional) Path to the file where downloaded variables will be saved. Defaults to .env.
Push
Use the push command to update GitLab environment variables from a local file.
git-variables push -t <access_token> -r <repository_url> [options]
Options:
-t, --access-token: Your GitLab personal access token with sufficient permissions to manage environment variables. -r, --repository-url: The URL of your GitLab repository. -s, --scope: (Optional) The scope of environment variables to push. Valid options are project (default), group, or instance. -e, --env-vars: Path to the file containing environment variables to push. Defaults to .env.
Example:
Pull project environment variables from your GitLab repository and save them to a file named my_env.txt:
git-variables pull -t your_access_token -r https://gitlab.com/username/project-name -o .env
Push environment variables defined in local_env.env to your GitLab project's group environment variables:
git-variables push -t your_access_token -r https://gitlab.com/username/group-name -s group -e local_env.env
Additional Notes
Make sure you have a personal access token with the necessary permissions created in your GitLab account. Environment variables are stored in a standard .env file format on your local machine (configurable with -o or --output-file). For detailed information on specific functionalities and error handling, refer to the source code within the package.
Contributing
We welcome contributions to improve this project. Please refer to the Contributing Guide (if available) for details on how to submit pull requests and participate in development.
Metadata
Release files for git-variables 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| git_variables-0.1.6.tar.gz | 7.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| git_variables-0.1.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.4 kB
Release files / git_variables-0.1.6.tar.gz
| Download URL | git_variables-0.1.6.tar.gz |
|---|---|
| Size | 7.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e1140b5b9d17c89371d5b53da8acb99aa2a951f087335cd1a91da0cf32ac0123
|
|
BLAKE2b-256 checksum How to use checksums |
2b5dced924dd486d60418f40f8189c0204821cf3a36c20d0cf090d410074ee56
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.5
|
Release files / git_variables-0.1.6-py3-none-any.whl
| Download URL | git_variables-0.1.6-py3-none-any.whl |
|---|---|
| Size | 8.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c8186911314d8ea92990abcc2df4b44acc517953867b7c723f83850e1baabe00
|
|
BLAKE2b-256 checksum How to use checksums |
628b1b3660c2763c3280129984afd80501cd8e190bc8c9df6f6a117c4698dcf3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.5
|