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.
- A way to trigger a downstream pipeline
- 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
- 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.