Set Environment Variables inside a run

circle.yml

#1

What I’m really after is better support for “contexts”; we spin-up and tear-down staging environments as part of the CI run, and I’d like to be able to set the outputs (e.g. server address, db url etc.) to be available for code that is to be deployed to the newly-minted environment.


#2

The hack I’m doing now is piping the JSON output to a file, and have a utility to parse the outputs, along the lines of:

##################
#
#   Given a path to a json file and a key, extracts and unquotes the json value
#
cat $1 | jq ".${2}" | sed 's/"//g'

#3