Configurable "supersede" scope for serial-group (enable a true FIFO queue across branches)
N
Nicholas.gooding@payjoy.com
Today, serial-group skips a queued job whenever a newer pipeline in the same project holds or waits for the same group. That's right for deployments, but it breaks serial groups used to protect a shared resource, such as a staging database used by integration tests. In that case every pipeline needs to run, one at a time.
Current behavior (from the docs)
"Jobs from newer pipelines (higher pipeline numbers) take precedence over jobs from older pipelines within the same project. If a job from an older pipeline tries to run while a newer pipeline's job is waiting or running, the older job is automatically skipped."
Problem scenario
- PR A's pipeline acquires serial-group: org/project/staging-tests and runs.
- PR B and PR C queue for the same group.
- A merge to main triggers a pipeline that uses the same group.
- When PR A finishes, PR B and PR C are skipped (not_run) because main's pipeline is newer, even though they come from unrelated branches.
As a result, developers have to re-run skipped PR workflows by hand. These workflows also show as successful even though their tests never ran.
Requested change
Add an optional setting that controls which newer pipelines can skip an older one, for example:
- integration-tests:
serial-group:
key: << pipeline.project.slug >>/staging-tests
supersede: branch # project (default, current behavior) | branch | revision | none
- project: current behavior, for backward compatibility.
- branch: a newer pipeline skips older queued jobs only on the same branch. Jobs from other branches wait their turn in FIFO order.
- revision: a newer pipeline skips older queued jobs only for the same commit SHA, for example on re-triggers.
- none: a strict FIFO queue that never skips. It's still bounded by the existing 5-hour queue timeout.
Why native support matters
- The community eddiewebb/queue orb, which did FIFO queuing, is deprecated in favor of serial-group. It also relies on legacy v1.1 APIs and a personal API token.
- Workarounds such as polling the API inside the job use credits and hold a runner slot while waiting. Native serial-group queuing waits for free.
- Auto-cancel redundant workflows already handles "newer push on the same branch". A branch scope would make serial-group work the same way for shared-resource locks.
Environment: CircleCI Cloud, GitHub org, self-hosted runners plus cloud executors. Serial groups are used across PR and default-branch pipelines