I want to run jobs in the same stage sequentially instead of parallel in GitLab CI. Currently this is what I have:
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?
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.