If an environment variable is used but not set (mostly in the CircleCI web UI), the build fails on a subsequent command where the env var is used (but set empty from Bash). This can be sometimes a long time later. Also the error message is mostly misleading.
Therefore would it be good that the
set -u option:
-u or -o nounset Treat unset variables and parameters other than the special parameters ‘@’ or ‘*’ as an error when performing parameter expansion. An error message will be written to the standard error, and a non-interactive shell will exit.
is set beside the current default
set -eo pipefail setting.
Then the builds fails directly if a wanted environment variable is not set and the error message is quite clear:
/bin/bash: line 3: SSH_KEY__XYZ: parameter null or not set