integration tests fail with latest ec2 plugin
See original GitHub issueDescription
- Jenkins version 2.164.3
- CasC Plugin version 1.15
- EC2 Plugin version 1.42
The CasC plugin fails to configure ec2 templates when using the latest version of the ec2 plugin. I’ve tried to use the configuration output exported by the CasC plugin for initial configuration as well as the as well as the the provided integration test: https://github.com/jenkinsci/configuration-as-code-plugin/blob/master/integrations/src/test/resources/io/jenkins/plugins/casc/EC2Cloud.yml
If I revert the EC2 plugin to 1.39 it works – although we require later versions of the plugin to take advantage of m5 instance types.
Error Message
INFO: Setting class hudson.plugins.ec2.SlaveTemplate.description = Auto configured EC2 Agent, yay again
May 16, 2019 11:24:01 PM io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator tryConstructor
INFO: Setting class hudson.plugins.ec2.SlaveTemplate.remoteAdmin = ec2-user
May 16, 2019 11:24:01 PM jenkins.InitReactorRunner$1 onTaskFailed
SEVERE: Failed ConfigurationAsCode.init
java.lang.Error: java.lang.reflect.InvocationTargetException
at hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:110)
at hudson.init.TaskMethodFinder$TaskImpl.run(TaskMethodFinder.java:175)
at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:296)
at jenkins.model.Jenkins$5.runTask(Jenkins.java:1096)
at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:214)
at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:104)
... 8 more
Caused by: io.jenkins.plugins.casc.ConfiguratorException: jenkins: error configuring 'jenkins' with class io.jenkins.plugins.casc.core.JenkinsConfigurator configurator
at io.jenkins.plugins.casc.ConfigurationAsCode.invokeWith(ConfigurationAsCode.java:633)
at io.jenkins.plugins.casc.ConfigurationAsCode.checkWith(ConfigurationAsCode.java:665)
at io.jenkins.plugins.casc.ConfigurationAsCode.configureWith(ConfigurationAsCode.java:649)
at io.jenkins.plugins.casc.ConfigurationAsCode.configureWith(ConfigurationAsCode.java:548)
at io.jenkins.plugins.casc.ConfigurationAsCode.configure(ConfigurationAsCode.java:277)
at io.jenkins.plugins.casc.ConfigurationAsCode.init(ConfigurationAsCode.java:269)
... 13 more
Caused by: io.jenkins.plugins.casc.ConfiguratorException: : Failed to construct instance of class hudson.plugins.ec2.SlaveTemplate.
Constructor: public hudson.plugins.ec2.SlaveTemplate(java.lang.String,java.lang.String,hudson.plugins.ec2.SpotConfiguration,java.lang.String,java.lang.String,com.amazonaws.services.ec2.model.InstanceType,boolean,java.lang.String,hudson.model.Node$Mode,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,hudson.plugins.ec2.AMITypeData,java.lang.String,boolean,java.lang.String,java.util.List,java.lang.String,java.lang.String,java.lang.String,boolean,boolean,boolean,java.lang.String,boolean,java.lang.String,boolean,boolean,boolean,hudson.plugins.ec2.ConnectionStrategy,int).
Arguments: [java.lang.String, java.lang.String, null, java.lang.String, java.lang.String, com.amazonaws.services.ec2.model.InstanceType, java.lang.Boolean, java.lang.String, null, java.lang.String, null, null, null, null, java.lang.String, null, null, java.lang.Boolean, null, null, null, null, null, java.lang.Boolean, java.lang.Boolean, java.lang.Boolean, null, java.lang.Boolean, null, java.lang.Boolean, java.lang.Boolean, java.lang.Boolean, null, java.lang.Integer]
at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.tryConstructor(DataBoundConfigurator.java:149)
at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.instance(DataBoundConfigurator.java:73)
at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:262)
at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.configure(DataBoundConfigurator.java:79)
at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.tryConstructor(DataBoundConfigurator.java:122)
at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.instance(DataBoundConfigurator.java:73)
at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:262)
at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.configure(DataBoundConfigurator.java:79)
at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$doConfigure$16668e2$1(HeteroDescribableConfigurator.java:228)
at io.vavr.CheckedFunction0.lambda$unchecked$52349c75$1(CheckedFunction0.java:201)
at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.doConfigure(HeteroDescribableConfigurator.java:228)
at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$null$2(HeteroDescribableConfigurator.java:82)
at io.vavr.control.Option.map(Option.java:373)
at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$configure$3(HeteroDescribableConfigurator.java:82)
at io.vavr.Tuple2.apply(Tuple2.java:239)
at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.configure(HeteroDescribableConfigurator.java:79)
at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.check(HeteroDescribableConfigurator.java:88)
at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.check(HeteroDescribableConfigurator.java:51)
at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:339)
at io.jenkins.plugins.casc.BaseConfigurator.check(BaseConfigurator.java:282)
at io.jenkins.plugins.casc.ConfigurationAsCode.lambda$checkWith$6(ConfigurationAsCode.java:665)
at io.jenkins.plugins.casc.ConfigurationAsCode.invokeWith(ConfigurationAsCode.java:627)
... 18 more
Caused by: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.tryConstructor(DataBoundConfigurator.java:141)
... 39 more
Caused by: java.lang.NullPointerException
at hudson.plugins.ec2.SlaveTemplate.<init>(SlaveTemplate.java:215)
... 44 more
Assumptions
I assume this has to do w/ the introduction of ProvisionerStrategy
in 1.40 or the exposure of deleteRootOnTermination
in 1.42 (?)
Fixes
Is it possible to fix integration tests so they work with the latest (1.42 currently) version of the ec2 plugin?
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (7 by maintainers)
Top GitHub Comments
@briceburg if you define all the parameters for EC2 SlaveTemplate you should be fine: https://github.com/jenkinsci/ec2-plugin/blob/95404ed85be767f0806cda8e13505869c38f9026/src/main/java/hudson/plugins/ec2/SlaveTemplate.java#L169-L176
That’s a bug then, most likely on the ec2 plugin side. Export should work properly