gitlab4j-api
gitlab4j-api copied to clipboard
Cannot update project level variables when two with the same name exist
I'm using project level variables that are scoped to certain environments.
As an example, when I define the variable TEST twice for the environments staging and production, and try to update one of them, this error is returned: There are multiple variables with provided parameters. Please use 'filter[environment_scope]'.
This is the code I'm using:
var gitLabApi = new GitLabApi(baseUrl, accessToken);
gitLabApi.getProjectApi().updateVariable(42, "TEST", "value", true, "staging");
When a variable with the same name is defined multiple times, it seems that the URL parameter filter must be used: https://docs.gitlab.com/ee/api/project_level_variables.html#the-filter-parameter