readthedocs.org: Extend webhook notifications with build status (queued, running, failed, succeeded) & commit id

Webhook build notifications currently trigger only on build failure. Also, the commit_id that was built is missing from the JSON object that is sent.

If possible, I’d like to extend this feature to trigger on any build status transition:

  • queued
  • running
  • failed
  • succeeded

Also, in order to integrate with e.g. Bitbucket/Github build status APIs, the commit_id should be included in the JSON object that is sent.

Requirements

Webhooks are not currently set up as an asynchronous task, meaning sending these notifications will block the process. We should instead be executing these as Celery tasks. The function that currently sends these notifications is here: https://github.com/rtfd/readthedocs.org/blob/712e75d30a92bbdcf3a2597dafc16c58897eeefc/readthedocs/projects/tasks.py#L776

This will require the following work items:

  • All current calls to webhook_notification should be changed to execute a task instead. This will require setting webhook_notification as a Celery task as well. This should only execute on the web task queue.
  • webhook_notification should add the Build.commit attribute to the data payload
  • Add asynchronous task calls to other points in the build system – when we queue a build, when we start a build, and when we finish a build. Currently, we only call this when the build fails.
  • Emails should only send on failure, webhooks should send regardless of the build status at the end of the build task

Here is the actual build task: https://github.com/rtfd/readthedocs.org/blob/712e75d30a92bbdcf3a2597dafc16c58897eeefc/readthedocs/projects/tasks.py#L105

Here is where builds currently send failure notifications: https://github.com/rtfd/readthedocs.org/blob/712e75d30a92bbdcf3a2597dafc16c58897eeefc/readthedocs/projects/tasks.py#L185

Builds are triggered from: https://github.com/rtfd/readthedocs.org/blob/f6603f40599fac810993989cffc55da82f19feeb/readthedocs/core/utils/__init__.py#L67

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 4
  • Comments: 20 (11 by maintainers)

Most upvoted comments

Seems like nobody is working on this, I will start working on it.

Thank you, @Korijn & @gvanrossum. šŸ˜„ @agjohnson - thank you for the expanded description. I will try to get something working & ask for further guidance in case I get stuck!

@agjohnson, I’d like to take this up!

Has anyone made progresses on this?

How can I help?

I can develop this myself if you wish. I simply need someone to update the description.

Apparently the notification process is already a task so I should just have to wire things in order to have notifications on build queue/startup/finish, right?

I was thinking about making a Gitter integration for Read the Docs but I saw that there was only the failure notification. It would be really nice if we could implement this then we could have all build status appear in Gitter activity tab just like for Travis or others.

[Edit] I can also update the doc according to this functionnality if I implement it!

[Edit 02.11.2018] @agjohnson is this idea still alive?