Triggered steps don't have access to Commit Info for triggering branch

Summary

When setting up a trigger as a build step, the name and other commit info for the branch that is triggering the build is not available. Instead the branch name for the repo that is being triggered is used instead. This blocks the ability for being able to communicate the built branch info to the triggered build.

Steps to reproduce

Add a step to the .gitlab-ci.yml file:

  stage: post
  trigger: my/triggered/job
  variables:
    BRANCHNAME: $CI_COMMIT_REF_NAME

What is the current bug behavior?

When triggered from the develop branch on the parent repo, the BRANCHNAME variable is passed in as master, the branch of the child repo, not the parent one.

$ echo "$BRANCHNAME"
master

What is the expected correct behavior?

As per the docs: https://docs.gitlab.com/ce/ci/multi_project_pipelines.html#specifying-a-downstream-pipeline-branch

When triggered from the develop branch on the parent repo, the BRANCHNAME variable should be passed in as develop, the branch of the parent repo, not the child one.

$ echo "$BRANCHNAME"
develop

Results of GitLab environment info

Running with gitlab-runner 12.0.2 (d0b76032)

Edited Aug 26, 2019 by marcato15
Assignee Loading
Time tracking Loading