For example I've setup name: FOO value: 'bar'
.
I've validated that the key value works. Because what does work is:
jobs:
build:
docker:
- image: circleci/node:10.17.0
steps:
- run: |
node something $FOO
However, the following does not work:
Now when I deploy and try to use it in my application it returns undefined:
console.log(process.env.FOO); // returns undefined
I tried setting it under the 'environment' key in the config.yml file:
jobs:
build:
docker:
- image: circleci/node:10.17.0
environment:
- FOO # note, don't use $FOO
steps:
- run: |
node something $FOO
ssh $MACHINE -- 'cd /home/ && docker build -t myApp . docker restart myApp'
But still no change.
Should I perhaps pass the variables to the build script in the ssh command?
Any ideas?
update based on Delena's tip
Kept ./circle-ci/config.yml
as:
jobs:
build:
docker:
- image: circleci/node:10.17.0
environment:
FOO: $FOO
Then in the docker-compose file:
myApp:
environment:
- FOO
Will accept the answer when the build is green