Filip Jeřábek
Filip Jeřábek

Reputation: 41

How to modify CircleCI project environmental variable value from CircleCI workflow using any API etc.?

I would like to implement a quick and easy to use way how to block (if needed) an operation in CircleCI workflow. Ideal case would be some UI with toggleable variables which values I can easily change in UI and check the value in CircleCi pipeline but without introducing additional application, so basically I need those variables either in Github or CircleCI. Unluckily any of these products does not provide such functionality. I am surprised that I havent found any alternative approach on the internet, is it such a corner case?

Usage example: I merge a potentionally faulty code to main to test it (whatever the reason to merge the code) and I would like mark somehow that it could break the production if is deployed without hoping that I post it in a chat and believe that everyone see it. So I toggle a variable and when someone runs the deploy pipeline, it will check the variable value and will get paused/canceled. After the variable is se to true (ok), then the workflow will be (manually) retried.

I have been searching for any alternative and the only way seems to be environmental variables in CircleCI (either project variables or context variables). Though I am not able to just change the value of the variable in CircleCI UI, but I have to delete the variable and add it again, which is not really easy to use.

So I was thinking about introducing a new step in the workflow, which when gets approved, it will change the value of the variable to false (blocking the operation) and then another following to set it to true. But I havent found any way how to change the project/context environmental value from the workflow, all the articles relates to local bash and workflow variables or injecting variable as a parameter to pipeline.

It is possible to modify CircleCI project environmental variable value from CircleCI workflow using any API etc. ?

Upvotes: 0

Views: 15

Answers (0)

Related Questions