Environment variables for deploy commands

envars
circle.yml

#1

Per command env vars do not seem to be working during the deployment phase ?

https://circleci.com/docs/environment-variables/#per-command-environment-variables


#2

What specifically is your issue?

I quick test has this working for me (see the deployment section):

https://circleci.com/gh/felicianotech/circleci-testing/190


#3

https://circleci.com/bb/knwn/web/97

i have a section

machine:
  environment:
    NODE_ENV: development
    AWS_DEFAULT_REGION: eu-west-1
  node:
    version: 4.3.1

but in the deployment section for specific branches i want to run a bunch of commands with NODE_ENV something else

deployment:
  development:
    owner: knwn
    branch: /.*/
    commands:
      - NODE_ENV=development npm run gen
      - NODE_ENV=development npm run deploy
  staging:
    owner: knwn
    branch: staging
    commands:
      - NODE_ENV=staging npm run gen
      - NODE_ENV=staging npm run deploy

when i push to the staging branch i still see the commands being run with the NODE_ENV set to development


#4

damn it, i think its because of the order of matching deployment tasks, nothing to do with the env vars . . .

off to test this theory


#5

Yeah I think the regex for the development environment is always triggering.


#6

Fixed for me :slight_smile:


#7