Presets for ENVIRONMENT VARIABLES - same names, different values?

2.0
#1

Hi all,
I am setting up a new Circle CI 2.0 script to build and deploy against multiple environments (staging, prod), I’ll call these “pipeline stages”. In our team each branch in the repo is aligned with a pipeline stage (i.e “dev <=> staging”, “master <=> prod”). It’s all very common, I am sure.

For every pipeline stage there is the same set of environment variables, but with different values (i.e. DATABASE_URL, EBS_APP_NAME, QUEUE_URL, APP_URL, etc)

Ideally I would like to run the circle CI script injecting the “pipeline stage”, so that the scripts automatically injects the correct set of value into the environment variables.

Is there any feature in Circle CI 2.0 that would support this?

#2

Do you have the environment name accessible in your job? If so, you could have a repo folder of shell scripts to source, named staging.sh, prod.sh, etc. These would contain your vars to load. It’s not ideal for secret vars, but it would do the trick for ordinary ones.

closed #3

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.