Cannot trigger a multi-project pipeline

I am trying to follow this doc, passing_variable_to_downstream_pipeline for gitlab cicd and specifically in that section I was hoping to find 2 things.

  1. A way to trigger a downstream pipeline
  2. A way to pass variables to downstream pipelines

Both of which are explained in that link. My question is how should the project parameter be specified in the .gitlab-ci.yml file? It doesn’t seem to be the full url of the gitlab project like,
https://gitlab.com/api/v4/projects/<project_no>/trigger/pipeline

  • What are you seeing, and how does that differ from what you expect to see?

I’m expecting the pipeline to be triggered and variables to be passed from upstream to downstream. What I am seeing is the downstream pipeline hanging in pending state and never getting started.

  • Consider including screenshots, error messages, and/or other helpful visuals

image

  • Here is the gitlab-ci file I’m trying:

build:
stage: build
script:
- echo “this is a test”

staging:
variables:
VAR: staging
stage: build
trigger: “https://gitlab.com/api/v4/projects/<project_id>/trigger/pipeline”

  • in the downstream .gitlab-ci.yml:

build:
stage: build
variables:
VAR: $VAR
script:
- echo $VAR

  • What troubleshooting steps have you already taken? Can you link to any docs or other resources so we know where you have been?

What is working for me is when I trigger another projects pipeline through a curl command it works, but I cannot pass variables using that method.

ok I figured it out. Instead of a URL, the project needs to be the part after the domain.
For example, if the project is gitlab.com/foo/bar/baz then foo/bar/baz is what should be specified.
I still blame the documentation as that is not clear. It has taken me 2 days of trial and error.