Utilizing BASH_ENV
CircleCI defines an environment variable called BASH_ENV at the start of every build. You can see what this variable is set to at the "Spinning up environment" step.
This can be overridden in the config file, or anywhere else that environment variables can be set (e.g. project settings, contexts, etc.).
If the file exists, it will be sourced with code like the following before every step is executed:
. $BASH_ENV
This is useful for all sorts of things. For instance, if a piece of code generates environment variables used in later steps, adding those variables to the BASH_ENV file is how to get that done.
Additional resources: https://circleci.com/docs/2.0/env-vars/#setting-an-environment-variable-in-a-shell-command
Comments
Article is closed for comments.