I have a number of steps in my pipeline, the first step creates many environment variables via a script which 'exports' them.
#!/bin/bash
set -e
prefix="GitVersion_"
for row in $(mono ../tools/GitVersion/GitVersion.exe | jq -c -r 'to_entries[]'); do
key=$(echo "${row}" | jq -c -r '(.key)')
value=$(echo "${row}" | jq -c -r '(.value)')
export $(echo "${prefix}${key}=${value}");
done
Unfortunately it seems they are then not avaliable within the following steps.
- step:
name: Build version
image: mono:5.12
script:
- ...
- ./scripts/gitversion.sh
- printenv
- step:
name: Build
image: microsoft/aspnetcore-build:2.0-stretch
script:
- printenv
- ...
In 'build version' step my printenv shows all my newly created envionment variables. However the first line of my build step does not have them. I understand these are created locally to the container of the previous step and therefore they would not be carried over however I need some way to do this.
Since they are created dynamicly I cannot add them to the project environment settings which get injected into each step. I need the to be created dynamicly at build, but global to the whole pipeline.
Is it possible to create global pipeline varables?