Config for all shell commands


#1

It would be great to have the option to enable set -e on all shell steps without having to explicitly set it each time. Another use case would be sourcing a file with env vars once in the config instead of each time.


Configure a default shell for all commands
#2

We accomplish this by prefixing all of the environment variables we want in our Docker environment with CIENV_ and then grep and awk them into .env which gets picked up by docker-compose.

So if I setup environment variable CIENV_HELLO with value WORLD we’d end up with

HELLO=world

in .env.

Here’s the script we use to accomplish that.

( set -o posix ; set ) | grep CIENV_ | awk -F CIENV_ '{ print $2 }' > .env

Might be helpful until this gets implemented.


#3

Default shell options are now implemented and documented:

https://circleci.com/docs/2.0/configuration-reference/#default-shell-options

TLDR:

  • -e option is set as default
  • -o pipefail option is set as default

Configure a default shell for all commands
#4