jenkinsci / gradle-jpi-plugin

Build Jenkins Plugins with Gradle
79 stars 50 forks source link

Upgrading to 0.43.0 breaks the gradle-plugin build #190

Closed wolfs closed 2 years ago

wolfs commented 3 years ago

Version report

See the build scan: https://ge.gradle.org/s/7yrrxp2mfwsdg/tests/:test/hudson.plugins.gradle.GradlePluginIntegrationTest/Config%20roundtrip?top-execution=1

I am using this PR of the Gradle plugin: https://github.com/jenkinsci/gradle-plugin/pull/114

Reproduction steps

Run ./gradlew test --tests "hudson.plugins.gradle.GradlePluginIntegrationTest.Config roundtrip"

Results

Expected result:

The test passes.

Actual result:

The test fails with:

Caused: com.google.inject.ProvisionException: Unable to provision, see the following errors: |  
-- | --
  |   |  
  | 1) Error injecting constructor, java.security.KeyStoreException: JENKINS-41987: no X509Certificate found; perhaps instance-identity module is missing or too old |  
  | at jenkins.slaves.JnlpSlaveAgentProtocol4.<init>(JnlpSlaveAgentProtocol4.java:103)

I tried adding a org.jenkins-ci.modules:instance-identity:2.1 version to testImplementation, though the test keeps failing: https://ge.gradle.org/s/qir5zxifplv5i/tests/:test/hudson.plugins.gradle.GradlePluginIntegrationTest/Config%20roundtrip?top-execution=1

Caused by: com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException: 404 Not Found for http://localhost:62586/jenkins/static/7491ace6/assets/jquery-detached/jsmodules/jquery2.js

I tried the gradle jpi plugin versions and all of them work up to 0.42.0. Any idea what could be causing this?

sghill commented 2 years ago

@wolfs I was able to get this working by adding jenkins-war back to testRuntimeOnly:

testRuntimeOnly 'org.jenkins-ci.main:jenkins-war:2.138.4'

I tried adding a org.jenkins-ci.modules:instance-identity:2.1 version to testImplementation, though the test keeps failing

This issue is annoying (#186), but it isn't the reason the test fails.

I tried the gradle jpi plugin versions and all of them work up to 0.42.0

97e53d54adc2d8d92c25dcd233b958b41f0854db removed jenkins-war from the testRuntimeOnly configuration in an effort to clean up the classpath. It looks like this was caused by the removal, though I'm not exactly sure why at the moment. I tried adding all of jenkins-war's transitives to testRuntimeOnly, but it still failed. The logs also confirm it's still being loaded from the predefined path even while it's on the testRuntimeClasspath:

o.jvnet.hudson.test.WarExploder#findJenkinsWar: Using a predefined WAR file

I'm considering adding jenkins-war back to the configuration in a future releasing by default, and allowing disabling this auto-add with a property. I was going down this road because in my own plugins I've shifted to making test unit tests only with JUnit 5 and a custom integrationTest task for tests that require the JUnit4 Jenkins Rule. The plugin automatically adding all of these transitive dependencies makes IDE autocomplete much more daunting.

wolfs commented 2 years ago

Awesome, that worked. Thank you!