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

singleConditionalBuilder closure creates FATAL: null java.lang.StackOverFlow error using runner{ run() }

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Using run() in runner causes the error:

      job('example') {
        steps {
          // This is a single step conditional
          singleConditionalBuilder {
            buildStep {
              shell {
                command("ps -ef")
              }
            }
            condition {
              alwaysRun()
            }
            runner {
              run()
            }
          }
        }
      }
      

      If I change it to fail() there's no error.

        Attachments

          Activity

          Hide
          imod Dominik Bartholdi added a comment - - edited

          How did you come up with this syntax? as far as I know conditional-buildstep does not support pipeline (and most probably also does not make sense in pipeline).

          Anyway when I run your script, then I get this: 

          ...No such DSL method 'singleConditionalBuilder'...

          ...which clearly says that there is no such command like singleConditionalBuilder

          Show
          imod Dominik Bartholdi added a comment - - edited How did you come up with this syntax? as far as I know conditional-buildstep does not support pipeline (and most probably also does not make sense in pipeline). Anyway when I run your script, then I get this:  ...No such DSL method 'singleConditionalBuilder'... ...which clearly says that there is no such command like singleConditionalBuilder
          Hide
          fzbassman Eric Wallengren added a comment -

          I'm not running this in a pipeline, this is a DSL script (buildstep 'Process Job DSLs' in a freestyle build). Conditional Buildstep plugin version 1.3.5. From the DSL API reference viewer:

          Show
          fzbassman Eric Wallengren added a comment - I'm not running this in a pipeline, this is a DSL script (buildstep 'Process Job DSLs' in a freestyle build). Conditional Buildstep plugin version 1.3.5. From the DSL API reference viewer:
          Hide
          daspilker Daniel Spilker added a comment -

          Ah, that's odd. The run() method causes a name collision with an internal method from groovy.lang.Closure with the same signature and the internal method has a higher precedence.

          As a workaround, you can use the built-in DSL for the Conditional Build Step plugin:

          job('example') {
              steps {
                  conditionalSteps {
                      steps {
                          shell("ps -ef")
                      }
                      condition {
                          alwaysRun()
                      }
                      runner('Run')
                  }
              }
          }
          
          Show
          daspilker Daniel Spilker added a comment - Ah, that's odd. The run() method causes a name collision with an internal method from groovy.lang.Closure with the same signature and the internal method has a higher precedence. As a workaround, you can use the built-in DSL for the Conditional Build Step plugin: job( 'example' ) { steps { conditionalSteps { steps { shell( "ps -ef" ) } condition { alwaysRun() } runner( 'Run' ) } } }
          Hide
          daspilker Daniel Spilker added a comment -

          You can also call the method directly on the delegate of the closure to avoid calling the closure's method:

          job('example') {
            steps {
              // This is a single step conditional
              singleConditionalBuilder {
                buildStep {
                  shell {
                    command("ps -ef")
                  }
                }
                condition {
                  alwaysRun()
                }
                runner {
                  delegate.run()
                }
              }
            }
          }
          
          Show
          daspilker Daniel Spilker added a comment - You can also call the method directly on the delegate of the closure to avoid calling the closure's method: job( 'example' ) { steps { // This is a single step conditional singleConditionalBuilder { buildStep { shell { command( "ps -ef" ) } } condition { alwaysRun() } runner { delegate.run() } } } }

            People

            • Assignee:
              Unassigned
              Reporter:
              fzbassman Eric Wallengren
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: