Can you set Gitlab CI stage so other stages don't wait for it to finish?

Viewed 5605

Let's say I have these stages defined in .gitlab-ci.yml:

stages:
    - build
    - analysis
    - tests
    - deploy
    - post-deploy

Since analysis takes a lot of time and I don't really care about the result (I also have allow_failure: true set) - is it possible to somehow define to start analysis and then immediately launch the next stage tests?

I didn't find any reference to similar topic on official docs.

EDIT:

The main idea is that all other stages can be run as if the analysis didn't even exist. If i put analysis to same stage as tests, then both analysis and tests will run at the same time, however deploy won't be launched until both of them finish. This is no good. I want tests to finish and then launch deploy, after deploy finishes I want to launch post-deploy. I really don't care about analysis result, I simply want to trigger it and continue with the deployment.

3 Answers

Stages are per definition serial. One stage will be executed after another.

If you want to process analysis and tests parallelly, you have to define them on the same stage.

stages: 
 - build
 - processing
 - deploy
 - ...

analysis:
 stage: processing
 ...


tests:
 stage: processing
 ...

https://docs.gitlab.com/ce/ci/yaml/README.html#stage

There's a workaround available in newer GitLab versions: Trigger a child-pipeline for the jobs you don't want to wait for. By default a child-pipeline will return "success" as soon after it got started, you need to explicitly set the strategy if you'd like to wait for the jobs in the child-pipeline. So by accident this is exactly the behaviour you'd like to have.

The UI is not the best right now, but I'm positive it'll improve in future versions of GitLab. It's a workaround after all, but it should do the job.

Related