Hi there! Could you share the whole config so we can see the context in which you are trying this? Please wrap it in 3 backticks so it formats correctly, such as
It doesn’t work.
If I run env in the container I see DB_NAME=test_{{ .Environment.CIRCLE_NODE_INDEX }}
It seems like it’s interpreting it as a literal.
Is that just a typo, or do you really not have a colon in your docker key here? I don’t think it will work like that. (If it is a typo, please always copy+paste your work).
In the meantime, the OP could create their own child image of circleci/node:10.15 that accepts $CIRCLE_NODE_INDEX as a command parameter. Not quite as clean, admittedly, but I think it would work.
Hmm, I would expect the command to be interpolated by CircleCI first. If your container receives the literal string "$CIRCLE_NODE_INDEX" then it means the env var outside of the container did not get injected in.
I did this: command: ["sh", "-c", "echo DB_NAME=test_${CIRCLE_NODE_INDEX}; yarn start"]
When I check the logs in circle CI it looked like: DB_NAME=test_
It seems like the variable was undefined.
Hmm, it’s hard to know what the problem is - either injection is supported at the host level and there is a problem passing it, or - as you say - a literal string is being injected (because interpolation is not supported in this part of the config file) and then it fails to look up inside the container.
The reference guide indicates that a string is acceptable for this key - maybe try that?