Search code examples
gitlabgitlab-cigitlab-ci-runnercicd

Gitlab CI: Trigger all projects in one stage starting with prefix


I have created upstream Pipeline, and want to trigger all projects in downstream pipeline.

My project looks like

My_Project
    My_Project/test/1
    My_Project/test/2
    My_Project/test/3
    My_Project/test/4

.gitlab-ci.yml

run-all-projects:
 stage: build
 trigger:
     project: My_Project_1
     branch: main
     strategy: depend

Is there any way to run all projects in one stage?

or maybe in a loop by using script: API curl call and wait until i receive response?


Solution

  • You can do it using script. in a loop but its not a good solution. You can put more conditions in CI file.

    for example you have 5 projects then you can create 5 conditions separately. and then wait for one one of them to finish by using strategy Strategy: depend.