Python packages that allows to manage GitLab env variables seamlessly between remote and local respository
Project description
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 gitlab-variables using pip:
pip install gitlab-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.
gitlab-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.
gitlab-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:
gitlab-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:
gitlab-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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for git_variables-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a54cf09ec5b5ccaec542d94d5491cab7c25ed9cc20e9a6e1028c032d189b973 |
|
MD5 | fd6c7e97d5bae321c355b3d13d736bab |
|
BLAKE2b-256 | 081f07027e1cd901a752dcc0872418cfd7dc12182ed6165ee405dad201049fc5 |