Jenkins Test Harness with plugins

225 views
Skip to first unread message

Jamie Tanna

unread,
Jun 29, 2022, 4:22:41 AM6/29/22
to Jenkins Developers
When running the Jenkins Test Harness in tests via this branch, I'm seeing the following error (bold for emphasis):

   0.007 [id=1997]    INFO    o.jvnet.hudson.test.JenkinsRule#createWebServer: Running on http://localhost:42047/jenkins/
   0.027 [id=2012]    INFO    jenkins.InitReactorRunner$1#onAttained: Started initialization
   0.028 [id=2026]    INFO    jenkins.InitReactorRunner$1#onAttained: Listed all plugins
   0.077 [id=2016]    INFO    jenkins.InitReactorRunner$1#onAttained: Prepared all plugins
   0.078 [id=2028]    INFO    jenkins.InitReactorRunner$1#onAttained: Started all plugins
   0.165 [id=2037]    INFO    jenkins.InitReactorRunner$1#onAttained: Augmented all extensions
   0.171 [id=2021]    INFO    jenkins.InitReactorRunner$1#onAttained: Loaded all jobs
   0.175 [id=2027]    INFO    jenkins.InitReactorRunner$1#onAttained: Completed initialization
   0.199 [seed #1] Legacy code started this job.  No cause information is available
   0.199 [seed #1] Running as SYSTEM
   0.199 [seed #1] Building in workspace /tmp/jkh9605859418765359967/workspace/seed
   0.199 [seed #1] Processing provided DSL script
   0.219 [seed #1] ERROR: (script, line 1) version 5.14 or later of plugin 'cloudbees-folder' needs to be installed
   0.220 [seed #1] Finished: FAILURE
   0.221 [id=1997]    INFO    jenkins.model.Jenkins#cleanUp: Stopping Jenkins
   0.230 [id=1997]    INFO    jenkins.model.Jenkins#cleanUp: Jenkins stopped

How would I go about bootstrapping the plugin dependency for cloudbees-folder? It's down as an implementation dependency in the project, so I'd have assumed it'd work, but clearly not.

Looks like potentially there's the `pluginManager.install` that I can use, is that the best bet?

Jamie Tanna

unread,
Jun 29, 2022, 4:38:09 AM6/29/22
to Jenkins Developers

> Depending on Other Plugins

> Any Jenkins plugins that you add as dependencies to your POM with <scope>test</scope> will be available in the Jenkins installations created while running test cases, or when using mvn hpi:run.

> You can also apply the @WithPlugin annotation to individual test cases, but this is rarely required.

However, when adding `testImplementation` and `testRuntimeOnly`, that still doesn't work - could it be because I'm running on Gradle?

jn...@cloudbees.com

unread,
Jun 30, 2022, 7:10:16 AM6/30/22
to Jenkins Developers
Hi,


>  - could it be because I'm running on Gradle?

:-)  well you are in the minoroty and the least tested path.

However I do not see any dependency for cloudbees-folder in https://github.com/jenkinsci/job-dsl-plugin/blob/defect/org-folder-secrets/build.gradle#L21-L27  (but I admit I am not a regular gradle user so may be missing something)?

Where have you declared this dependency?

/James

jn...@cloudbees.com

unread,
Jun 30, 2022, 7:21:44 AM6/30/22
to Jenkins Developers

Pierre BEITZ

unread,
Jun 30, 2022, 8:05:48 AM6/30/22
to jenkin...@googlegroups.com
Looking at the doc of the gradle JPI plugin, it looks like dependencies should be declared differently than a "normal jar",  with jenkinsPlugins, optionalJenkinsPlugins and jenkinsTest (see https://wiki.jenkins-ci.org/display/JENKINS/Gradle+JPI+Plugin section dependencies on other plugins).

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/2943a339-8f00-4ffe-a6e3-95e05861ca48n%40googlegroups.com.

Jamie Tanna

unread,
Jul 1, 2022, 10:04:25 AM7/1/22
to Jenkins Developers
Thanks folks for validating my thoughts and getting me to read through the Gradle JPI plugin!

Reading through the README, it turns out that `implementation`/ `testImplementation` are still honoured, so looks like `jenkinsTest` can be used, but doesn't need to be.

The error seems to be resolved by me reading the error messages Jenkins was spitting out, which was failing due to the version of another dependency not being usable, as it needed an upgrade. Woops 😅

Thanks for the assist!
Reply all
Reply to author
Forward
0 new messages