Variable snapshots and rotating secrets - snapshot via api?

Is there a simple way to update the variable values in a release snapshot via api calls? We rotate secrets on our databases which is causing issues with invalidating releases because the variable values are not usable if certain infrastructure pieces have been updated after the release is created but before it is promoted into an environment that has been updated. I need to be able to update all releases within a project created between a start and end date or similar.

Hi,
Thanks for getting in touch.
You can absolutely update the variable values in a release snapshot via API calls, so the next time it runs, it will capture the latest values.
Here’s a couple of scripts that might be helpful.

  1. Script to add variables to a Project: https://gist.github.com/Dalmirog/89626e8fd7833ed8de09
  2. Script to update a Release’s Variables Snapshot: https://gist.github.com/Dalmirog/1f77f6a329c4ab038eaa

As a side note, this only works with variables, not the deployment process of a Release. Updating deployment processes require a new release to be created before the changes will take effect.

I hope that helps!

Kind Regards,
Tina