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?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With