How to transfer CI_PIPELINE_IID from upstream pipeline in one project to downstream pipeline in another project?

Problem to solve

I have one project with a pipeline and some variables defined. One of the variable uses $CI_PIPELINE_IID. The pipeline has a trigger job defined to run a pipeline in another project.

The downstream pipeline in the other project is using the variables from the upstream pipeline. However, it seems that the variable that used $CI_PIPELINE_IID contains the IID from the downstream pipeline. I would have expected the IID from the upstream pipeline.

Any ideas how to transfer the IID of the upstream pipeline to the downstream pipeline?

Steps to reproduce

  1. Trigger upstream pipeline.
  2. Check echo job for CI_PIPELINE_IID output in upstream pipeline
  3. Check echo job for CI_PIPELINE_IID output in downstream pipeline



  • Self-managed
  • SaaS: GitLab Enterprise Edition 16.11.0-pre
  • Self-hosted Runners