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-50199] Fix cases where builds would "resume" even though the execution is complete #104
Merged
svanoort
merged 5 commits into
jenkinsci:master
from
svanoort:jenkins-50199-fix-completed-execution-onload-loophole
Aug 30, 2018
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
a0af64f
Fix for issues with builds that resume even when the execution is com…
svanoort 2060308
Add tests for a bunch of persistence edgecases that require correct h…
svanoort bb1c683
Propagate the final build result from the execution if present
svanoort ff2d27c
Log cases where we correct build completion status
svanoort 35b435d
Address review feedback
svanoort File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -874,10 +874,24 @@ private void finish(@Nonnull Result r, @CheckForNull Throwable t) { | |
} | ||
fetchedExecution.onLoad(new Owner(this)); | ||
if (this.completed != Boolean.TRUE) { | ||
// Defer the normal listener to ensure onLoad can complete before finish() is called since that may | ||
// need the build to be loaded and can result in loading loops otherwise. | ||
fetchedExecution.removeListener(finishListener); | ||
fetchedExecution.addListener(new GraphL()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note to self: minor merge conflict with #27. |
||
if (fetchedExecution.isComplete()) { // See JENKINS-50199 for cases where the execution is marked complete but build is not | ||
// Somehow arrived at one of those weird states | ||
LOGGER.log(Level.WARNING, "Found incomplete build with completed execution - display name: "+this.getFullDisplayName()); | ||
this.completed = true; | ||
Result finalResult = Result.FAILURE; | ||
List<FlowNode> heads = fetchedExecution.getCurrentHeads(); | ||
if (!heads.isEmpty() && heads.get(0) instanceof FlowEndNode) { | ||
finalResult = ((FlowEndNode)(heads.get(0))).getResult(); | ||
} | ||
setResult(finalResult); | ||
fetchedExecution.removeListener(finishListener); | ||
saveWithoutFailing(); | ||
} else { | ||
// Defer the normal listener to ensure onLoad can complete before finish() is called since that may | ||
// need the build to be loaded and can result in loading loops otherwise. | ||
fetchedExecution.removeListener(finishListener); | ||
fetchedExecution.addListener(new GraphL()); | ||
} | ||
} | ||
SettableFuture<FlowExecution> settablePromise = getSettableExecutionPromise(); | ||
if (!settablePromise.isDone()) { | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Use
SemaphoreStep
instead.