-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[JENKINS-51454] Pipeline retry operation doesn't retry when there is a timeout inside of it #144
Conversation
src/main/java/org/jenkinsci/plugins/workflow/steps/RetryStepExecution.java
Outdated
Show resolved
Hide resolved
src/main/java/org/jenkinsci/plugins/workflow/steps/TimeoutStepExecution.java
Outdated
Show resolved
Hide resolved
@Override | ||
public void onSuccess(StepContext context, Object result) { | ||
if (killer != null) { | ||
killer.cancel(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume is unlikely to throw exceptions? See special behaviors lost when moving from TailCall
. Maybe better to enhance TailCall
to make onFailure
nonfinal
so you can call super
but still do some special processing with the exception.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. I wasn't sure whether to put the call to super.onFailure()
before or after the new logic, but I put it before the new logic and the tests still passed.
ExceededTimeout exceededTimeout = new ExceededTimeout(); | ||
exceededTimeout.setNodeId(nodeId); | ||
final Throwable death = | ||
new FlowInterruptedException(Result.ABORTED, exceededTimeout); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not understanding why all the complexity. Does a simple
new FlowInterruptedException(Result.ABORTED, exceededTimeout); | |
new FlowInterruptedException(Result.ABORTED, false, exceededTimeout); |
not solve the issue here, without the upstream PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you do that, then I think both case 1 and case 2 from the PR description would have the same behavior. (Maybe fine, but IMO that just trades the current frustrations with case 1 to new frustrations with case 2.)
Co-authored-by: Jesse Glick <[email protected]>
…ake the field `final`).
…an call `super` but still do some special processing with the exception.
…i/workflow-basic-steps-plugin#144 is merged (#1217) Signed-off-by: Damien Duportal <[email protected]>
The test that just failed is flaky. I just re-ran it locally and it passed. |
I am stepping away from this for now. I believe the change is ready for merge and release, but the CI build is failing due to problems that I believe are out of my control and not caused by me. |
Build is green now, cc @dwnusbaum @car-roll @bitwiseman |
@dwnusbaum would you mind taking a look at this since @jglick is not available atm? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems fine, but I added some comments. The main thing I would change would be to call FlowInterruptedException.handle
instead of directly printing the causes.
src/main/java/org/jenkinsci/plugins/workflow/steps/RetryStepExecution.java
Outdated
Show resolved
Hide resolved
src/main/java/org/jenkinsci/plugins/workflow/steps/TimeoutStepExecution.java
Outdated
Show resolved
Hide resolved
src/main/java/org/jenkinsci/plugins/workflow/steps/TimeoutStepExecution.java
Outdated
Show resolved
Hide resolved
src/main/java/org/jenkinsci/plugins/workflow/steps/TimeoutStepExecution.java
Show resolved
Hide resolved
…ecution.java Co-authored-by: Devin Nusbaum <[email protected]>
…method rather than the start so that the exception is updated before `context.onFailure(t)` is called in the superclass.
… problems for some users.
All feedback has been addressed, and the build is green. I think it's time to put this bug to rest. |
does the timeout be enabled in the retry of the pipeline? I tried the code..when the timeout exceeded, the retry option was working but without timeout. stage (‘Build’) {
|
Check in Scripted syntax. If that works, and you only see a problem in Declarative syntax, file a bug report in |
See JENKINS-51454. Downstream of jenkinsci/workflow-step-api-plugin#61.
Problem
There are two desired behaviors depending on the placement of
timeout
andretry
relative to each other.First case (JENKINS-51454):
In this case, if the timeout triggers, the desired behavior is for
retry
to run its body again. This is not the current behavior.Second case (JENKINS-44379):
In this case, if the timeout triggers, the desired behavior is for
retry
to be aborted without retrying anything. This is the current behavior, which is working as-designed after JENKINS-44379.Solution
JENKINS-60354 overlaps a bit with this issue. @dwnusbaum suggested that the approach from #81 by @rudolfwalter could be tweaked a bit to use jenkinsci/workflow-step-api-plugin#51 (if a setter was added) to change the value of
FlowInterruptedException#actualInterruption
fromtrue
tofalse
when the exception propagates past the timeout step that threw the exception, in which case the fix for JENKINS-60354 in #102 would fix JENKINS-51454 as well. That is precisely what we are doing in jenkinsci/workflow-step-api-plugin#61 and this PR.