I created an environment variable which is in this format STAGE_${CIRCLE_USERNAME}
. So for my case the environment variable is STAGE_bernard
. I am trying to check if the environment variable exists but my logic does not seem to be working.
This is the config.yml :
jobs:
build:
parameters:
stage:
type: string
default: ""
executor: aws-cli/default
steps:
- aws-cli/setup
- checkout
- run:
command: |
if [[ -z "STAGE_${CIRCLE_USERNAME}" ]]; then
echo "Hi"
else
echo "Bie"
fi
echo $stage
But when i run it, the output is Bie
. But it should be Hi
since the environment variable does exist. Can someone please point out what i’m doing wrong. Thank you.