Set Environment Variables during a run



We’re spinning up staging environments on demand as part of the run; I want to be able to set env vars based on the outputs of the staging environment creation process (e.g. database url, other urls). Is that possible, or do I package it all in a script?


I would make a script for it.


Ok; but given how CD and infrastructure-as-code are really best practices now, it’d be nice to see support for setting variables mid-run to allow for a more descriptive circle.yml.


Hmm. If it’s not there already, you might want to add this as a Feature Request in the Discuss topic with the same name.

You could prefix a multiple-line command in circle.yml with an environment variable, in which case it’s available to you throughout the entirety of that command. Keeping a single concept/task in a script file just seemed cleaner to me.