Dynamic branch name for a downstream job in Gitlab CI/CD

trigger-job:
stage: deploy
trigger: my/app-path
branch: my-branch

1) Passing the branch name with custom environnement variables

variables:
MY_APP_BRANCH: new-feature
trigger-job:
stage: deploy
trigger: my/app-path
branch: $MY_APP_BRANCH

2) Using a job to pass environment variables to other jobs

job-to-pass-var:
script:
- echo "MY_APP_BRANCH=my-dynamic-branch-name" >> build.env
artifacts:
reports:
dotenv: build.env
trigger-job:
stage: deploy
trigger: my/app-path
branch: $MY_APP_BRANCH

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store