Please help to understand why jobs are not started in sequence of creation

Hello!

Two pipelines from different branches generate 10 job by 5 jobs to each pipeline sequentially. For example: 1st pipeline id of jobs #1,#2,#3,#4,#5 and id of second pipeline #6,#7,#8,#9,#10. 2nd job from each pipeline (#2,#7) fetching changes from git, any other have git strategy - none. (1&2 - locking databases and 5&10 unlocking 2,3,4&7,8,9 - fetchin, compile and build)
The first and last jobs in the pipelines runs on one runner and have same tag, 2,3,4&7,8,9 have other tag and runs on second runner.

I expecting order of jobs run is 1&5 - parallel, because first runner support parralel tasking setting by parametrs concurrent = 4, next 2,3,4, because second runner runs with parameters concurrent = 1, then parallel 5 & 6,7,9, then 10.

But actually order of running jobs is 1&5 parallel, then 2,6,3,4, then parallel 5&7,9 and then 10

Gitlab CE version is 13.0.3
Gitlab runner version is 12.5.0

Actually pipelines configuration a little bit harder, than i define above.

PS When I posted this question at the first time i got message that it marked by spam. Please, if You think it spam, explain a littile bit detal about Your decision. May i asked it in wrong place?

Thank You very much.

Hi @check300373

GitLab pipelines are executes stage by stage, top to bottom according to their definition in your .gitlab-ci.yml file:

stages:
    - firststage
    - secondstage
    - ...
    - laststage

The other thing that can affect order of execution is any needs keys you might have defined. needs allows a job to start before other jobs in its stage, if the jobs that it needs have already completed.

AFAIK other than that, GitLab CI makes no guarantees about the order of execution of CI jobs, so there’s no other reason to suspect they will start in the same order each time the pipeline runs.

HTH,

Sarah

1 Like

Hello! As i understood, even if running multiple jobs is turned off not guarantee that jobs will execute in order of creation. I’ll try “needs” keyword to solve my problem. Thank You for answer.

2 Likes