Source a bash file before every command

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.


This is useful for all sorts of things. 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, for instance.

This is actually documented, but is easy to miss:

Was this article helpful?
0 out of 0 found this helpful



Please sign in to leave a comment.