Expose a Container Number



Currently, there is no visibility into the parallelism across builds of different commits. Rather than parallelize the build of a single commit, I need to run builds of separate commits in parallel with an environment variable indicating the container number being used.

For example, if our account supports three containers, the container number should be 0, 1, or 2. No two builds running concurrently should have the same container number.

I can approximate this behavior by using CIRCLE_BUILD_NUM modulo 3, but this doesn’t guarantee that all builds running concurrently have unique container numbers. Because my tests deploy code to a remote endpoint that can only accommodate a single build at a time, builds may back up, then time out, while another endpoint remains idle.