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

Using a "Groovy Command" build step with the pre-scm-buildstep plugin returns a 500 server error

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • plugin-proposals
    • None
    • CentOS 5.6, Java 1.5

      The following steps threw a server 500 error:

      • Checked "Run buildstep before SCM runs".
      • From the "Add build step" drop-down, I chose "Execute system Groovy script". (Provided by the Groovy Plugin)
      • Chose "Groovy Command".
      • Entered the following in the text box:
        • ["/home/jenkins/scripts/vm-start-if-not-running.sh", "[ha-datacenter/datastore1] build-system-pool/bs-slave-04/bs-slave-04.vmx"].execute().text
      • Scrolled to the bottom of the screen and clicked "Save".
        This returned the following response:
        Status Code: 500

      Exception:
      Stacktrace:

      java.lang.RuntimeException: Failed to instantiate class org.jenkinsci.plugins.preSCMbuildstep.PreSCMBuildStepsWrapper from {"buildstep":{"bindings":"","classpath":"","kind":"hudson.plugins.groovy.SystemGroovy$DescriptorImpl","scriptSource":{"command":"[\"/home/jenkins/scripts/vm-start-if-not-running.sh\", \"[ha-datacenter/datastore1] build-system-pool/bs-slave-04/bs-slave-04.vmx\"].execute().text","value":"0"},"stapler-class<span class="code-quote">":"hudson.plugins.groovy.SystemGroovy"}}
      	at hudson.model.Descriptor.newInstance(Descriptor.java:560)
      	at hudson.util.DescribableList.rebuild(DescribableList.java:155)
      	at hudson.model.Project.submit(Project.java:196)
      	at hudson.model.Job.doConfigSubmit(Job.java:965)
      	at hudson.model.AbstractProject.doConfigSubmit(AbstractProject.java:643)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      

      I can create a pre-scm-buildstep using "Execute shell" without issue.

      These steps work without issue when I try to create a regular build step in the "Build" section of the job's configuration.

          [JENKINS-10977] Using a "Groovy Command" build step with the pre-scm-buildstep plugin returns a 500 server error

          cjo9900 added a comment -

          I can reproduce this and it seems to be caused by the groovy plugin not having a data bound constructor, so this error will also occur on any other buildstep plugin that does not provide a databound constructor.

          Caused by: java.lang.IllegalArgumentException: Failed to convert the buildstep parameter of the constructor public org.jenkinsci.plugins.preSCMbuildstep.PreSCMBuildStepsWrapper(java.util.ArrayList)
          at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:622)
          ... 64 more
          Caused by: java.lang.IllegalArgumentException: Failed to instantiate interface hudson.tasks.BuildStep from {"bindings":"","classpath":"","kind":"hudson.plugins.groovy.SystemGroovy$DescriptorImpl","scriptSource":

          {"command":"[\"/home/jenkins/scripts/vm-start-if-not-running.sh\", \"[ha-datacenter/datastore1] build-system-pool/bs-slave-04/bs-slave-04.vmx\"].execute().text","value":"0"}

          ,"stapler-class":"hudson.plugins.groovy.SystemGroovy"}
          at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:628)
          at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:664)
          at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:372)
          at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:620)
          ... 64 more
          Caused by: java.lang.IllegalArgumentException: Failed to convert the scriptSource parameter of the constructor public hudson.plugins.groovy.SystemGroovy(hudson.plugins.groovy.ScriptSource,java.lang.String,java.lang.String)
          at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:622)
          ... 67 more
          Caused by: java.lang.IllegalArgumentException: Failed to instantiate interface hudson.plugins.groovy.ScriptSource from

          {"command":"[\"/home/jenkins/scripts/vm-start-if-not-running.sh\", \"[ha-datacenter/datastore1] build-system-pool/bs-slave-04/bs-slave-04.vmx\"].execute().text","value":"0"}

          at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:628)
          at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:372)
          at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:620)
          ... 67 more
          Caused by: org.kohsuke.stapler.NoStaplerConstructorException: There's no @DataBoundConstructor on any constructor of interface hudson.plugins.groovy.ScriptSource
          at org.kohsuke.stapler.RequestImpl.loadConstructorParamNames(RequestImpl.java:480)
          at org.kohsuke.stapler.RequestImpl.access$100(RequestImpl.java:75)
          at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:607)
          ... 69 more

          cjo9900 added a comment - I can reproduce this and it seems to be caused by the groovy plugin not having a data bound constructor, so this error will also occur on any other buildstep plugin that does not provide a databound constructor. Caused by: java.lang.IllegalArgumentException: Failed to convert the buildstep parameter of the constructor public org.jenkinsci.plugins.preSCMbuildstep.PreSCMBuildStepsWrapper(java.util.ArrayList) at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:622) ... 64 more Caused by: java.lang.IllegalArgumentException: Failed to instantiate interface hudson.tasks.BuildStep from {"bindings":"","classpath":"","kind":"hudson.plugins.groovy.SystemGroovy$DescriptorImpl","scriptSource": {"command":"[\"/home/jenkins/scripts/vm-start-if-not-running.sh\", \"[ha-datacenter/datastore1] build-system-pool/bs-slave-04/bs-slave-04.vmx\"].execute().text","value":"0"} ,"stapler-class":"hudson.plugins.groovy.SystemGroovy"} at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:628) at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:664) at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:372) at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:620) ... 64 more Caused by: java.lang.IllegalArgumentException: Failed to convert the scriptSource parameter of the constructor public hudson.plugins.groovy.SystemGroovy(hudson.plugins.groovy.ScriptSource,java.lang.String,java.lang.String) at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:622) ... 67 more Caused by: java.lang.IllegalArgumentException: Failed to instantiate interface hudson.plugins.groovy.ScriptSource from {"command":"[\"/home/jenkins/scripts/vm-start-if-not-running.sh\", \"[ha-datacenter/datastore1] build-system-pool/bs-slave-04/bs-slave-04.vmx\"].execute().text","value":"0"} at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:628) at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:372) at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:620) ... 67 more Caused by: org.kohsuke.stapler.NoStaplerConstructorException: There's no @DataBoundConstructor on any constructor of interface hudson.plugins.groovy.ScriptSource at org.kohsuke.stapler.RequestImpl.loadConstructorParamNames(RequestImpl.java:480) at org.kohsuke.stapler.RequestImpl.access$100(RequestImpl.java:75) at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:607) ... 69 more

          cjo9900 added a comment -

          After doing a bit more searching, I think this is cause by issue JENKINS-6797,
          so duplicating it to that.

          cjo9900 added a comment - After doing a bit more searching, I think this is cause by issue JENKINS-6797 , so duplicating it to that.

          cjo9900 added a comment -

          duplicate of JENKINS-6797

          cjo9900 added a comment - duplicate of JENKINS-6797

            cjo9900 cjo9900
            dregin Bernard McKeever
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: