variables:
CUSTOM_NODE_VERSION: '$${cat .nvmrc}'
I'd like for the variable CUSTOM_NODE_VERSION to be populated via the contents of the .nvmrc file (which is located in the projects root directory). How does one do this in the gitlab-ci.yml file?
The example above isn't working. I've also tried the following:
CUSTOM_NODE_VERSION: $(cat .nvmrc)->(cat .nvmrc)CUSTOM_NODE_VERSION: "$(cat .nvmrc)"->(cat .nvmrc)CUSTOM_NODE_VERSION: '$(cat .nvmrc)'->(cat .nvmrc)CUSTOM_NODE_VERSION: ${cat .nvmrc}-> (empty string)CUSTOM_NODE_VERSION: '${cat .nvmrc}'-> (empty string)CUSTOM_NODE_VERSION: "${cat .nvmrc}"-> (empty string)
It works if I put it in the before_script like the following:
before_script:
- CUSTOM_NODE_VERSION=$(cat .nvmrc)
But it isn't accessible to the following part of the gitlab-ci.yml file:
lint:
stage: Test
image: node:$CUSTOM_NODE_VERSION
$(..). Note that${..}is for expanding variables, in your case though you needed to run commands. Can you doCUSTOM_NODE_VERSION: $(cat .nvmrc)(cat .nvmrc)