I’m trying to build a multi-project CI/CD pipeline.
I like the syntax of triggering downstream jobs in .gitlab-ci.yml
:
downstream:
stage: downstream
variables:
UPSTREAM_PROJECT: $CI_PROJECT_PATH
UPSTREAM_SHORT_SHA: $CI_COMMIT_SHORT_SHA
trigger:
project: acme/deployment
But, how would I inject a dynamic variable into acme/deployment
job? I want to read version number from the build, and then pass it down.
As it is a bridge job I can’t use script
, so I can’t read it within the same job. I thought maybe a global
before_script:
- export APP_VERSION=$(cat versions/$APP_NAME.txt)
But that does not work (which makes sense to me, since it not executed on a runner).
But now I am out of ideas. How would I inject dynamic content into the bridge job? Is it possible at all ? Or do I need to consider other solutions? Suggestions?