GVC (Gitlab Variables as Code)

Seerene
2 min readJul 30, 2020

By Hurair Hashmi

Problem Statement:

With growing complexity of the infrastructure, it is difficult to manage all the Gitlab variables. CI/CD variables can be redundant and sometimes are defined on several places in group and repository level. Also, any member of the group or repository can modify the variables which can’t be tracked. Additionally, if you need to migrate your infrastructure or need to change or update a variable everywhere across groups and repositories in your Gitlab, it is a combat and requires resources and time. It’s a cumbersome process and takes a lot of effort. Furthermore, this manual process is error prone.

Solution:

For this, we thought of a solution and came up with a concept of managing all our variables as a code called GVC(Gitlab Variables as Code). GVC is a tool which maintains all your variables in a hierarchal manner structured into groups and repositories. All the repositories under a group inherit group variables.

GVC is a tool which resolves various problems:

  1. Organising all variables through files are much easier than controlling it through UI.
  2. Any change can easily be done through files and only at one level (i.e files) . GVC takes care of propagating the change everywhere.
  3. Managing variables through GVC is fast and efficient. It can be done with a simple search in your IDE.
  4. With GVC, you can track all the changes and identify the issue in variables easily.
  5. Another exciting feature of GVC is that it synchronises itself with Gitlab variables by removing all the variable created manually through UI.

GVC Features:

  1. Fetch all variables from all groups and repositories and store them as YAML files.
  2. Provides mechanism to delete variables using a cron job (Schedule Pipeline Deletion).
  3. Remain in sync among groups and repositories.
  4. Able to create/update variable.

GVC gave us the ability to track our changes, maintain our variables centrally and change them easily. GVC being infallible, accurate and capable of managing variables have made our day to day process smooth and agile.

--

--

Seerene

End-to-end analytics to improve the speed, standard and cost-effectiveness of software development.