Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-73843

Jenkins won't start after update of jenkins gradle plugin from 2.12.1 to 2.13 with JCasC active

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • gradle-plugin
    • 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

       

          [JENKINS-73843] Jenkins won't start after update of jenkins gradle plugin from 2.12.1 to 2.13 with JCasC active

          Jeff created issue -

          Alexis added a comment -

          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.

          Alexis added a comment - 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.

          mohankumar added a comment -

          I noticed this issue too. gradle 2.13 does not seem to be backward compatible with injectionConfig used in previous versions. Thanks for creating this issue. 

          For those who are using JCasC, one way to recover jenkins post this upgrade is to disable injectionConfig entirely in JcasC and then restart jenkins.

          mohankumar added a comment - I noticed this issue too. gradle 2.13 does not seem to be backward compatible with injectionConfig used in previous versions. Thanks for creating this issue.  For those who are using JCasC, one way to recover jenkins post this upgrade is to disable injectionConfig entirely in JcasC and then restart jenkins.

          Alexis added a comment -

          I've only reproduced it by hard-coding the `injectionConfig` in the JCasC YAML. Out of curiosity, do JCasC users have an automated process that saves the current Jenkins config as YAML and always bootstraps from this?

          In any case, we'll fix this in the next Gradle plugin patch release.

          Alexis added a comment - I've only reproduced it by hard-coding the `injectionConfig` in the JCasC YAML. Out of curiosity, do JCasC users have an automated process that saves the current Jenkins config as YAML and always bootstraps from this? In any case, we'll fix this in the next Gradle plugin patch release.
          Konstantin Grammatikati made changes -
          Attachment New: image-2024-10-08-11-39-01-758.png [ 63383 ]

          We have a problem with updated Gradle Plugin (maybe same origin):

           

          Should we just dismiss old data or this is a bug? For now, we reverted 12.1 back.

          Konstantin Grammatikati added a comment - We have a problem with updated Gradle Plugin (maybe same origin):   Should we just dismiss old data or this is a bug? For now, we reverted 12.1 back.

          Alexis added a comment -

          We've just released 2.13.1, which should fix this issue.

          Alexis added a comment - We've just released 2.13.1, which should fix this issue.

          Jeff added a comment - - edited

          Upgraded to gradle plugin 2.13.1 without issue.  THANK YOU!  Not familiar with Jenkins JIRAs; should I close it or would you prefer to mark it resolved, etc?

          Jeff added a comment - - edited Upgraded to gradle plugin 2.13.1 without issue.  THANK YOU!  Not familiar with Jenkins JIRAs; should I close it or would you prefer to mark it resolved, etc?

          Jeff added a comment -

          >> Do JCasC users have an automated process that saves the current Jenkins config as YAML and always bootstraps from this?

          JCasC, if a configuration path/dirpath/URL has been specified, will configure the Jenkins installation at the time of a Jenkins restart.   You can export the current configuration as YAML using the JCasC plugin, but they recommend you not rely on that export.

          Jeff added a comment - >> Do JCasC users have an automated process that saves the current Jenkins config as YAML and always bootstraps from this? JCasC, if a configuration path/dirpath/URL has been specified, will configure the Jenkins installation at the time of a Jenkins restart.   You can export the current configuration as YAML using the JCasC plugin, but they recommend you not rely on that export.
          Alexis made changes -
          Released As New: https://github.com/jenkinsci/gradle-plugin/releases/tag/gradle-2.13.1
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]

            atual Alexis
            jfisher1001 Jeff
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: