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

Groovy post-build script in matrix job throws exception

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • postbuildscript-plugin
    • None
    • Jenkins: 2.89.4
      Matrix 1.12
      PostBuildScript: 2.5.1

      I added an 'Execute Scripts on Matrix' post build step.

      This exception also occurs with 'Execute Scripts' post build step.

      I added a groovy script file with a simple println statement and ran the job.
      [PostBuildScript] - Problem occurred: java.lang.IllegalStateException: maybe need to rebuild plugin?
      at org.jenkinsci.plugins.scriptsecurity.scripts.ScriptApproval.get(ScriptApproval.java:99)
      at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SecureGroovyScript.configuring(SecureGroovyScript.java:126)
      at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SecureGroovyScript.configuringWithNonKeyItem(SecureGroovyScript.java:150)
      at org.jenkinsci.plugins.postbuildscript.service.GroovyScriptExecutor.call(GroovyScriptExecutor.java:54)
      at org.jenkinsci.plugins.postbuildscript.service.GroovyScriptExecutor.call(GroovyScriptExecutor.java:17)
      at hudson.remoting.UserRequest.perform(UserRequest.java:207)
      at hudson.remoting.UserRequest.perform(UserRequest.java:53)
      at hudson.remoting.Request$2.run(Request.java:358)
      at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at java.lang.Thread.run(Thread.java:745)
      Suppressed: hudson.remoting.Channel$CallSiteStackTrace: Remote call to bldsvr03
      at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1693)
      at hudson.remoting.UserResponse.retrieve(UserRequest.java:310)
      at hudson.remoting.Channel.call(Channel.java:908)
      at hudson.FilePath.act(FilePath.java:1081)
      at org.jenkinsci.plugins.postbuildscript.service.GroovyScriptPreparer.evaluateScript(GroovyScriptPreparer.java:54)
      at org.jenkinsci.plugins.postbuildscript.service.GroovyScriptPreparer.evaluateScript(GroovyScriptPreparer.java:40)
      at org.jenkinsci.plugins.postbuildscript.processor.Processor.processGroovyScripts(Processor.java:160)
      at org.jenkinsci.plugins.postbuildscript.processor.Processor.processScripts(Processor.java:97)
      at org.jenkinsci.plugins.postbuildscript.processor.Processor.process(Processor.java:83)
      at org.jenkinsci.plugins.postbuildscript.ConfigurableMatrixAggregator.endBuild(ConfigurableMatrixAggregator.java:35)
      at hudson.matrix.MatrixBuild$MatrixBuildExecution.post2(MatrixBuild.java:424)
      at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:635)
      at hudson.model.Run.execute(Run.java:1749)
      at hudson.matrix.MatrixBuild.run(MatrixBuild.java:314)
      at hudson.model.ResourceController.execute(ResourceController.java:97)
      at hudson.model.Executor.run(Executor.java:429)

          [JENKINS-49952] Groovy post-build script in matrix job throws exception

          Daniel Heid added a comment -

          Hi John! Sorry, but I cannot reproduce the problem. Are you running the script on the Jenkins master or an agent? Could you please provide the config.xml of the Jenkins job?

          Daniel Heid added a comment - Hi John! Sorry, but I cannot reproduce the problem. Are you running the script on the Jenkins master or an agent? Could you please provide the config.xml of the Jenkins job?

          John David added a comment -

          Daniel,

          Sorry for not being more specific.

          We run nothing on master so slaves was selected.

          This is a bit confusing on matrix jobs which has the concept of AXES and MATRIX.

          I ran this on a matrix job and selected MATRIX for the 'Matrix target' to run the groovy code on.

           

          John David added a comment - Daniel, Sorry for not being more specific. We run nothing on master so slaves was selected. This is a bit confusing on matrix jobs which has the concept of AXES and MATRIX. I ran this on a matrix job and selected MATRIX for the 'Matrix target' to run the groovy code on.  

          John David added a comment -

          I reverted the groovy change on that test job.

          I'll put it back in and send you the config.xml shortly.

          John David added a comment - I reverted the groovy change on that test job. I'll put it back in and send you the config.xml shortly.

          John David added a comment -

          BTW

          I ran the groovy script with nothing but

          println "Test groovy code here"

          John David added a comment - BTW I ran the groovy script with nothing but println "Test groovy code here"

          Daniel Heid added a comment -

          Hi John! Thanks! Did you already send me the config.xml? I cannot find it currently.

          Daniel Heid added a comment - Hi John! Thanks! Did you already send me the config.xml? I cannot find it currently.

          Code changed in jenkins
          User: Daniel Heid
          Path:
          README.md
          pom.xml
          src/main/java/org/jenkinsci/plugins/postbuildscript/service/GroovyScriptExecutor.java
          src/main/java/org/jenkinsci/plugins/postbuildscript/service/GroovyScriptPreparer.java
          src/main/java/org/jenkinsci/plugins/postbuildscript/service/LoadScriptContentCallable.java
          src/test/java/org/jenkinsci/plugins/postbuildscript/ConfigurableMatrixAggregatorTest.java
          src/test/java/org/jenkinsci/plugins/postbuildscript/LoggerTest.java
          src/test/java/org/jenkinsci/plugins/postbuildscript/model/ConfigurationTest.java
          src/test/java/org/jenkinsci/plugins/postbuildscript/model/PostBuildItemTest.java
          src/test/java/org/jenkinsci/plugins/postbuildscript/model/PostBuildStepTest.java
          src/test/java/org/jenkinsci/plugins/postbuildscript/model/ScriptFileTest.java
          src/test/java/org/jenkinsci/plugins/postbuildscript/model/ScriptTest.java
          src/test/java/org/jenkinsci/plugins/postbuildscript/service/CommandExecutorIT.java
          src/test/java/org/jenkinsci/plugins/postbuildscript/service/GroovyScriptExecutorFactoryTest.java
          src/test/java/org/jenkinsci/plugins/postbuildscript/service/GroovyScriptExecutorIT.java
          src/test/java/org/jenkinsci/plugins/postbuildscript/service/GroovyScriptPreparerTest.java
          http://jenkins-ci.org/commit/postbuildscript-plugin/2048ada5ad7555e31d5db2d93cfb4b58977fad43
          Log:
          JENKINS-49952 Groovy post-build script in matrix job throws exception

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Daniel Heid Path: README.md pom.xml src/main/java/org/jenkinsci/plugins/postbuildscript/service/GroovyScriptExecutor.java src/main/java/org/jenkinsci/plugins/postbuildscript/service/GroovyScriptPreparer.java src/main/java/org/jenkinsci/plugins/postbuildscript/service/LoadScriptContentCallable.java src/test/java/org/jenkinsci/plugins/postbuildscript/ConfigurableMatrixAggregatorTest.java src/test/java/org/jenkinsci/plugins/postbuildscript/LoggerTest.java src/test/java/org/jenkinsci/plugins/postbuildscript/model/ConfigurationTest.java src/test/java/org/jenkinsci/plugins/postbuildscript/model/PostBuildItemTest.java src/test/java/org/jenkinsci/plugins/postbuildscript/model/PostBuildStepTest.java src/test/java/org/jenkinsci/plugins/postbuildscript/model/ScriptFileTest.java src/test/java/org/jenkinsci/plugins/postbuildscript/model/ScriptTest.java src/test/java/org/jenkinsci/plugins/postbuildscript/service/CommandExecutorIT.java src/test/java/org/jenkinsci/plugins/postbuildscript/service/GroovyScriptExecutorFactoryTest.java src/test/java/org/jenkinsci/plugins/postbuildscript/service/GroovyScriptExecutorIT.java src/test/java/org/jenkinsci/plugins/postbuildscript/service/GroovyScriptPreparerTest.java http://jenkins-ci.org/commit/postbuildscript-plugin/2048ada5ad7555e31d5db2d93cfb4b58977fad43 Log: JENKINS-49952 Groovy post-build script in matrix job throws exception

          Daniel Heid added a comment -

          Hey John! With your description, I was able to reproduce the problem and found a solution. Will be included in soon available version 2.6.0

          Thanks for making PostBuildScript plugin better!

          Daniel Heid added a comment - Hey John! With your description, I was able to reproduce the problem and found a solution. Will be included in soon available version 2.6.0 Thanks for making PostBuildScript plugin better!

          John David added a comment -

          Awesome! I totally spaced on the config.xml file. Apologies.

          John David added a comment - Awesome! I totally spaced on the config.xml file. Apologies.

          John David added a comment -

          Daniel,

          One other thing that's a bit confusing when using matrix jobs is the master, slaves or both radio selection.

          When I first did the upgrade, I didn't realize the was a new 'Execute Scripts on Matrix' choice.

          After I ran it once, I came to realize it was referring to Jenkins master/slave nodes and not Matrix matrix/axes nodes.

          Would it be possible to add that distinction and also include the fact that there is now a new 'Execute Scripts on Matrix' in the 'Execution is limited to' help section?

          After an upgrade, most people will never look for or know about the new matrix scripts option.

          Thanks again for your perseverance (without the config file).

          John David added a comment - Daniel, One other thing that's a bit confusing when using matrix jobs is the master, slaves or both radio selection. When I first did the upgrade, I didn't realize the was a new 'Execute Scripts on Matrix' choice. After I ran it once, I came to realize it was referring to Jenkins master/slave nodes and not Matrix matrix/axes nodes. Would it be possible to add that distinction and also include the fact that there is now a new 'Execute Scripts on Matrix' in the 'Execution is limited to' help section? After an upgrade, most people will never look for or know about the new matrix scripts option. Thanks again for your perseverance (without the config file).

            dheid Daniel Heid
            anstaafl John David
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: