Skip to content

Add variable expansion to bridge project property

Support variable expansion in project property of trigger keyword

We want to use variable expansion both in the project and the branch property of the trigger keyword. The latter functionality was already added in #10126 (closed).

trigger:
  project: $DOWNSTREAM_PROJECT_PATH   # does not work
  branch: $DOWNSTREAM_PROJECT_BRANCH  # already works

Our specific use-case for this would be to have a base job that we can extend to trigger similar pipelines in different projects. Like this:

.base-triggering-job:
  stage: trigger-downstream
  trigger:
    project: $CI_PROJECT_PATH/$DOWNSTREAM_PROJECT
    branch: $DOWNSTREAM_BRANCH
    strategy: depend
  variables:
    UPSTREAM_PROJECT_NAME: $CI_PROJECT_NAME
  
trigger-project-a:
  extends: .base-triggering-job
  variables:
    DOWNSTREAM_PROJECT: project-a
    DOWNSTREAM_BRANCH: branch-in-a
  
trigger-project-b:
  extends: .base-triggering-job
  variables:
    DOWNSTREAM_PROJECT: project-b
    DOWNSTREAM_BRANCH: branch-in-b
Edited by Tobias Dummschat