With Semaphore CI 2.0, you don’t pay for a reserved amount of containers that can be run in parallel as in some other CI providers. Instead, they count the amount of work time spent on running containers. This creates an incentive to run more parallel jobs to execute our tests fast and still keep bill at a similar level as if we would just run all tests in single container waisting our own time.
In order to run parallel jobs with our tests in an optimal way, we need to ensure each job will finish work at a similar time. This way, there will be no bottleneck like a job executing too many tests or too slow tests. The slow job could make our whole CI build slower. Especially end to end tests (E2E) can be very slow and their time execution can vary.
You can split tests across parallel jobs in a dynamic way to ensure all jobs complete work at a similar time using the Knapsack Pro Queue Mode. You can learn more about what other problems can be solved with Queue Mode in the video at the very end of this article but right now let’s jump to the Semaphore CI 2.0 demo example and the config examples we could use.