Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

git_variables-0.1.1.tar.gz (6.8 kB view hashes)

Uploaded Source

Built Distribution

git_variables-0.1.1-py3-none-any.whl (8.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page