Skip to main content

A Python wrapper for retrieving Gitlab CI/CD variables

Project description


A Python wrapper for retrieving Gitlab Ci/CD variables to enable injecting them into locally running GitLab CI/CD pipelines run with gitlab-ci-local.



Run the glabvars CLI app inside a git repository with a Gitlab remote. The application can return a YAML configuration string for gitlab-ci-local to stdout. You can pipe this output to .gitlab-ci-local-variables.yml so that gitlab-ci-local can use the variables.

glabvars --target gcl > .gitlab-ci-local-variables.yml

Output targets

Gitlab-CI-Local: gcl

When passing --target gcl, glabvars will output to stdout a YAML configuration file that can be used by gitlab-ci-local.

Environment: env

When passing --target env, glabvars will output .env files and file-type variable files. These files are postfixed with .<environment_scope> if the environment_scope of a CI/CD variable is not '*'. These files are written in the --env-path directory (default: .gitlab)


Install with pip to install globally:

pip install glabvars

Or alternatively with pipx to isolate dependencies of glabvars from other globally installed Python apps (requires pipx):

pipx install glabvars


You must have glab installed and be authenticated with the relevant Gitlab instance to retrieve the CI/CD variables. Check whether you are authenticated by calling glab auth status.

Future work

Make it extensible to other targets.

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

glabvars-0.2.0.tar.gz (6.3 kB view hashes)

Uploaded Source

Built Distribution

glabvars-0.2.0-py3-none-any.whl (7.8 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