-
Notifications
You must be signed in to change notification settings - Fork 22
Add script for retrying all missed job webhooks #1049
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
base: main
Are you sure you want to change the base?
Conversation
d13a646
to
b234057
Compare
b234057
to
fd35a07
Compare
@jjnesbitt with the analytics webhook being down the last couple days, it seems like now would be a good time to test this out and get it merged. IIRC I ran it a while back and it appeared to work, but I don't think we've needed to retry this many job events before. |
fd35a07
to
600ef38
Compare
Just realized this has to be updated for the new job model. So not ready for review yet, sorry for the confusion |
fdb5af8
to
3dde210
Compare
This should be ready now. |
4b5691b
to
a9f4488
Compare
def retry_webhook(webhook_event: WebhookEvent, dry_run: bool) -> None: | ||
if dry_run: | ||
click.echo(f"Would retry webhook {webhook_event}") | ||
return | ||
|
||
click.echo(f"Retrying webhook {webhook_event}") | ||
gl = get_gitlab_handle() | ||
|
||
# https://docs.gitlab.com/ee/api/project_webhooks.html#resend-a-project-webhook-event | ||
retry_url = f"/projects/{webhook_event.project_id}/hooks/{webhook_event.webhook_id}/events/{webhook_event.webhook_event_id}/resend" | ||
gl.http_post(retry_url) |
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.
TODO: try fetching the webhook payload from the web_hook_logs
table and invoke the ingest function directly instead of sending a webhook
This adds a Django management script that
web_hook_logs
table of the GitLab DB for all webhook events in the past n seconds (n is an argument to the script)I've ran variations of this script in the past to retry missed job webhooks after fixing bugs in the webhook handler, downtime of the webhook handler, etc. and it works.