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

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

      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.

          [JENKINS-43778] singleConditionalBuilder closure creates FATAL: null java.lang.StackOverFlow error using runner{ run() }

          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

          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

          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:

          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:

          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')
                  }
              }
          }
          

          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' ) } } }

          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()
                }
              }
            }
          }
          

          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() } } } }

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

              Created:
              Updated: