question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

integration tests fail with latest ec2 plugin

See original GitHub issue

Description

  • 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:closed
  • Created 4 years ago
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

0reactions
timjacommented, May 19, 2019

That’s a bug then, most likely on the ec2 plugin side. Export should work properly

Read more comments on GitHub >

github_iconTop Results From Across the Web

Maven Failsafe Plugin – Introduction
The Failsafe Plugin is designed to run integration tests while the Surefire Plugin is designed to run unit tests. The name (failsafe) was ......
Read more >
surefire vs failsafe : proguard issue - Stack Overflow
The maven-failsafe-plugin runs integration tests and binds to the integration-test and verify phases by default. The reason that there are those two different ......
Read more >
Avoid Frequently Failing Tests With Continuous Integration
In short, continuous integration is a practice that allows the tracking of small changes. Any changes to the code are noted, packaged, and ......
Read more >
Troubleshoot EC2/On-Premises deployment issues
Deploying new files or redeploying the same files to the same locations on instances can fail for these reasons: You specified a different...
Read more >
Writing Automated Integration Tests for Failure Scenarios
Creating an integration test solution in a failure scenario. ... Last winter, I wrote and released a service for a client I am...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found