As far as I can tell, in 2.0 environment variables in the config YAML are specified as part of each build job. Is there a way to specify variables that are passed to all the jobs so we don’t have to repeat them a bunch of times in the configuration? I see https://discuss.circleci.com/t/circle-2-0-global-environment-variables/8681 but it seems to apply to an older version of the config.yml syntax.
I configure a set of defaults that is then merged into the job definitions:
version: 2 defaults: &defaults environment: NODE_ENV: test RAILS_ENV: test docker: - image: org/ci:latest working_directory: /home/circleci/app jobs: checkout_code: <<: *defaults steps: - checkout - etc build: <<: *defaults steps: - .... build app specs: <<: *defaults steps: - ...
For jobs where I specify a different environment or set of docker images, I overwrite everything, duplicating RAILS_ENV, etc.
This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.