By default, jobs are dispatched (taken from the queue and assigned to an agent) on a first-in-first-out basis. However, job priority and pipeline upload time can affect that order.
priority is 0 by default, you can prioritize or deprioritize jobs by assigning them a higher or lower integer value. For example:
Job priority is considered before jobs are dispatched to agent queues, so jobs with higher priority are assigned before jobs with lower priority, regardless of which has been longest in the queue.
Prioritization can only be set on jobs, and only applies to command jobs, including plugin commands. Setting a default command job priority across a whole build is coming at the start of 2022.
Jobs are dispatched in the following order:
- Job priority in descending order, highest number to lowest (
- Date and time scheduled in ascending order, oldest to most recent (
scheduled_at). Note that jobs inherit
scheduled_atfrom pipeline upload jobs, meaning jobs that are uploaded by a pipeline in an older build will be dispatched before builds created after that, and the value of
scheduled_atcannot be modified.
- Upload order in pipeline, first to last.
- Internal id in ascending order, used as a tie breaker if all other value are the same, meaning older jobs will be dispatched first.
Here's an example of prioritizing jobs running on a default branch before pull request jobs: