Skip to content

Support variable expansion in branch property of trigger keyword

We want to avoid spawning an actual CI job on CI runner just to execute cURL to trigger downstream pipelines which bridge jobs should allow us to do.

But we maintain several branches in parallel and want to propagate the correct branch into the downstream pipeline, e.g. a master build in the upstream project should trigger a master build in the downstream project whereas a build of release-v1.0 upstream should trigger release-v1.0 downstream.

We naively tried to accomplish this using a bridge job with

trigger:
  project: downstream/project
  branch: $CI_COMMIT_REF_NAME

as we did use --form "ref=$CI_COMMIT_REF_NAME" as a command line argument to curl before. But this does not work as variables are not expanded in the branch parameter and hence the bridge job fails as no ref named $CI_COMMIT_REF_NAME exists in the downstream repository.

Edited by Jason Yavorsky