-
Bug
-
Resolution: Fixed
-
Minor
-
Jenkins 2.440.1 on Rocky Linux release 9.1 (Blue Onyx)
I have a jenkins installation that had gradle plugin version 2.12.1 installed and the system is also using the JCasC (Jenkins configuration-as-code) plugin. I did the usual plugins upgrade and told Jenkins to restart after installing the updates.
Jenkins refused to start thereafter. I got the error:
Oct 01 15:13:05 jenkins2.mydomain.com jenkins[120719]: 2024-10-01 20:13:05.682+0000 [id=30] SEVERE jenkins.InitReactorRunner$1#onTaskFailed: Failed ConfigurationAsCode.init
Oct 01 15:13:05 jenkins2.mydomain.com jenkins[120719]: io.jenkins.plugins.casc.UnknownAttributesException: injectionConfig: Invalid configuration elements for type: class hudson.plugins.gradle.injection.InjectionConfig : injectCcudExtension,injectMavenExtension.
Oct 01 15:13:05 jenkins2.mydomain.com jenkins[120719]: Available attributes : accessKeyCredentialId, allowUntrusted, ccudExtensionCustomCoordinates, ccudExtensionVersion, ccudPluginVersion, checkForBuildAgentErrors, enabled, enforceUrl, gradleCaptureTaskInputFiles, gradleInjectionDisabledNodes, gradleInjectionEnabledNodes, gradlePluginRepositoryCredentialId, gradlePluginRepositoryUrl, gradlePluginVersion, mavenCaptureGoalInputFiles, mavenExtensionCustomCoordinates, mavenExtensionRepositoryCredentialId, mavenExtensionRepositoryUrl, mavenExtensionVersion, mavenInjectionDisabledNodes, mavenInjectionEnabledNodes, server, shortLivedTokenExpiry, vcsRepositoryFilter
Oct 01 15:13:05 jenkins2.mydomain.com jenkins[120719]: at io.jenkins.plugins.casc.BaseConfigurator.handleUnknown(BaseConfigurator.java:389)
My jenkins had this content in the file:
/var/lib/jenkins/hudson.plugins.gradle.injection.InjectionConfig.xml
<?xml version='1.1' encoding='UTF-8'?> <hudson.plugins.gradle.injection.InjectionConfig plugin="gradle@2.12.1"> <enabled>false</enabled> <allowUntrusted>false</allowUntrusted> <gradleCaptureTaskInputFiles>true</gradleCaptureTaskInputFiles> <injectMavenExtension>false</injectMavenExtension> <injectCcudExtension>false</injectCcudExtension> <mavenCaptureGoalInputFiles>true</mavenCaptureGoalInputFiles> <enforceUrl>false</enforceUrl> <checkForBuildAgentErrors>false</checkForBuildAgentErrors> <parsedVcsRepositoryFilter> <vcsRepositoryFilter></vcsRepositoryFilter> <inclusion class="empty-list"/> <exclusion class="empty-list"/> </parsedVcsRepositoryFilter> </hudson.plugins.gradle.injection.InjectionConfig>
and, sure enough, there are references to attributes injectCcudExtension and injectMavenExtension and the file indicates plugin="gradle@2.12.1".
I looked through the 2.12.1 source files and found .html files referencing these attributes, but those .html files were not present in 2.13. So I assume dropping these attributes is intentional.
I reverted to the 2.12.1 jenkins plugin and jenkins would then start again.
I'm not sure if this is a bug with the plugin upgrade process, plugin backward compatibility, or user error. Is there something I need to do when I upgrade Jenkins plugins to make sure any pre-existing .xml file for the plugin likewise gets updated?
I don't use gradle myself and fairly new to JCasC. Thanks
Indeed, those configuration parameters have been removed from this Gradle plugin version. I'm not familiar with JCasC but I'll try to reproduce the same behavior and see what we can do.