-
Bug
-
Resolution: Not A Defect
-
Minor
-
None
-
Jenkins Core 2.203.2
Pipeline: Milestone Step Plugin 1.3.2
In the course of testing pipeline error handling and skipping of stages etc I stumbled over the fact that in concurrent pipelines runs with the "milestone" step the following happened:
- Based upon org.jenkinsci.plugins.workflow.steps.FlowInterruptedException#actualInterruption it wrongly pretends that the build was aborted/interrupted due to user action (user aborting the build via UI):
... Superseded by ACME-Pipeline#9067 ... [DEBUG] isActualInterruption: true // !!!!!!! Skipping stage 'deploy-PRODUCTION-dry-run' due to cancelled build (due to overtaking: [org.jenkinsci.plugins.pipeline.milestone.CancelledCause@3b62f126])... ... Finished: NOT_BUILT
Based upon about this basic pipeline code:try { ... } catch (FlowInterruptedException e) { Util.debugLog(script, true, "isActualInterruption: ${e.isActualInterruption()}") if (PipelineUtils.isCancelledDueToOvertakingBuild(e.getCauses())) { ... }
and PipelineUtils.isCancelledDueToOvertakingBuild(...) (corrected 06.11.2021)
/** * Returns true when the caught org.jenkinsci.plugins.workflow.steps.FlowInterruptedException signals that the build * interruption was not caused by a user wanting to abort the build; this is typically due to "milestone" step * aborting the build due to overtaking builds. */ static boolean isCancelledDueToOvertakingBuild(FlowInterruptedException fie) { boolean isCancelledDueToOvertakingBuild = !fie.isActualInterruption() return isCancelledDueToOvertakingBuild }
org.jenkinsci.plugins.workflow.steps.FlowInterruptedException states:
/** * If true, this exception represents an actual build interruption, rather than a general error with a result and * no stack trace. * Used by steps like {@code RetryStep} to decide whether to handle or rethrow a {@link FlowInterruptedException}. * Non-null, except momentarily during deserialization before {@link #readResolve} sets the field to {@code true} * for old instances serialized before this field was added. */ private Boolean actualInterruption = true;
and
actualInterruption – true if this is an actual build interruption (e.g. the user wants to abort the build)
If my understanding (cf. above assumptions) is correct, then the solution is really trivial: https://github.com/jenkinsci/pipeline-milestone-step-plugin/pull/29
- relates to
-
JENKINS-60354 Updated pipeline build step does not work with retry, catchError, or warnError
- Resolved
- links to