Is there a way to dynamically pass the credentialsId in Jenkins pipeline within the withCredentials block using an environment variable?
Currently this works:
withCredentials([[$class: 'AmazonWebServicesCredentialsBinding', credentialsId: 'my-aws-credentials',
ACCESS_KEY: 'ACCESS_KEY', SECRET_KEY: 'SECRET_KEY']]) { }
But this does not:
withCredentials([[$class: 'AmazonWebServicesCredentialsBinding', credentialsId: '${AWS_CREDENTIAL_ID}',
ACCESS_KEY: 'ACCESS_KEY', SECRET_KEY: 'SECRET_KEY']]) { }
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.