Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run jobs in the same stage sequentially in Gitlab CI

I want to run jobs in the same stage sequentially instead of parallel in GitLab CI. Currently this is what I have: enter image description here

I want unit-test to run before integration-test and not in parallel. I have looked into the docs and have encountered DAG but it needs the job to be in a prior stage and cannot be on the same stage. Is there a way to achieve this?

like image 359
Jiji Avatar asked Nov 21 '25 00:11

Jiji


1 Answers

Yes its already described in the documentation for stages, jobs are started in parallel in one stage.

It says:

To make a job start earlier and ignore the stage order, use the needs keyword.

As you said, this is not possible in GitLab < 14.2 within a stage (needs):

needs: is similar to dependencies: in that it must use jobs from prior stages, meaning it's impossible to create circular dependencies. Depending on jobs in the current stage is not possible either, but support is planned.

As an alternative, you could define several stages and use the keyword needs between jobs in these stages.

Since GitLab 14.2 (issue) its possible.

like image 116
Jakob Liskow Avatar answered Nov 24 '25 16:11

Jakob Liskow



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!