We are using terraform for our iac deployments to AWS. And due to the specifics of one of our deployments, and to avoid certain edge cases, we need to prevent concurrent execution of the pipeline on the master branch,
To do that I’m thinking to create a dummy state file that represents the “state” of the pipeline. And to lock it when a deployment starts and to unlock it on completion. A deployment will then only run if that state file is unlocked. I’ve tried locking with curl:
curl -XPOST --header 'private-token: <TOKEN>' "<STATEFILE_URL>/lock"
But that fails with 500. Can someone point out what I’m doing wrong here? Or should I use a different approach for locking pipelines in this way?