I started trying out workflows, but I guess the same question could apply to job steps.
One of my workflow jobs (previously a build step) is for deployment. When we start multiple builds concurrently on the same branch and if both of them get to the deployment step roughly at the same time one of them will inevitably fail due a currently running deploy (we deploy ECS services through AWS CloudFormation and it will complain for any actions on the Stack unless it’s on a stable state). Is there any way to serialize those steps? So that if a deployment is already running for that branch the next one is blocked until the previous finishes.
It would be even better if there was a way to “queue” artifacts while that job is running and only run the step for the last one that was successfully built. I believe AWS CodePipeline does this.
This means we could trigger several builds at the same time and make sure only the most recently built artifact (docker image in our case) is deployed.
I went through the docs and I couldn’t find anything, but I believe it would be very useful and it will definitely increase the reliability of our builds.