Skip to content

Import Gitlab-CI Variables

Problem to solve

We can export all gitlab-ci variables to json (or other formats). It would be nice to also import them again, using the same format (e.g. for backup).

Proposal

Implement a command that reads from json and creates variables based on that json. The json can either be read from a file or from stdin.

If a variable already exists, either throw an error or update the variable (can probably be toggled).

Further details

> glab var export 
[
{
    "key": "password",
    "value": "hunter2",
    "variable_type": "env_var",
    "protected": false,
    "masked": true,
    "hidden": false,
    "raw": false,
    "environment_scope": "*",
    "description": "passwordj"
  }
] >> secrets.json

glab var import -f import.json

Links / references

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information