You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description of the problem, including code/CLI snippet
When attempting to fetch a project variable with a specific environment_scope using the python-gitlab API (v5.6.0) against GitLab server (17.6.5-ee), the documented and intuitive approaches do not work. Specifically, neither passing environment_scope nor filter_environment_scope as arguments to ProjectVariableManager.get() resolves the error 409: There are multiple variables with provided parameters. Please use 'filter[environment_scope]' even when only two variables exist with unique environment scopes.
The only way to successfully fetch the correct variable is by using the undocumented query_parameters argument, as discovered by reading the source code:
This workaround is not documented and the error message does not guide the user to this solution. The documentation and exception message should be updated to clarify the correct usage.
Expected Behavior
Passing either environment_scope or filter_environment_scope as an argument to ProjectVariableManager.get() should allow selection of the correct variable when multiple variables share the same key but have different environment scopes, as described in the GitLab API documentation. The library should transparently handle the filter parameter, or at least document the correct usage.
Actual Behavior
Passing environment_scope or filter_environment_scope as arguments to get() results in a 409 error from the API:
gitlab.exceptions.GitlabGetError: 409: There are multiple variables with provided parameters. Please use 'filter[environment_scope]'
The only way to successfully retrieve the variable is by passing the filter as a query_parameters dictionary, which is not documented (at least, not in the places where the documentation would be of use):
Description of the problem, including code/CLI snippet
When attempting to fetch a project variable with a specific
environment_scope
using the python-gitlab API (v5.6.0) against GitLab server (17.6.5-ee), the documented and intuitive approaches do not work. Specifically, neither passingenvironment_scope
norfilter_environment_scope
as arguments toProjectVariableManager.get()
resolves the error409: There are multiple variables with provided parameters. Please use 'filter[environment_scope]'
even when only two variables exist with unique environment scopes.Example (all fail with 409 error):
The only way to successfully fetch the correct variable is by using the undocumented
query_parameters
argument, as discovered by reading the source code:This workaround is not documented and the error message does not guide the user to this solution. The documentation and exception message should be updated to clarify the correct usage.
Expected Behavior
Passing either
environment_scope
orfilter_environment_scope
as an argument toProjectVariableManager.get()
should allow selection of the correct variable when multiple variables share the same key but have different environment scopes, as described in the GitLab API documentation. The library should transparently handle the filter parameter, or at least document the correct usage.Actual Behavior
Passing
environment_scope
orfilter_environment_scope
as arguments toget()
results in a 409 error from the API:The only way to successfully retrieve the variable is by passing the filter as a
query_parameters
dictionary, which is not documented (at least, not in the places where the documentation would be of use):Specifications
The text was updated successfully, but these errors were encountered: