Overview
In some cases you may need to use an environment variable when specifying a path. For example: source ${CIRCLE_WORKING_DIRECTORY}/script.sh which will expand to the string literal ${CIRCLE_WORKING_DIRECTORY}/script.sh when using the Docker executor.
Example error:
Resolution
You can use the
pwdcommand. Example:source $(PWD)/script.sh.You can use the eval command. Example:
source $(eval echo ${CIRCLE_WORKING_DIRECTORY}/script.sh)Add the following run step to your build:
- run:
name: "Fix CIRCLE_WORKING_DIRECTORY"
command: echo 'CIRCLE_WORKING_DIRECTORY="${CIRCLE_WORKING_DIRECTORY/#\~/$HOME}"' >> $BASH_ENV