-
Notifications
You must be signed in to change notification settings - Fork 145
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
Handle and persist checkrun webhook events. #1168
Merged
Merged
+360
−0
Conversation
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
ajshepley
commented
May 4, 2021
Thanks Jack! Very strangely, the head commit of this PR has a failing status, but the PR itself is somehow green. It seems like re-running the GitHub Actions check only applies the statuses to the PR, rather than to the head commit of the PR. Interesting quirk... |
ajshepley
force-pushed
the
ajs/guard_against_stale_checkrun_webhooks
branch
from
May 7, 2021 17:16
cdfdb85
to
ae6bf54
Compare
ajshepley
force-pushed
the
ajs/handle_persist_checkrun_webhooks
branch
from
May 7, 2021 17:17
391b951
to
e8b5f82
Compare
gigr
approved these changes
May 7, 2021
ajshepley
force-pushed
the
ajs/guard_against_stale_checkrun_webhooks
branch
from
May 7, 2021 18:36
ae6bf54
to
a8e3d85
Compare
ajshepley
force-pushed
the
ajs/handle_persist_checkrun_webhooks
branch
from
May 7, 2021 18:36
e8b5f82
to
90e8bd6
Compare
ajshepley
force-pushed
the
ajs/guard_against_stale_checkrun_webhooks
branch
from
May 7, 2021 20:08
a8e3d85
to
ff200e6
Compare
ajshepley
force-pushed
the
ajs/handle_persist_checkrun_webhooks
branch
from
May 7, 2021 20:14
90e8bd6
to
01e77ad
Compare
ajshepley
force-pushed
the
ajs/handle_persist_checkrun_webhooks
branch
from
May 17, 2021 20:10
01e77ad
to
6b86c5d
Compare
ajshepley
force-pushed
the
ajs/guard_against_stale_checkrun_webhooks
branch
from
May 17, 2021 20:10
ff200e6
to
cd85e87
Compare
ajshepley
force-pushed
the
ajs/handle_persist_checkrun_webhooks
branch
from
May 17, 2021 20:11
6b86c5d
to
1b6383f
Compare
ajshepley
force-pushed
the
ajs/guard_against_stale_checkrun_webhooks
branch
from
May 17, 2021 21:13
3d4e3fb
to
22b0ed7
Compare
ajshepley
force-pushed
the
ajs/handle_persist_checkrun_webhooks
branch
from
May 17, 2021 21:16
1b6383f
to
fa848c7
Compare
ajshepley
force-pushed
the
ajs/guard_against_stale_checkrun_webhooks
branch
from
May 20, 2021 21:57
22b0ed7
to
ff43003
Compare
ajshepley
force-pushed
the
ajs/handle_persist_checkrun_webhooks
branch
from
May 20, 2021 22:10
fa848c7
to
e9c2501
Compare
Base automatically changed from
ajs/guard_against_stale_checkrun_webhooks
to
master
May 21, 2021 15:08
ajshepley
force-pushed
the
ajs/handle_persist_checkrun_webhooks
branch
from
May 21, 2021 15:46
e9c2501
to
1a3024e
Compare
ajshepley
force-pushed
the
ajs/handle_persist_checkrun_webhooks
branch
from
May 21, 2021 20:52
1a3024e
to
da80e3a
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Ref: #1167
When we receive a status webhook event, we use the webhook data to persist the statuses. This helps with timeliness.
However for checkruns, we wait for a CheckSuite event, which does not contain checkrun information, and we enqueue a refresh which will then retrieve checkrun information.
It turns out that we are also receiving CheckRun webhooks, which do provide enough data to create a checkrun record.
So this PR adds a handler for those events, and attempts to persist them using the existing logic.
Paired with the target PR #1167, this should make Shipit-engine more robust against stale and incorrect data from GitHub's end, by ensuring that we commit. It should also make it a bit faster in responding to checkrun changes, though in practice, the refresh job is quite fast already (fast enough to cause the issues mentioned in #1167).
Alternative Option
Instead of persisting the checkrun, we could also enqueue a refresh job just as CheckSuiteEvent does. But since the target PR adds guards for webhook ordering and staleness, I see no large drawbacks in just persisting the data we've received in this webhook.
In theory, every checkrun event would have checksuite events nearby, but in practice this does not appear to be the case, so persisting the "more correct" data we seem to receive from webhooks, and deferring to it based on timestamps, seems like a good improvement to make.