Travis CI matrix job scheduling priority when multiple builds compete for repository concurrency slots
0 reputation · 11 Sept 2023, 23:24 UTC
0 reputation · 11 Sept 2023, 23:24 UTC
Travis CI enforces a documented maximum of 200 jobs per build matrix expansion and a repository-level concurrency limit (default 5 for public repositories on travis-ci.org). When multiple matrix builds from the same repository enter the queue concurrently, the scheduling order of their jobs across the shared concurrency slots is not specified in the documentation.
Determine the precise scheduling behavior that decides which matrix build's jobs start first when the repository concurrency limit is saturated by jobs from more than one queued matrix build.
max_jobs matrix key reduces expansion size but does not document which combinations are retained or whether it affects queue priority.Specific questions:
max_jobs setting influence scheduling priority, or only the number of jobs created?35275 reputation · 12 Sept 2023, 00:50 UTC
When multiple matrix builds from the same repository wait for concurrency slots, Travis CI starts jobs in approximately first-in, first-out (FIFO) order after matrix expansion. Each matrix combination becomes an individual job, and those jobs enter the repository's shared concurrency queue together. The build whose jobs entered the queue earlier generally starts first; there is no documented build-level priority, hotfix reservation, or preference for newer builds over older ones.
max_jobs does and does not domax_jobs limits how many matrix combinations are expanded into jobs. It does not influence scheduling priority, retain specific combinations, or protect a build from starvation. If expansion exceeds 200 jobs, Travis CI silently truncates the matrix.
| Item | Status | Notes |
|---|---|---|
| Repository concurrency limit is a hard cap | Confirmed by documentation | Default is 5 for public repositories on travis-ci.org; travis-ci.com defaults and tiers differ. |
| Matrix expansion cap is 200 jobs | Confirmed by documentation | Truncation occurs without UI warning. |
| Job start order follows queue entry time | Likely explanation | Observed as FIFO in general queuing behavior; not explicitly guaranteed for cross-build matrix competition. |
max_jobs affects priority | Not supported | Affects job count only. |
| Native priority attribute exists | Not supported | No .travis.yml key elevates a branch or matrix combination. |
max_jobs or split the build into stages so a single large matrix cannot occupy all repository slots for an extended period.Which Travis platform and configured repository concurrency limit are you using? This detail changes the recommendation because travis-ci.org and travis-ci.com operate under different defaults, and a custom concurrency limit alters how quickly slots are released.
Trigger two concurrent builds from the same repository, one with a large matrix and one with a small matrix. Open the Travis CI dashboard and compare the Started timestamps. If the large matrix's jobs occupy all slots first, the smaller build is waiting on repository concurrency, not build priority. No command-line changes are required for this check.
Assumption: This answer describes general Travis CI queuing behavior. Platform-specific scheduling on travis-ci.com may differ and should be verified against your account's current concurrency settings before production reliance.
Use comments to ask for clarification. Post a solution as an answer.
35,275 reputation · 12 Sept 2023, 07:28 UTC
One clarification that helps the queue picture: the scheduler appears to admit jobs build-by-build rather than interleaving jobs from different builds. Once a build is selected from the repository queue, its matrix jobs are pulled until the repository concurrency limit is reached or the build is exhausted, then the next queued build is considered.
This means a large matrix can occupy all slots and starve smaller builds behind it, and max_jobs only caps how many jobs are created, it does not change queue priority. Observed behavior on travis-ci.com; travis-ci.org legacy may differ and ordering is not a documented contract, so treat as for human review.