Bad interpolation of `CI_PIPELINE_ID` when passing variables to an another project (multipipeline projects)
Summary
This bug happens on GitLab.com and GitLab EE 12.1
(and in the previous version too)
In a context of multipipeline projects, if I want to pass CI_PIPELINE_ID
from project A to project B,
- in one case
CI_PIPELINE_ID
will be empty when the job of B is triggered - in another case,
CI_PIPELINE_ID
will take the value of the nextCI_PIPELINE_ID
(of project B)
Steps to reproduce
I created 2 projects, ping and pong with these .gitlab-cy.yaml
files:
# ping
stages:
- 🦄tests
- 🚀remote-deploy
🤞some-tests:
stage: 🦄tests
script:
#- exit 1 # Failure 😡
- exit 0 # Success 😃
📞remote1:
when: on_success
variables:
REMOTE_MESSAGE: "CI_PROJECT_ID: ${CI_PROJECT_ID} CI_PIPELINE_ID: ${CI_PIPELINE_ID}"
stage: 🚀remote-deploy
trigger: tanuki-workshops/sandbox/multi-pipeline-projects/pong
📞remote2:
when: on_success
variables:
CIPIPELINEID: ${CI_PIPELINE_ID}
REMOTE_MESSAGE: "CI_PROJECT_ID: ${CI_PROJECT_ID} $CI_PIPELINE_ID: ${CI_PIPELINE_ID} / CI_PIPELINE_ID: ${CIPIPELINEID}"
stage: 🚀remote-deploy
trigger: tanuki-workshops/sandbox/multi-pipeline-projects/pong
# pong
stages:
- 🚀deploy
👋say_hello:
stage: 🚀deploy
only:
refs:
- master
variables:
- $REMOTE_MESSAGE
script: |
echo "$REMOTE_MESSAGE"
- with the first call,
$REMOTE_MESSAGE
will be equal toCI_PROJECT_ID: 13494210 CI_PIPELINE_ID:
CI_PIPELINE_ID
is empty - with the second call,
$REMOTE_MESSAGE
will be equal toCI_PROJECT_ID: 13494210 : / CI_PIPELINE_ID:73020942
CI_PIPELINE_ID
is equal to theCI_PIPELINE_ID
of the new pipeline ob project B
Example Project
You can find a running example here: https://gitlab.com/tanuki-workshops/sandbox/multi-pipeline-projects
What is the current bug behavior?
Bad interpolation of CI_PIPELINE_ID
What is the expected correct behavior?
We should be able to copy the value of CI_PIPELINE_ID
to another variable to transfer this new variable to project B from project A
Remark
This problem exists with CI_PIPELINE_URL
too
Edited by Philippe Charrière