[JIRA] (JENKINS-28822) Can't distinguish between durable task abort and failure in workflow plugin
Title: Message Title Devin Nusbaum edited a comment on JENKINS-28822 Re: Can't distinguish between durable task abort and failure in workflow plugin Fixed in Pipeline Nodes and Processes 2.24. See [ my comment here |https://issues.jenkins-ci.org/browse/JENKINS-28822?focusedCommentId=350058&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-350058] for an overview of the changes , but in short, externally aborted tasks should throw FlowInterruptedException, while tasks that fail in the script itself should throw AbortException . Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-28822) Can't distinguish between durable task abort and failure in workflow plugin
Title: Message Title Devin Nusbaum edited a comment on JENKINS-28822 Re: Can't distinguish between durable task abort and failure in workflow plugin Fixed in Pipeline Nodes and Processes 2.24. See my comment here for an overview of the changes. Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-28822) Can't distinguish between durable task abort and failure in workflow plugin
Title: Message Title Devin Nusbaum edited a comment on JENKINS-28822 Re: Can't distinguish between durable task abort and failure in workflow plugin Fixed in Pipeline Nodes and Processes 2.24. See [ my comment here |https://issues.jenkins-ci.org/browse/JENKINS-28822?focusedCommentId=350058&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-350058] for an overview of the changes. Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-28822) Can't distinguish between durable task abort and failure in workflow plugin
Title: Message Title Devin Nusbaum updated JENKINS-28822 Fixed in Pipeline Nodes and Processes 2.24. See my comment here for an overview of the changes. Jenkins / JENKINS-28822 Can't distinguish between durable task abort and failure in workflow plugin Change By: Devin Nusbaum Status: In Review Resolved Resolution: Fixed Released As: workflow-durable-task-step 2.24 Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-28822) Can't distinguish between durable task abort and failure in workflow plugin
Title: Message Title Hari Dara commented on JENKINS-28822 Re: Can't distinguish between durable task abort and failure in workflow plugin Chris Russell: I see that your workaround uses instanceof checks, but these are not permitted in pipeline sandbox. Using instanceof generates the below sort of error: org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use method java.lang.Class isInstance java.lang.Object I just submitted this PR that whitelists isinstance check: https://github.com/jenkinsci/script-security-plugin/pull/226 Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-28822) Can't distinguish between durable task abort and failure in workflow plugin
Title: Message Title Devin Nusbaum commented on JENKINS-28822 Re: Can't distinguish between durable task abort and failure in workflow plugin There are 2 main differences that my change would cause: If a sh step is manually aborted, the exception thrown will be a FlowInterruptedException rather than an AbortException (and FlowInterruptedException will be thrown even if returnStatus is true). The script will exit with RESULT.ABORTED both before and after my change. The behavior of Chris Russell's workaround is unaffected by my change in this case. If a sh step is automatically aborted by a timeout step, the exception thrown will be a FlowInterruptedException rather than an AbortException (and FlowInterruptedException will be thrown even if returnStatus is true), and as a result the script will exit with Result.ABORTED instead of RESULT.FAILURE. Chris Russell's workaround does not handle this case, so the behavior would change in the same way that it would for people not using a workaround. This change also makes timeout}}s of {{sh steps consistent with other steps such as sleep. (ABORTED instead of FAILURE) It looks like the workaround from Kai Howelmeyer does not work, because FlowInterruptedException is thrown in the sleeping parallel branch when the pipeline is manually aborted, when the sh step is aborted by a timeout step, or when the sh step fails because of an issue in the script itself, so wasAborted is set to true in all cases and we always rethrow an AbortedException and never execute the block where the sh step's script failed. Based on that info, I think it is ok to move forward with the change, but if anyone knows of other common workarounds that may be broken by this change, feel free leave a comment. Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)
[JIRA] (JENKINS-28822) Can't distinguish between durable task abort and failure in workflow plugin
Title: Message Title Devin Nusbaum commented on JENKINS-28822 Re: Can't distinguish between durable task abort and failure in workflow plugin I am working on this in https://github.com/jenkinsci/workflow-durable-task-step-plugin/pull/75. My main concern is whether fixing it now will break all of the workarounds the people are currently using, so I want to do a few tests with some of the workarounds posted here to get an idea of the impact. Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-28822) Can't distinguish between durable task abort and failure in workflow plugin
Title: Message Title Devin Nusbaum updated JENKINS-28822 Jenkins / JENKINS-28822 Can't distinguish between durable task abort and failure in workflow plugin Change By: Devin Nusbaum Status: In Progress Review Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-28822) Can't distinguish between durable task abort and failure in workflow plugin
Title: Message Title Devin Nusbaum started work on JENKINS-28822 Change By: Devin Nusbaum Status: Open In Progress Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-28822) Can't distinguish between durable task abort and failure in workflow plugin
Title: Message Title Devin Nusbaum updated JENKINS-28822 Jenkins / JENKINS-28822 Can't distinguish between durable task abort and failure in workflow plugin Change By: Devin Nusbaum Status: Reopened Open Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-28822) Can't distinguish between durable task abort and failure in workflow plugin
Title: Message Title Devin Nusbaum assigned an issue to Devin Nusbaum Jenkins / JENKINS-28822 Can't distinguish between durable task abort and failure in workflow plugin Change By: Devin Nusbaum Assignee: Jesse Glick Devin Nusbaum Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-28822) Can't distinguish between durable task abort and failure in workflow plugin
Title: Message Title Joerg Schwaerzler commented on JENKINS-28822 Re: Can't distinguish between durable task abort and failure in workflow plugin Thanks for the info. After updating to 2.21 I can confirm that the issue we faced is fixed. Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-28822) Can't distinguish between durable task abort and failure in workflow plugin
Title: Message Title Jesse Glick commented on JENKINS-28822 Re: Can't distinguish between durable task abort and failure in workflow plugin Joerg Schwaerzler that is indeed related, but should have been fixed by this in 2.21 AFAIK. Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-28822) Can't distinguish between durable task abort and failure in workflow plugin
Title: Message Title Joerg Schwaerzler edited a comment on JENKINS-28822 Re: Can't distinguish between durable task abort and failure in workflow plugin I wonder whether my issue is related to this one:I get a {{hudson.AbortException()}} sometimes if some parallel steps are waiting for some free node when a timeout aborts the build. I would expect to get a {{FlowInterruptedException}}, though. I get {{Encountered exception: hudson.AbortException: Queue task was cancelled.}} Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-28822) Can't distinguish between durable task abort and failure in workflow plugin
Title: Message Title Joerg Schwaerzler edited a comment on JENKINS-28822 Re: Can't distinguish between durable task abort and failure in workflow plugin I wonder whether my issue is related to this one:I get a {{hudson.AbortException()}} sometimes if some parallel steps are waiting for some free node while when a timeout aborts the build. I would expect to get a {{FlowInterruptedException}}, though. Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-28822) Can't distinguish between durable task abort and failure in workflow plugin
Title: Message Title Joerg Schwaerzler commented on JENKINS-28822 Re: Can't distinguish between durable task abort and failure in workflow plugin I wonder whether my issue is related to this one: I get a hudson.AbortException() sometimes if some parallel steps are waiting for some free node while a timeout aborts the build. I would expect to get a FlowInterruptedException, though. Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-28822) Can't distinguish between durable task abort and failure in workflow plugin
Title: Message Title Jesse Glick updated an issue Jenkins / JENKINS-28822 Can't distinguish between durable task abort and failure in workflow plugin Change By: Jesse Glick When a workflow is manually aborted in Jenkins it fires a hudson.AbortException. This is the same thing that happens when a step fails. Thus, it's impossible to properly set the build status to ABORTED on a manual abort and to FAILED on a failed step because you can't programmatically tell the difference. [~jglick]’s recommended fix: see comment as of 2017-06-28 Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-28822) Can't distinguish between durable task abort and failure in workflow plugin
Title: Message Title Chris Russell edited a comment on JENKINS-28822 Re: Can't distinguish between durable task abort and failure in workflow plugin Piecing together clues from comments here and in similar issues (such as JENKINS-41604), I've added this to our shared lib with pretty good results, so far.This version has some debug output and logic which isn't needed for our purposes (such as distinguishing between user and system rejections for inputs), but I left that logic in for the purposes of this comment in case it is useful for others.Pipeline{code:java}try { // work} catch(err) { (new ExecutionHelper()).fixBuildResult(error)// Don't hide the error from jenkins throw err} finally { // React to currentBuild.result}{code}ExcecutionHelper.groovy{code:java}import jenkins.model.CauseOfInterruptionimport jenkins.model.InterruptedBuildActionimport org.jenkinsci.plugins.workflow.steps.FlowInterruptedExceptionimport org.jenkinsci.plugins.workflow.support.steps.input.Rejectiondef fixBuildResult(error) {def iba = currentBuild.rawBuild.getAction(InterruptedBuildAction.class)if (iba && iba.causes.size() && iba.causes.any{ it instanceof CauseOfInterruption.UserInterruption }) {// probably aborted the execution from outside pipelineecho "run cancelled"currentBuild.result = "ABORTED"} else if (error instanceof FlowInterruptedException && error.getCauses().any { it instanceof Rejection }) {// Dig out the rejection and see if it is associated to a user.def user = nullerror.getCauses().each {if (it instanceof Rejection) {user = it.user}}// System user probably means rejected because of timeoutecho (user && "${user}" != "SYSTEM" ? "rejected by user: ${user}" : "rejected by... not user")currentBuild.result = "ABORTED"} else {currentBuild.result = "FAILURE"} throw error } {code} Add Comment This message was sent by Atlassian JIRA (v7.10.1#710002-sha1:6efc396) --
[JIRA] (JENKINS-28822) Can't distinguish between durable task abort and failure in workflow plugin
Title: Message Title Chris Russell commented on JENKINS-28822 Re: Can't distinguish between durable task abort and failure in workflow plugin Piecing together clues from comments here and in similar issues (such as JENKINS-41604), I've added this to our shared lib with pretty good results, so far. This version has some debug output and logic which isn't needed for our purposes (such as distinguishing between user and system rejections for inputs), but I left that logic in for the purposes of this comment in case it is useful for others. Pipeline try { // work } catch(err) { (new ExecutionHelper()).fixBuildResult(error) // Don't hide the error from jenkins throw err } finally { // React to currentBuild.result } ExcecutionHelper.groovy import jenkins.model.CauseOfInterruption import jenkins.model.InterruptedBuildAction import org.jenkinsci.plugins.workflow.steps.FlowInterruptedException import org.jenkinsci.plugins.workflow.support.steps.input.Rejection def fixBuildResult(error) { def iba = currentBuild.rawBuild.getAction(InterruptedBuildAction.class) if (iba && iba.causes.size() && iba.causes.any{ it instanceof CauseOfInterruption.UserInterruption }) { // probably aborted the execution from outside pipeline echo "run cancelled" currentBuild.result = "ABORTED" } else if (error instanceof FlowInterruptedException && error.getCauses().any { it instanceof Rejection }) { // Dig out the rejection and see if it is associated to a user. def user = null error.getCauses().each { if (it instanceof Rejection) { user = it.user } } // System user probably means rejected because of timeout echo (user && "${user}" != "SYSTEM" ? "rejected by user: ${user}" : "rejected by... not user") currentBuild.result = "ABORTED" } else { currentBuild.result = "FAILURE" } throw error } Add Comment
[JIRA] (JENKINS-28822) Can't distinguish between durable task abort and failure in workflow plugin
Title: Message Title kutzi edited a comment on JENKINS-28822 Re: Can't distinguish between durable task abort and failure in workflow plugin I guess this is also the reason for JENKINS-43339, isn't it?This is IMO a big issue as it makes the _post { aborted {} }_ section in declarative pipelines largely unusable. In fact, I've not seen a single occasion when _aborted_ worked as expected - when manually aborting a build . For me Then the _failure_ section is always triggered instead. Add Comment This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-28822) Can't distinguish between durable task abort and failure in workflow plugin
Title: Message Title kutzi edited a comment on JENKINS-28822 Re: Can't distinguish between durable task abort and failure in workflow plugin I guess this is also the reason for JENKINS-43339, isn't it?This is IMO a big issue as it makes to post the _post { aborted {} } _ section in declarative pipelines largely unusable. In fact, I've not seen a single occasion when _aborted_ worked as expected. For me the _failure_ section is always triggered instead. Add Comment This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-28822) Can't distinguish between durable task abort and failure in workflow plugin
Title: Message Title kutzi commented on JENKINS-28822 Re: Can't distinguish between durable task abort and failure in workflow plugin I guess this is also the reason for JENKINS-43339, isn't it? This is IMO a big issue as it makes to post { aborted {} } section in declarative pipelines largely unusable. In fact, I've not seen a single occasion when aborted worked as expected. For me the failure section is always triggered instead. Add Comment This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-28822) Can't distinguish between durable task abort and failure in workflow plugin
Title: Message Title Jesse Glick commented on JENKINS-28822 Re: Can't distinguish between durable task abort and failure in workflow plugin Not currently. Read my last comment. Add Comment This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-28822) Can't distinguish between durable task abort and failure in workflow plugin
Title: Message Title Kai Howelmeyer commented on JENKINS-28822 Re: Can't distinguish between durable task abort and failure in workflow plugin I am also confused by this handling: In https://github.com/jenkinsci/workflow-durable-task-step-plugin/blob/master/src/main/java/org/jenkinsci/plugins/workflow/steps/durable_task/DurableTaskStep.java#L319 we send AbortException. If I surround a "sh" step with try/catch, I cannot tell if Abort was clicked or if the shell script failed. Is there an easy way to distinguish this? Add Comment This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-28822) Can't distinguish between durable task abort and failure in workflow plugin
Title: Message Title Jesse Glick updated an issue Jenkins / JENKINS-28822 Can't distinguish between durable task abort and failure in workflow plugin Change By: Jesse Glick Component/s: workflow-durable-task-step-plugin Component/s: pipeline Add Comment This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.