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

Post Build Steps still running regardless of Pre Step Groovy Script failure

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      This issue can be reproduced via carrying out the following steps:

      1. Create a new Jenkins maven project
      2. As a pre step, add an "execute system groovy scrip"
      3. Type a simple command which throws an exception
      4. Add a maven clean in the main build
      5. Add a post build invoke maven target step and add a clean (tick the selection which states to only run post builds if success)
      6. Save and execute the job. Observer how the groovy exception stack trace is shown at the very end and the post build step was attempted to run regardless of the groovy script failure.

      (UPDATE: Changed component from groovy-plugin to m2-extra-steps-plugin. Please see comments below)

        Attachments

          Activity

          Hide
          vjuranek vjuranek added a comment -

          Hi,
          what I can do (I actually already did so, but will double check) is to verify that when exception is thrown (and is not caught) in the groovy script, groovy build step will return non-zero value from perform method. How this exit code is handled by other Jenkins parts (like maven plugin), cannot be effected by groovy plugin. However, I'll double check and confirm here, that groovy plugin return non-zero value from perform method when exception is thrown.

          Show
          vjuranek vjuranek added a comment - Hi, what I can do (I actually already did so, but will double check) is to verify that when exception is thrown (and is not caught) in the groovy script, groovy build step will return non-zero value from perform method. How this exit code is handled by other Jenkins parts (like maven plugin), cannot be effected by groovy plugin. However, I'll double check and confirm here, that groovy plugin return non-zero value from perform method when exception is thrown.
          Hide
          omar_a Omar Ahmad added a comment -

          Hi, that sounds great. Did you manage to get round to confirming the result of this check?

          Show
          omar_a Omar Ahmad added a comment - Hi, that sounds great. Did you manage to get round to confirming the result of this check?
          Hide
          vjuranek vjuranek added a comment -

          Sorry, not yet. Hopefully with get to it today evening or tomorrow.

          Show
          vjuranek vjuranek added a comment - Sorry, not yet. Hopefully with get to it today evening or tomorrow.
          Hide
          vjuranek vjuranek added a comment -

          Hi, I wrote a test which verifies that build fails when exception is thrown from groovy script. Test is passing, so IMHO this is really not an issue in groovy plugin itself, but in a component which wraps groovy script (and probably ignores error status of groovy step).

          Show
          vjuranek vjuranek added a comment - Hi, I wrote a test which verifies that build fails when exception is thrown from groovy script. Test is passing, so IMHO this is really not an issue in groovy plugin itself, but in a component which wraps groovy script (and probably ignores error status of groovy step).
          Hide
          omar_a Omar Ahmad added a comment -

          Hi, Thank you for confirming this. I will update the component of this JIRA to a more appropriate one soon. Thanks again

          Show
          omar_a Omar Ahmad added a comment - Hi, Thank you for confirming this. I will update the component of this JIRA to a more appropriate one soon. Thanks again

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            omar_a Omar Ahmad
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: