1
votes

I am exploring Gitlab APIs to work with CICD. For updating gitlab CICD variable, I use following API

PUT /projects/:id/variables/:key

here is the document regarding it. This API works perfect if the variable is unique for CICD. But If I use duplicate name variable with different environment_scope, it some time update my variable but most time fail to update. It throws following error

key: [MY_KEY] has already been taken

I checked in gitlab issues here but didn't found any proper solution regarding it. For reference, my gitlab version is GitLab Community Edition 12.8.1

Can anybody help me regarding this?.. Thanks in advance.

1

1 Answers

0
votes

From the documentation found here, It appers you need to amend the follow to the end of the line:

--form "value=updated value"

So ultimately you will have:

PUT /projects/:id/variables/:key --form "value=updated value"