Reputation: 971
Currently we are using Github Actions for CI for infrastructure.
Infrastructure is using terraform and a code change on a module triggers plan and deploy for changed module only (hence only updates related modules, e.g 1 pod container)
Since auto-update can be triggered by another github repository push they can come relatively on same time frame, e.g Pod A Image is updated and Pod B Image is updated. Without any concurrency in place, since terraform holds lock, one of the actions will fail due to lock timeout.
After implementing concurreny it is ok for just 2 on same time pushes to deploy as second one can wait for first one to finish.
Yet if there are more coming, Githubs concurreny only takes into account last push for queue and cancels waiting ones (in progress one can still continue). This is logical from single app domain perspective but since our Infra code is using difference checks, by passing deployments on canceled job actually bypasses and deployment!.
Is there a mechanism where we can queue workflows (or even maybe give a queue wait timeout) on Github Actions ?
Upvotes: 2
Views: 857
Reputation: 971
Eventually we wrote our own script in workflow to wait for previous runs
Get information on current run
Collect previous non completed runs and wait until completed (in a loop)
If exited waiting loop continue on workflow
Tutorial on checking status of workflow jobs https://www.softwaretester.blog/detecting-github-workflow-job-run-status-changes
Upvotes: 1