• Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • workflow-cps-plugin
    • None

      When trying to generate a parallel step from the snippet generator an exception is thrown:

      java.lang.RuntimeException: Failed to instantiate class org.jenkinsci.plugins.workflow.cps.steps.ParallelStep from {"stapler-class":"org.jenkinsci.plugins.workflow.cps.steps.ParallelStep", "$class":"org.jenkinsci.plugins.workflow.cps.steps.ParallelStep"}
      	at hudson.model.Descriptor.newInstance(Descriptor.java:579)
      	at org.jenkinsci.plugins.workflow.cps.Snippetizer.doGenerateSnippet(Snippetizer.java:212)
      
      ...
      
      Caused by: org.kohsuke.stapler.NoStaplerConstructorException: There's no @DataBoundConstructor on any constructor of class org.jenkinsci.plugins.workflow.cps.steps.ParallelStep
      	at org.kohsuke.stapler.ClassDescriptor.loadConstructorParamNames(ClassDescriptor.java:177)
      

          [JENKINS-30572] Parallel step snippet generator error

          Antonio Muñiz created issue -
          Antonio Muñiz made changes -
          Description Original: When trying to generate a parallel step from the snippet generator an exception is thrown:


          {code}
          java.lang.RuntimeException: Failed to instantiate class org.jenkinsci.plugins.workflow.cps.steps.ParallelStep from {"stapler-class":"org.jenkinsci.plugins.workflow.cps.steps.ParallelStep","$class":"org.jenkinsci.plugins.workflow.cps.steps.ParallelStep"}
          at hudson.model.Descriptor.newInstance(Descriptor.java:579)
          at org.jenkinsci.plugins.workflow.cps.Snippetizer.doGenerateSnippet(Snippetizer.java:212)

          ...

          Caused by: org.kohsuke.stapler.NoStaplerConstructorException: There's no @DataBoundConstructor on any constructor of class org.jenkinsci.plugins.workflow.cps.steps.ParallelStep
          at org.kohsuke.stapler.ClassDescriptor.loadConstructorParamNames(ClassDescriptor.java:177)
          {code}
          New: When trying to generate a parallel step from the snippet generator an exception is thrown:


          {code}
          java.lang.RuntimeException: Failed to instantiate class org.jenkinsci.plugins.workflow.cps.steps.ParallelStep from {"stapler-class":"org.jenkinsci.plugins.workflow.cps.steps.ParallelStep", "$class":"org.jenkinsci.plugins.workflow.cps.steps.ParallelStep"}
          at hudson.model.Descriptor.newInstance(Descriptor.java:579)
          at org.jenkinsci.plugins.workflow.cps.Snippetizer.doGenerateSnippet(Snippetizer.java:212)

          ...

          Caused by: org.kohsuke.stapler.NoStaplerConstructorException: There's no @DataBoundConstructor on any constructor of class org.jenkinsci.plugins.workflow.cps.steps.ParallelStep
          at org.kohsuke.stapler.ClassDescriptor.loadConstructorParamNames(ClassDescriptor.java:177)
          {code}

          Jesse Glick added a comment -

          The text shown in the Snippet Generator for the parallel step explains the syntax and notes that mechanical generation of snippets is not available in this case. I am not sure what else there is to do. This is a special step in that it is engine-specific and has a syntax outside the normally permitted scope.

          Jesse Glick added a comment - The text shown in the Snippet Generator for the parallel step explains the syntax and notes that mechanical generation of snippets is not available in this case. I am not sure what else there is to do. This is a special step in that it is engine-specific and has a syntax outside the normally permitted scope.

          This is what I see in the snippet generator help text:

          (No visual configuration.) Takes a map from branch names to closures 
          and an optional argument failFast which will terminate all branches upon a failure in any other branch:
          
          parallel firstBranch: {
              // do something
          }, secondBranch: {
              // do something else
          },
          failFast: true|false
          

          IMO it's not clear that the snippet generator will fail. If this is an accepted behaviour, I will note it clearly in the help text (as I'm currently working on JENKINS-30086).

          Antonio Muñiz added a comment - This is what I see in the snippet generator help text: (No visual configuration.) Takes a map from branch names to closures and an optional argument failFast which will terminate all branches upon a failure in any other branch: parallel firstBranch: { // do something }, secondBranch: { // do something else }, failFast: true|false IMO it's not clear that the snippet generator will fail. If this is an accepted behaviour, I will note it clearly in the help text (as I'm currently working on JENKINS-30086 ).
          Antonio Muñiz made changes -
          Resolution New: Won't Fix [ 2 ]
          Status Original: Open [ 1 ] New: Closed [ 6 ]

          Jesse Glick added a comment -

          No visual configuration.

          is what I meant, but yes it could be better explained.

          ParallelStep.DescriptorImpl could override newInstance(StaplerRequest, JSONObject) to return some sample ParallelStep with no branches, but this is not very helpful. Might be better for this to throw something (UnsupportedOperationException?) that would be rendered more politely in the result textarea, or even for StepDescriptor to be allowed to state that it has no visual configuration and to simply disable the snippet generation button in that case.

          Jesse Glick added a comment - No visual configuration. is what I meant, but yes it could be better explained. ParallelStep.DescriptorImpl could override newInstance(StaplerRequest, JSONObject) to return some sample ParallelStep with no branches, but this is not very helpful. Might be better for this to throw something ( UnsupportedOperationException ?) that would be rendered more politely in the result textarea, or even for StepDescriptor to be allowed to state that it has no visual configuration and to simply disable the snippet generation button in that case.

          pipeline-syntax/html shows this error instead of documentation.

          Kanstantsin Shautsou added a comment - pipeline-syntax/html shows this error instead of documentation.
          Kanstantsin Shautsou made changes -
          Resolution Original: Won't Fix [ 2 ]
          Status Original: Closed [ 6 ] New: Reopened [ 4 ]
          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 165684 ] New: JNJira + In-Review [ 186318 ]
          Jesse Glick made changes -
          Link New: This issue is duplicated by JENKINS-32159 [ JENKINS-32159 ]

            Unassigned Unassigned
            amuniz Antonio Muñiz
            Votes:
            4 Vote for this issue
            Watchers:
            13 Start watching this issue

              Created:
              Updated: