title: Set gitlab-ci.yml variable via bash command
body: <pre><code>variables:
    CUSTOM_NODE_VERSION: '$${cat .nvmrc}'
  </code></pre>
  
  <p>I'd like for the variable <code>CUSTOM_NODE_VERSION</code> to be populated via the contents of the <code>.nvmrc</code> file (which is located in the projects root directory). How does one do this in the <code>gitlab-ci.yml</code> file?</p>
  
  <p>The example above isn't working. I've also tried the following:</p>
  
  <ul>
  <li><code>CUSTOM_NODE_VERSION: $(cat .nvmrc)</code> -> <code>(cat .nvmrc)</code></li>
  <li><code>CUSTOM_NODE_VERSION: "$(cat .nvmrc)"</code> -> <code>(cat .nvmrc)</code></li>
  <li><code>CUSTOM_NODE_VERSION: '$(cat .nvmrc)'</code> -> <code>(cat .nvmrc)</code></li>
  <li><code>CUSTOM_NODE_VERSION: ${cat .nvmrc}</code> -> (empty string)</li>
  <li><code>CUSTOM_NODE_VERSION: '${cat .nvmrc}'</code> -> (empty string)</li>
  <li><code>CUSTOM_NODE_VERSION: "${cat .nvmrc}"</code> -> (empty string)</li>
  </ul>
  
  <p>It works if I put it in the <code>before_script</code> like the following:</p>
  
  <pre><code>before_script:
    - CUSTOM_NODE_VERSION=$(cat .nvmrc)
  </code></pre>
  
  <p>But it isn't accessible to the following part of the <code>gitlab-ci.yml</code> file:</p>
  
  <pre><code>lint:
    stage: Test
    image: node:$CUSTOM_NODE_VERSION
  </code></pre>