CI multi-project pipeline

I am trying to setup a complex multi-project pipeline, something line:

Project A  -> Project B
           -> Project C -> Project E
           -> Project D -> Project E

I was able to setup all the .gitlab-ci.yml to trigger the tree correctly and update the top level status based on failure on the dependencies. What I am now trying to do is getting Project E job to only be executed once. Is there a way to get it to dedupe and get it to run that job once?

Is it possible to tell me how did you setup all the gitlab-ci.yml for A C E for example?

Yes, sure. I followed the documentation on https://docs.gitlab.com/ee/ci/parent_child_pipelines.html and https://docs.gitlab.com/ee/ci/yaml/#simple-trigger-syntax-for-multi-project-pipelines. You essentially go to project A and add the trigger to project B and on project B you put the trigger for project C. I created a “downstream” stage after my normal final stage to trigger the next project, so it looks something like this:

dependacy-1:
  stage: downstreams
  trigger:
    project: <project B>
    strategy: depend
  only:
    - master

Thanks you for your reply.

For example, on project A, you put a trigger on project B. What does it mean exactly ? Like when the pipeline run on project A (.gitlab-ci.yml from A), he will run the .gitlab-ci.yml from B ?

Exactly - you make project A pipeline trigger the pipeline of project B. Project B will get it’s own pipeline ID and everything, but when you look at project A pipeline, you can see the full set. If you have multiple triggers (i.e. project A triggers project B and C), you can see the concurrent executions (it will show you a tree view showing the split and each of the pipelines).

It’s pretty cool, but if you have multiple projects trigger the same project, you would see that one project getting triggered multiple times… If it was smarter, it would have trigger all the direct dependencies up to that project, then hold, run that one project and now it can continue single execution. It might not be a problem on small number, but when you have complex system it add up quite an overhead…