Trigger parametrization

Is it possible to parametrize triggering a pipeline?

Hi all,
I’m dealing with this new project in our self-managed gitlab and I’m trying to ease my job, since I’m kinda lazy person.

I have a multiple similar project with their pipelines setup. I’m a fan of reusable code, so I use an include functionality quite frequently. In each project I need to trigger another downstream pipeline from different project. The structure is somehow like this:

  • parent01 project/pipeline triggers child01 project/pipeline
  • parent02 project/pipeline triggers child02 project/pipeline
  • parent03 project/pipeline triggers child03 project/pipeline

For triggering child pipeline I use the dead simple trigger notation in specific job like

downstream-job:
  stage: .post
  trigger: /path/to/child/project

This works, but I have to write this stuff again and again for all the parent projects like:
(parent project1)

#parent project1
trigger: /path/to/childproject1
#parent project2
trigger: /path/to/childproject2

etc. You get the point

And the question is:
Can I extract the path to a child project to a variable and pass it to the trigger keyword?
Something like:

#parent project2
trigger: ${PATH_TO_CHILD_PROJECT}

Ideally with separating this bit to a dedicated file and including it via include functionality. You know, to reuse it in all “parent” projects.

I’ve tried to experiment with it and it seems, that the job stucks in pending state, because (presumably) its not able to trigger the target child project (perhaps the variable is not expanded?).

image

Am I doing something wrong?
Is this even possible in Gitlab?

(I’m using Gitlab CE)

Thanks for all helpful replies :slight_smile:

Viktor.