Thank you for your quick reply, Jaryt.
Something is puzzling me with this approach you proposed. The appending that takes place on BASH_ENV would occur only after the spin up of the postgres image which requires the configuration. It fails right away.
Am I missing something here? Is there a way to execute this command before the docker part comes into play? Here is my config.yml now:
config.yml
version: 2.1
orbs:
ruby: circleci/ruby@0.1.2
jobs:
build:
docker:
- image: circleci/ruby:2.6.3-stretch-node
environment:
RAILS_ENV: test
RACK_ENV: test
- image: postgres:12.3
executor: ruby/default
steps:
- run:
name: Define Environment Variables at Runtime
command: |
echo 'export POSTGRES_USER=$TEST_DB_USERNAME' >> $BASH_ENV
echo 'export POSTGRES_PASSWORD=$TEST_DB_PASSWORD' >> $BASH_ENV
echo 'export POSTGRES_DB=$TEST_DB_NAME' >> $BASH_ENV
source $BASH_ENV
...
