Passing dotenv variables to downstream pipeline


I would like to pass a dotenv variable to a downstream pipeline. The variable is “created” during build, because the version is extracted from a source file.

   stage: prepare_build
     - export VERSION=$(cat package.json | jq -r .version)
     - echo "VERSION=$VERSION" >> build.env
       dotenv: build.env

In the next build steps the variable VERSION is available and contains the correct version value. Everything is fine so far.

But in the last step I want to pass this variable to a downstream pipeline:

  stage: trigger_deploy
     project: my/project

This doesn’t work. The variable VERSION contains the string $VERSION, not the actual version number as in all build steps before.

Is it not possible to pass dotenv variables to downstream pipelines? If not, is there any other way to do it?

Thanks for your help.

Best regards,

Nobody? I can’t be the only one having this “issue” …

I have the exactly same problem. I guess it is related to the fact that jobs with the trigger-key are treated as ‘trigger-bridge-jobs’ with some limitation:
Most important one: They are not run on a Gitlab-Runner. My guess is the automatic reading of the dotenv-Artifact is normally handled by the Runner.

So for now you probably have to trigger the downstream pipeline manually:
This will allow you to pass variables yourself:

This sounds like exactly the problem I’ve encountered too. I created for it.