feat: add variable import command

What does this MR do and why?

Adds glab variable import, the inverse of glab variable export. It reads the exported JSON (an array of variable objects, the same shape glab variable export --output json emits) from standard input or --input-file, then creates each variable in the current project, or in a group with --group. By default it stops with an error if a variable already exists; pass --skip-existing to skip those and continue.

This makes variables portable: back them up with export, then restore or migrate them with import.

glab variable export | glab variable import
glab variable import --input-file variables.json
glab variable export --group gitlab-org | glab variable import --group gitlab-org
glab variable import --input-file variables.json --skip-existing

Testing

Unit tests cover project import, group import, --skip-existing, the default fail-on-conflict behavior, and empty input. Command docs were regenerated with make gen-docs.

Scope

Updating existing variables (for example an --update toggle) is a natural follow-up; this MR keeps to create plus --skip-existing to stay focused, and I'm happy to add it if reviewers prefer.

Closes #7952 (closed)

Merge request reports

Loading