-
Notifications
You must be signed in to change notification settings - Fork 370
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
Return null for unmergable heads rather than excepting #386
base: master
Are you sure you want to change the base?
Conversation
Having another look through the code, since the simplifications in #226 it may be that |
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.
Looks like it fixes the issue
@@ -1629,7 +1629,16 @@ protected SCMRevision retrieve(SCMHead head, TaskListener listener) | |||
} | |||
PullRequestSCMRevision prRev = | |||
createPullRequestSCMRevision(pr, prhead, listener, ghRepository); | |||
prRev.validateMergeHash(); | |||
try { |
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.
We only need to do this if the prHead
is a merge, right?
Maybe encapsulate this in a method and call from the two different places we currently call validateMergeHash()
?
getValidatedMergeOrNull()
?
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.
This looks reasonable. A little refactoring suggested.
Also, can you create a test that exercises this? If not, I won't block the merge, but without a test there's no guarantee it won't break in the future. 😢
Description
Triggered by jenkinsci/checks-api-plugin#83.
I have zombie jobs (job is aborted, but agents remain busy executing a dead job) seemingly triggered by the following stack trace:
The environmental behaviour that lead to this I believe was my force-pushing to the PR.
Now while there are separate issues in many different plugins that lead to this, the root exception in
validateMergeHash
I believe should in fact be handled in its direct caller.This PR updates
github-branch-source-plugin/src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubSCMSource.java
Line 1590 in ea3b723
null
if given an unmergeable PR head rather than excepting.This should not affect downstream consumers as this API is marked as
@CheckForNull
.Note that this would bring it line with
github-branch-source-plugin/src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubSCMSource.java
Line 1328 in ea3b723
which does return
null
for unmergeable heads (despite the API not being marked@CheckForNull
).I'm not certain that this is the best/correct way to solve this problem; I did look at fixing it in the
github-checks-api
plugin, but I did not want to leak the checking of this specific and ignorable issue across modules; asvalidateMergeHash
only throws a genericAbortException
it is indistinguishable from the many other uses ofAbortExceptions
throughout this plugin.Submitter checklist
Reviewer checklist
Documentation changes
Users/aliases to notify
cc: @timja