Search code examples
concourse

The purpose of `serial:true` for concourse


I have a question about what serial: true does with respect to jobs. It seems a little redundant since serial_groups already seems to control the serial execution of multiple jobs. But at the same time inside of the plan there are constructs like do that run steps of a plan in a series.

The documentation says this:

serial: boolean Optional. Default false. If set to true, builds will queue up and execute one-by-one, rather than executing in parallel.

In in the "Concepts" section, concourse seems to define a "build" as

An instance of execution of a job's plan is called a build

In that case, if you don't specify build steps inside of a do, will they run concurrently?


Solution

  • serial: true means that a specific job will only run one build at a time, however putting multiple jobs in a single serial_group means that all of the jobs in that group will run serial in relation to one another.

    For example, if I define job job1 as serial: true, and quickly execute four builds of job1, then the first build will run, and builds 2, 3, and 4 will wait in pending state. When build 1 finishes, build 2 will kick off, and builds 3, and 4 will waiting in pending state, and so on.

    If a define job1, job2, and job3 in a serial_group, and I kick all of them off at the same time, then one of those jobs, lets say job2, will run, and the rest will wait in pending state. Then another job, lets say job1 will run, and job3 wil wait in pending state until job2 finishes, and then job3 will run.