wtsi-hgi/gitlab-build-variables

Name: gitlab-build-variables

Owner: Wellcome Trust Sanger Institute - Human Genetics Informatics

Description: Tools for managing GitLab CI pipeline build variables

Created: 2017-02-14 10:20:36.0

Updated: 2017-11-27 15:39:34.0

Pushed: 2017-05-17 14:39:46.0

Homepage:

Size: 72

Language: Python

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Build Status codecov.io PyPI version

GitLab Build Variables

Tools for dealing with GitLab CI pipeline build variables.

Tools
Managing Multiple Projects
Updating GitLab Build Variables

Sets project build variables based on a configuration file:

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

See 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:

ab-set-variables --url ${gitlabUrl} --token ${accessToken} ${project} ${locationOfVariables}
Getting GitLab Build Variables
ab-get-variables --url ${gitlabUrl} --token ${accessToken} ${project}
Examples
Example 1

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

port gitlabUrl=https://gitlab.example.com 
port accessToken=personalAccessToken

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

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


tlab-update-variables --url ${gitlabUrl} --token ${accessToken} --default-setting-extension json ini sh \
--setting-repository examples/settings -- examples/config.json
 config from "examples/config.json"
variables for "cn13/my-project-1": {'VALUE_1': 'abc', 'VALUE_2': 'other', 'VALUE_3': 'other'}
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:

port gitlabUrl=https://gitlab.internal.example.com 
port accessToken=applicationAccessToken

tlab-get-variables --url ${gitlabUrl} --token ${accessToken} my-project
LUE_1': 'other'}

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

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.