I have the following DSL structure:
freeStyleJob { wrappers { credentialsBinding { [ $class:"AmazonWebServicesCredentialsBinding", accessKeyVariable: "AWS_ACCESS_KEY_ID", credentialsId: "your-credential-id", secretKeyVariable: "AWS_SECRET_ACCESS_KEY" ] } } steps {
However, this does not work. What is the correct syntax? For Jenkins pipelines, you can:
withCredentials([[ $class: "AmazonWebServicesCredentialsBinding", accessKeyVariable: "AWS_ACCESS_KEY_ID", credentialsId: "your-credential-id", secretKeyVariable: "AWS_SECRET_ACCESS_KEY"]]) {
but this syntax does not work in a normal DSL groovy job.
tl; dr How can I export AWS credentials defined by the AmazonWebServicesCredentialsBinding plugin to environment variables in a Groovy DSL job? (NOT A TYPICAL PLUG SYNTACISIS!)
source share