title: How to use an environment variable in a environment variable in a Jenkinsfile?
body: <p>I would like to have a environment variable COMPOSE_PROJECT_NAME with the value denpal-4 for a Jenkins job with build_id 4.</p>
  
  <pre><code>environment {
    COMPOSE_PROJECT_NAME = 'denpal-$(BUILD_ID)'
  }
  </code></pre>
  
  <p>The alternative would be writing this in every sh-block</p>
  
  <pre><code>sh ''' 
  export COMPOSE_PROJECT_NAME = 'denpal-$(BUILD_ID)'
  code...
  '''
  </code></pre>
  
  <p>This would go against the DRY (Don't repeat yourself) principle however. Is something in environment {} possible?</p>
  
  <p>UPDATE/ANSWER: double quotes instead of single quotes fixed it.</p>