Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which upstream project triggered a GitLab CI downstream pipeline

I have a GitLab project pipeline that triggers a downstream pipeline, GitLab multi-project pipelines.

image: docker

trigger-docs:
  trigger:
    project: my-group/docs
    branch: feat/my-feature-branch

Is there a way for the triggered pipeline in my-group/docs to find out where it was triggered from? I checked the predefined CI variables but none seems to carry this information.

Could it be that my only option is to pass a dedicated variable from the upstream project as documented at https://docs.gitlab.com/ee/ci/pipelines/multi_project_pipelines.html#pass-cicd-variables-to-a-downstream-pipeline-by-using-the-variables-keyword?

like image 580
Marcel Stör Avatar asked Oct 31 '25 06:10

Marcel Stör


1 Answers

Here's the workaround we have been using for months now; send along the custom UPSTREAM_PROJECT variable.

# Trigger a downstream build https://docs.gitlab.com/ee/ci/pipelines/multi_project_pipelines.html
docs-build:
  stage: .post
  variables:
    UPSTREAM_PROJECT: $CI_PROJECT_PATH
  # Variable expansion for 'trigger' or 'trigger:project' does not seem to be supported. If we wanted this we would have
  # to work around it like so: https://gitlab.com/gitlab-org/gitlab/-/issues/10126#note_380343695
  trigger: my-group/docs
like image 93
Marcel Stör Avatar answered Nov 02 '25 12:11

Marcel Stör



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!