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

"Restart Build" button in BlueOcean causes build to fail when groovy load() method is used

    XMLWordPrintable

Details

    Description

      My pipeline definitions include methods from Groovy script files. They are loaded like so:

      lib = load('ci/lib.groovy')

      The problem with this is that when I click the "Restart Build" button from BlueOcean on a job that uses this method it fails to load the Groovy scripts, which results in failures like so:
      groovy.lang.MissingPropertyException: No such property: lib for class: WorkflowScript
      {\{ at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:53)}}
      {\{ at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.getProperty(ScriptBytecodeAdapter.java:458)}}
      {\{ at org.kohsuke.groovy.sandbox.impl.Checker$6.call(Checker.java:290)}}
      {\{ at org.kohsuke.groovy.sandbox.GroovyInterceptor.onGetProperty(GroovyInterceptor.java:68)}}
      {\{ at }}

      ...
      The same does not happen when I use the "Replay" button from normal Jenkins UI.

      Attachments

        Activity

          always_fail Always Fail added a comment - - edited

          Oh I see, so the "Prep" stage that I load() the library in isn't actually called:
          Stage "Prep" skipped due to this build restarting at stage "Build"
          Which means that this might not be a bug, it might be a feature request, to add a "Replay" button to the BlueOcean UI, but I'm not sure if this is intended behaviour yet.

          always_fail Always Fail added a comment - - edited Oh I see, so the "Prep" stage that I load()  the library in isn't actually called: Stage "Prep" skipped due to this build restarting at stage "Build" Which means that this might not be a bug, it might be a feature request, to add a "Replay" button to the BlueOcean UI, but I'm not sure if this is intended behaviour yet.
          always_fail Always Fail added a comment -

          If this is intended behaviour shouldn't the "Restart Build" button be named "Restart from Stage" to be more accurate? Since that is the name of the button in normal Jenkins UI?

          always_fail Always Fail added a comment - If this is intended behaviour shouldn't the " Restart Build " button be named " Restart from Stage " to be more accurate? Since that is the name of the button in normal Jenkins UI?

          People

            Unassigned Unassigned
            always_fail Always Fail
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: