Trouble using JenkinsRule with PluginManager

76 views
Skip to first unread message

Matthias Denu

unread,
Jun 30, 2021, 10:33:56 AM6/30/21
to Jenkins Users
Hi, I'm trying to use a different set of plugins for different Spock Specifications. I've posted a more detail question here: https://stackoverflow.com/questions/68196423/trouble-using-a-base-spock-specification-and-jenkinsrule-with-pluginmanager I'm hoping that someone might be able to provide some insight. Thank you. 

Ivan Fernandez Calvo

unread,
Jun 30, 2021, 12:15:42 PM6/30/21
to Jenkins Users
We do not use Spock, but we have a process to test jobDSL definitions before applying changes see https://github.com/elastic/apm-pipeline-library/tree/master/.ci/jobDSL it test that the syntax is correct and test that you can create the job.

Matthias Denu

unread,
Aug 5, 2021, 10:48:48 AM8/5/21
to Jenkins Users
Thanks for the reply. It looks like your repo is similar to https://github.com/sheehan/job-dsl-gradle-example/, which is the example that our repo is based on as well. We've got Specifications that test the job DSL syntax and other job configuration stuff. And I see how the resolveTestPlugins task in build.gradle saves plugins to the build/resources/test/test-dependencies folder that the Jenkins test harness will look in to get the plugins with which to load the in-memory Jenkins instances. 

What I want to do is load those in-memory Jenkins instances spun up by the Jenkins test harness with different plugins, depending on the Specification being run. So for most Specifications, I'll use one set of plugins, but for another set of Specifications, I'd like to use another...

I thought that `new JenkinsRule().with(MyPluginManager.INSTANCE)` or something like that would solve this issue for me, but I'm having trouble with it. I'm seeking help on how to get this to work. 

I've updated my StackOverflow question with a link to a GitHub repo that reproduces the problem I'm seeing: https://github.com/matthiasdenu/plugin-manager-bug/tree/main 

Help is appreciated!

Björn Pedersen

unread,
Aug 6, 2021, 3:32:14 AM8/6/21
to Jenkins Users
I guess this question is better suited for https://groups.google.com/g/jenkinsci-dev

Björn Pedersen

unread,
Aug 6, 2021, 3:38:13 AM8/6/21
to Jenkins Users
And take a look at https://javadoc.jenkins.io/component/jenkins-test-harness/org/jvnet/hudson/test/RestartableJenkinsRule.html , especially the info about 
 UnitTestSupportingPluginManager. 

Björn

Björn Pedersen

unread,
Aug 6, 2021, 3:39:57 AM8/6/21
to Jenkins Users
Reply all
Reply to author
Forward
0 new messages