Skip to main content

Tools for dealing with GitLab CI build variables

Project description

Build Status

GitLab Build Variables

Tools for dealing with GitLab CI pipeline build variables.


Managing Multiple Projects

Updating GitLab Build Variables

Sets project build variables based on a configuration file:

gitlab-update-variables --url ${gitlabUrl} --token ${accessToken} --default-setting-extension ${extensions} \
    --setting-repository ${repositoryDirectories} -- ${configLocation}

`See Example 1 <#example-1>`__ for a more intuitive example of how to use this tool!

Managing a Single Project

Setting a GitLab Build Variables

This tool allows a GitLab CI project’s build variables to be set from a ini config file, a JSON file or a shell script that just exports variables:

gitlab-set-variables --url ${gitlabUrl} --token ${accessToken} ${project} ${locationOfVariables}
Getting GitLab Build Variables
gitlab-get-variables --url ${gitlabUrl} --token ${accessToken} ${project}


Example 1

Using the example configuration to update the variables for a number of projects:

$ export gitlabUrl=
$ export accessToken=personalAccessToken

$ gitlab-get-variables --url ${gitlabUrl} --token ${accessToken} cn13/my-project-1
{'VALUE_1': 'other'}

$ gitlab-get-variables --url ${gitlabUrl} --token ${accessToken} cn13/my-project-2

$ gitlab-update-variables --url ${gitlabUrl} --token ${accessToken} --default-setting-extension json ini sh \
    --setting-repository examples/settings -- examples/config.json
Read config from "examples/config.json"
Set variables for "cn13/my-project-1": {'VALUE_1': 'abc', 'VALUE_2': 'other', 'VALUE_3': 'other'}
Set variables for "cn13/my-project-2": {'VALUE_1': 'abc', 'VALUE_2': 'other', 'VALUE_3': 'ghi'}

Example 2

Using the settings defined in the example directory to update a project’s variables:

$ export gitlabUrl=
$ export accessToken=applicationAccessToken

$ gitlab-get-variables --url ${gitlabUrl} --token ${accessToken} my-project
{'VALUE_1': 'other'}

$ gitlab-set-variables --url ${gitlabUrl} --token ${accessToken} group/my-project common.json project.ini
Variables for project "my-project" set to: {'VALUE_1': 'abc', 'VALUE_2': 'def', 'VALUE_3': 'ghi'}

Project details

Release history Release notifications

Download files

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

Files for gitlabbuildvariables, version 1.1.0
Filename, size & hash File type Python version Upload date
gitlabbuildvariables-1.1.0.tar.gz (25.3 kB) View hashes Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page