title: How to dynamically pass credentialsId to Jenkins pipeline
body: <p>Is there a way to dynamically pass the credentialsId in Jenkins pipeline within the withCredentials block using an environment variable?</p>
  
  <p>Currently this works:</p>
  
  <pre><code>withCredentials([[$class: 'AmazonWebServicesCredentialsBinding', credentialsId: 'my-aws-credentials',
                          ACCESS_KEY: 'ACCESS_KEY', SECRET_KEY: 'SECRET_KEY']]) { }
  </code></pre>
  
  <p>But this does not:</p>
  
  <pre><code>withCredentials([[$class: 'AmazonWebServicesCredentialsBinding', credentialsId: '${AWS_CREDENTIAL_ID}',
                          ACCESS_KEY: 'ACCESS_KEY', SECRET_KEY: 'SECRET_KEY']]) { }
  </code></pre>
  
  <p>I should add that the builds runs within a docker container but other environment variables work fine, so I would expect this one to work too.</p>