Is it possible to ensure only a single instance of a build is run per project?

The deployment phase of our build is not ‘thread safe’ if you will and so multiple
instances of a circleci build attempting to simultaneously deploy resources could
cause us problems. Is it possible to ensure that each build of a specific project is run synchronously?

I’m imagining the scenario where two pull requests are approved back to back causing two overlapping circleci builds to be kicked off. This is arguably bad practice to begin with, however, it is possible so I would like to insulate myself as much as possible in the build.

If this is still valid, and for future reference, what we did is just utilize all of the available parallelism in a single build, which effectively made the builds run synchronously.

You may find this project helpful: https://github.com/bellkev/circle-lock-test It provides a way to serialize deploys or other build steps in “userspace” if you will.