Support creating project variables
Describe the feature or problem you'd like to solve
It will be nice if glab
provides support for creating project variables. Currently, users have to switch over to the GitLab web UI to create project variables
Propose a Solution
Provide variable create
command for creating project variables.
Should have the format glab variable create <key> <value> [flag]
.
new
and set
can be used as aliases for create so glab variable set <key> <value> [flag]
and glab variable set <key> <value> [flag]
will be accepted.
Below are the parameters required by the endpoint and the suggested flags for glab
Attribute | Suggested Flag | Type | required | Description |
---|---|---|---|---|
key | none (must be passed as first argument) | string | yes | The key of a variable; must have no more than 255 characters; only A-Z, a-z, 0-9, and _ are allowed |
value | none (must be passed as second argument) | string | yes | The value of a variable |
variable_type | -t | --type |
string | no | The type of a variable. Available types are: env_var (default) and file |
protected | -p | --protected |
boolean | no | Whether the variable is protected |
masked | -m | --masked |
boolean | no | Whether the variable is masked |
environment_scope | -s | --scope |
string | no | The environment_scope of the variable |
Additional context
https://docs.gitlab.com/ee/api/project_level_variables.html#create-variable