gitlab4j-api icon indicating copy to clipboard operation
gitlab4j-api copied to clipboard

Cannot update project level variables when two with the same name exist

Open jannisfink opened this issue 3 years ago • 0 comments

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

jannisfink avatar May 25 '22 18:05 jannisfink