I would like to use an environment variable to specify a docker image tag:
job_name:
docker:
- image: example/example-docker:${BRANCH}
...
This environment variable can be created in a previous job and will work with the $CIRCLE_BRANCH
env to determine the value to be assigned to $BRANCH
If I set $BRANCH
in the UI it can be used as the tag name example/example-docker:${BRANCH}
but I seem to be unable to programatically assign the value to an env in config in a job before and then use that value in a later job.
I have looked into assigning an export to $BASH_ENV
echo 'export BRANCH=if [ $CIRCLE_BRANCH = 'master' ]; then echo 'master'; else echo 'develop'; fi' >> $BASH_ENV
but $BRANCH
is not available when the docker image tag needs to be assigned
Is what I am trying to do possible? Any thoughts on how I can achieve setting a docker image tagName dependant on $CIRCLE_BRANCH
?