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

JDK Parameter Plugin 1.1 no longer recognizes selectedJDK attribute

    • 1.2

      After upgrading to 1.1, this piece of pipeline code:

      build job: "some_job", propagate: false, parameters: [
                          string(name: 'milestone', value: buildingMilestone),
                          string(name: 'mavenExtras', value: toBuild.mavenExtras),
                          string(name: 'branch', value: thisBranch), 
                          [$class: 'NodeParameterValue', name: 'buildLabel', labels: [toBuild.label], nodeEligibility: [$class: 'AllNodeEligibility']],
                          [$class: 'JavaParameterValue', name: 'jdkVersion', selectedJDK: jdkVersion],
                          booleanParam(name: 'cleanWorkspace', value: toBuild.cleanWorkspace)
                      ]

      Issues this warning, and then "some job" doesn't get the right version of the JDK.

      WARNING: Unknown parameter(s) found for class type 'com.datalex.jdkparameter.JavaParameterValue': selectedJDKScheduling project: EventProcessing » parent.java11.linuxThe parameter 'jdkVersion' did not have the type expected by EventProcessing » parent.java11.linux. Converting to JDK Parameter.

      It looks like the selectedJDK parameter disappeared from 1.1 on purpose. It's a breaking change - how do we get the code above to get the right JDK version passed into the job we are trying to build?

      Here's one place where it used to be:

      https://github.com/jenkinsci/JDK_Parameter_Plugin-plugin/blob/JDK_Parameter_Plugin-1.0/src/main/resources/com/datalex/jdkparameter/JavaParameterValue/value.jelly

          [JENKINS-70309] JDK Parameter Plugin 1.1 no longer recognizes selectedJDK attribute

          Mark Waite added a comment - - edited

          The commit that removed the capability was merged to the plugin repository in 2015 with no intervening release that included that commit until the December 2022 release of JDK parameter plugin 1.1.

          No users of the released plugin could have relied on the feature added in 2015 (2a71621a9f9f52b5f4dfc9e018fd1de3b996f7b) because it was not available in a release until December 2022.

          I've created a pull request that proposes to create a 1.2 release that removes two enhancements so that the plugin only has the 1.0 release functionality. Could you install the pre-release build and report your results?

          Mark Waite added a comment - - edited The commit that removed the capability was merged to the plugin repository in 2015 with no intervening release that included that commit until the December 2022 release of JDK parameter plugin 1.1. No users of the released plugin could have relied on the feature added in 2015 (2a71621a9f9f52b5f4dfc9e018fd1de3b996f7b) because it was not available in a release until December 2022. I've created a pull request that proposes to create a 1.2 release that removes two enhancements so that the plugin only has the 1.0 release functionality. Could you install the pre-release build and report your results?

          Mark Waite added a comment -

          rpk_pro I forgot to specifically mention you in the previous comment. Could you test the prelease build and report your results?

          Mark Waite added a comment - rpk_pro I forgot to specifically mention you in the previous comment. Could you test the prelease build and report your results?

          Robert added a comment -

          I have a lot going on this week (releases), so I will give it try next week. I have to say the fix will most likely do the trick, looking at the PR.

          Robert added a comment - I have a lot going on this week (releases), so I will give it try next week. I have to say the fix will most likely do the trick, looking at the PR.

          Robert added a comment - Also this link is giving me a "misdirected request" https://assets.ci.jenkins.io/static-files/NUHYBDj5fyfSlFgwC9t3RdHc8RH36Q9XH1wEY29jAGkxNjcxNzIxMTQzMjM4Ojk6YW5vbnltb3VzOmpvYi9QbHVnaW5zL2pvYi9KREtfUGFyYW1ldGVyX1BsdWdpbi1wbHVnaW4vam9iL1BSLTUvMS9hcnRpZmFjdA==/target/JDK_Parameter_Plugin.hpi

          Mark Waite added a comment - - edited

          Thanks. I've added a link to the CI job with the most recent successful build of the pull request. The hpi file from that page is the one to test.

          https://ci.jenkins.io/job/Plugins/job/JDK_Parameter_Plugin-plugin/job/PR-5/lastSuccessfulBuild/

          Mark Waite added a comment - - edited Thanks. I've added a link to the CI job with the most recent successful build of the pull request. The hpi file from that page is the one to test. https://ci.jenkins.io/job/Plugins/job/JDK_Parameter_Plugin-plugin/job/PR-5/lastSuccessfulBuild/

          Mark Waite added a comment -

          Released as 1.2 so that other users won't be surprised. Does not fix the open security issue.

          Mark Waite added a comment - Released as 1.2 so that other users won't be surprised. Does not fix the open security issue.

          Robert added a comment -

          Thanks, we just updated Monday night, and it seems to be working.

          Robert added a comment - Thanks, we just updated Monday night, and it seems to be working.

          Leo Leung added a comment -

          This release breaks builds triggered remotely via URL with a Authentication Token.
          https://www.theserverside.com/blog/Coffee-Talk-Java-News-Stories-and-Opinions/Trigger-Jenkins-Builds-Remotely-Example-403-Error-Fix

          After triggering the build I get this error when using JDK Parameter Plugin v1.2.

          // FATAL: null
          java.lang.NullPointerException
          	at java.base/java.util.TreeMap.getEntry(TreeMap.java:345)
          	at java.base/java.util.TreeMap.containsKey(TreeMap.java:231)
          	at java.base/java.util.TreeSet.contains(TreeSet.java:234)
          	at hudson.model.ParametersAction.isSafeParameter(ParametersAction.java:364)
          	at hudson.model.ParametersAction.filter(ParametersAction.java:335)
          	at hudson.model.ParametersAction.getParameters(ParametersAction.java:182)
          	at hudson.model.ParametersAction.iterator(ParametersAction.java:177)
          	at hudson.model.AbstractBuild.getBuildVariables(AbstractBuild.java:1071)
          	at hudson.scm.SubversionSCM.getLocations(SubversionSCM.java:544)
          	at hudson.scm.SubversionSCM.buildEnvironment(SubversionSCM.java:730)
          	at hudson.scm.SCM.buildEnvVars(SCM.java:589)
          	at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:967)
          	at hudson.maven.AbstractMavenBuild.getEnvironment(AbstractMavenBuild.java:57)
          	at hudson.maven.MavenModuleSetBuild.getEnvironment(MavenModuleSetBuild.java:168)
          	at hudson.scm.SubversionSCM.checkout(SubversionSCM.java:887)
          	at hudson.scm.SCM.checkout(SCM.java:540)
          	at hudson.model.AbstractProject.checkout(AbstractProject.java:1240)
          	at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:649)
          	at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:85)
          	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:521)
          	at hudson.model.Run.execute(Run.java:1900)
          	at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543)
          	at hudson.model.ResourceController.execute(ResourceController.java:101)
          	at hudson.model.Executor.run(Executor.java:442) 

          I had to downgrade to v1.0 to get it working again.

          Leo Leung added a comment - This release breaks builds triggered remotely via URL with a Authentication Token. https://www.theserverside.com/blog/Coffee-Talk-Java-News-Stories-and-Opinions/Trigger-Jenkins-Builds-Remotely-Example-403-Error-Fix After triggering the build I get this error when using JDK Parameter Plugin v1.2. // FATAL: null java.lang.NullPointerException at java.base/java.util.TreeMap.getEntry(TreeMap.java:345) at java.base/java.util.TreeMap.containsKey(TreeMap.java:231) at java.base/java.util.TreeSet.contains(TreeSet.java:234) at hudson.model.ParametersAction.isSafeParameter(ParametersAction.java:364) at hudson.model.ParametersAction.filter(ParametersAction.java:335) at hudson.model.ParametersAction.getParameters(ParametersAction.java:182) at hudson.model.ParametersAction.iterator(ParametersAction.java:177) at hudson.model.AbstractBuild.getBuildVariables(AbstractBuild.java:1071) at hudson.scm.SubversionSCM.getLocations(SubversionSCM.java:544) at hudson.scm.SubversionSCM.buildEnvironment(SubversionSCM.java:730) at hudson.scm.SCM.buildEnvVars(SCM.java:589) at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:967) at hudson.maven.AbstractMavenBuild.getEnvironment(AbstractMavenBuild.java:57) at hudson.maven.MavenModuleSetBuild.getEnvironment(MavenModuleSetBuild.java:168) at hudson.scm.SubversionSCM.checkout(SubversionSCM.java:887) at hudson.scm.SCM.checkout(SCM.java:540) at hudson.model.AbstractProject.checkout(AbstractProject.java:1240) at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:649) at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:85) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:521) at hudson.model.Run.execute(Run.java:1900) at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543) at hudson.model.ResourceController.execute(ResourceController.java:101) at hudson.model.Executor.run(Executor.java:442) I had to downgrade to v1.0 to get it working again.

          Mark Waite added a comment -

          leo_ could you open a new issue to report that null pointer exception?

          Mark Waite added a comment - leo_ could you open a new issue to report that null pointer exception?

          Leo Leung added a comment -

          Leo Leung added a comment - markewaite Created https://issues.jenkins.io/browse/JENKINS-70551 Thanks.

            markewaite Mark Waite
            rpk_pro Robert
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: