Hi folks,
Jenkins: 2.113
Groovy: 2.4.11
Amazon Web Services SDK plugin: 1.11.264
Java version: 1.8.0 161
OS: Ubuntu Xenial LTS
I'm encountering a curious runtime exception when running a pipeline script that previously worked when setting up EC2 and Route53 clients. The Amazon Web Services SDK has migrated over to the ClientBuilder fluent interfaces, but there appears to be an issue when invoking in the Groovy pipeline.
I've tried the following in a pipeline script and the Groovy script console:
import com.amazonaws.auth.AWSCredentials
import com.amazonaws.auth.AWSCredentialsProvider
import com.amazonaws.services.ec2.AmazonEC2ClientBuilder
import com.amazonaws.auth.profile.ProfileCredentialsProvider
import com.amazonaws.regions.Regions
def creds = new ProfileCredentialsProvider("default")
def ec2 = AmazonEC2ClientBuilder.standard().withCredentials(creds).build()
this yields the following runtime missingMethodException:
groovy.lang.MissingMethodException: No signature of method: com.amazonaws.services.ec2.AmazonEC2ClientBuilder.withCredentials() is applicable for argument types: (com.amazonaws.auth.profile.ProfileCredentialsProvider) values: [com.amazonaws.auth.profile.ProfileCredentialsProvider@2f758ab3]
Possible solutions: withCredentials(com.amazonaws.auth.AWSCredentialsProvider), getCredentials(), setCredentials(com.amazonaws.auth.AWSCredentialsProvider)
Groovy complains that withCredentials only takes AWSCredentialsProvider as an parameter even though ProfileCredentialsProvider implements the interface:
Many thanks in advance!
Cheers,
Rowland