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:
https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/auth/AWSCredentialsProvider.html
https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/auth/profile/ProfileCredentialsProvider.html
Now, I've tried the above code in the groovysh AWS Java SDK 1.11.264 in
isolation on Groovy 2.4.11 on Java 1.8.0 161 with no issues. I'm wondering
if there are any tips on how I might resolve this? In the meantime, I'll
try replacing the plugin jar with earlier version of the SDK, or use
https://jenkins.io/doc/book/pipeline/shared-libraries/#using-third-party-libraries.
Many thanks in advance!
Cheers,
Rowland
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/210c3435-291c-4b0e-ab1d-7acd0438833a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.