snapshot of https://github.com/zulip/zulip.git @ 48c69911c7dd4e03b20552eb3bd77ad8151c1357 (2026-09-15)
Some checks failed
Code scanning / CodeQL (push) Failing after 15s
Zulip production suite / Ubuntu 22.04 production build (push) Failing after 26s
Zulip production suite / Debian 12 production install with custom db name and user (push) Has been skipped
Zulip production suite / Ubuntu 22.04 production install and PostgreSQL upgrade with pgroonga (push) Has been skipped
Zulip production suite / Ubuntu 24.04 production install (push) Has been skipped
Zulip production suite / Ubuntu 26.04 production install (push) Has been skipped
Zulip production suite / Debian 13 production install (push) Has been skipped
Zulip production suite / 7.0 Version Upgrade (push) Has been skipped
Zulip production suite / 8.0 Version Upgrade (push) Has been skipped
Zulip production suite / 6.0 Version Upgrade (push) Has been skipped
Zulip production suite / 10.0 Version Upgrade (push) Has been skipped
Zulip production suite / 9.0 Version Upgrade (push) Has been skipped
Zulip production suite / 12.0 Version Upgrade (push) Has been skipped
Zulip production suite / 11.0 Version Upgrade (push) Has been skipped
GitHub Actions Security Analysis with zizmor / zizmor (push) Failing after 3s
Zulip CI / Debian 12 (Python 3.11, backend + documentation) (push) Failing after 26s
Zulip CI / Ubuntu 22.04 (Python 3.10, backend + frontend) (push) Failing after 3s
Zulip CI / Ubuntu 24.04 (Python 3.12, backend) (push) Failing after 25s
Zulip CI / Ubuntu 26.04 (Python 3.14, backend) (push) Failing after 25s
Zulip CI / Debian 13 (Python 3.13, backend) (push) Failing after 28s
Zulip production suite / Required jobs (push) Has been cancelled
Zulip CI / Required jobs (push) Has been cancelled
API Documentation Update Check / check-feature-level-updated (push) Has been cancelled
API Documentation Update Check / notify-if-api-docs-changed (push) Has been cancelled

This commit is contained in:
upstream-mirror
2026-09-15 15:05:30 +05:00
commit 64898b2c79
8999 changed files with 1757358 additions and 0 deletions

View File

View File

@@ -0,0 +1,29 @@
Get Zulip notifications for your Buildbot builds!
!!! tip ""
This integration requires Buildbot version 2.2.0 or higher.
1. {!create-channel.md!}
1. {!create-an-incoming-webhook.md!}
1. Edit the Buildbot configuration file to add a new Zulip reporter
([or follow the steps listed here][1]):
from buildbot.plugins import reporters
zs = reporters.ZulipStatusPush('{{ zulip_url }}',
token='api_key',
stream='buildbot')
c['services'].append(zs)
When adding the new reporter, modify the code above such that `api_key`
is the API key of your Zulip bot, and `stream` is set to the channel name
you want the notifications sent to.
[1]: https://docs.buildbot.net/latest/manual/configuration/reporters/zulip_status.html
{!congrats.md!}
![](/static/images/integrations/buildbot/001.png)

View File

@@ -0,0 +1,9 @@
{
"timestamp":1558960446,
"buildid":10434,
"project":"zulip\/zulip-zapier",
"results":6,
"url":"https:\/\/ci.example.org\/#builders\/79\/builds\/307",
"event":"finished",
"buildername":"AMD64 Ubuntu 18.04 Python 3"
}

View File

@@ -0,0 +1,9 @@
{
"event": "finished",
"buildid": 34,
"buildername": "runtests",
"url": "http://exampleurl.com/#builders/1/builds/34",
"project": "",
"timestamp": 1553911142,
"results": 2
}

View File

@@ -0,0 +1,9 @@
{
"event": "finished",
"buildid": 33,
"buildername": "runtests",
"url": "http://exampleurl.com/#builders/1/builds/33",
"project": "buildbot-hello",
"timestamp": 1553910552,
"results": 0
}

View File

@@ -0,0 +1,8 @@
{
"event": "new",
"buildid": 33,
"buildername": "runtests",
"url": "http://exampleurl.com/#builders/1/builds/33",
"project": "buildbot-hello",
"timestamp": 1553910544
}

View File

@@ -0,0 +1,25 @@
from zerver.lib.test_classes import WebhookTestCase
class BuildbotHookTests(WebhookTestCase):
def test_build_started(self) -> None:
expected_topic_name = "buildbot-hello"
expected_message = (
"Build [#33](http://exampleurl.com/#builders/1/builds/33) for **runtests** started."
)
self.check_webhook("started", expected_topic_name, expected_message)
def test_build_success(self) -> None:
expected_topic_name = "buildbot-hello"
expected_message = "Build [#33](http://exampleurl.com/#builders/1/builds/33) (result: success) for **runtests** finished."
self.check_webhook("finished_success", expected_topic_name, expected_message)
def test_build_failure(self) -> None:
expected_topic_name = "general" # project key is empty
expected_message = "Build [#34](http://exampleurl.com/#builders/1/builds/34) (result: failure) for **runtests** finished."
self.check_webhook("finished_failure", expected_topic_name, expected_message)
def test_build_cancelled(self) -> None:
expected_topic_name = "zulip/zulip-zapier"
expected_message = "Build [#10434](https://ci.example.org/#builders/79/builds/307) (result: cancelled) for **AMD64 Ubuntu 18.04 Python 3** finished."
self.check_webhook("finished_cancelled", expected_topic_name, expected_message)

View File

@@ -0,0 +1,52 @@
from django.http import HttpRequest, HttpResponse
from zerver.decorator import webhook_view
from zerver.lib.response import json_success
from zerver.lib.typed_endpoint import JsonBodyPayload, typed_endpoint
from zerver.lib.validator import WildValue, check_int, check_string
from zerver.lib.webhooks.common import check_send_webhook_message
from zerver.models import UserProfile
ALL_EVENT_TYPES = ["new", "finished"]
@webhook_view("Buildbot", all_event_types=ALL_EVENT_TYPES)
@typed_endpoint
def api_buildbot_webhook(
request: HttpRequest,
user_profile: UserProfile,
*,
payload: JsonBodyPayload[WildValue],
) -> HttpResponse:
topic_name = payload["project"].tame(check_string)
if not topic_name:
topic_name = "general"
body = get_message(payload)
check_send_webhook_message(
request, user_profile, topic_name, body, payload["event"].tame(check_string)
)
return json_success(request)
def get_message(payload: WildValue) -> str:
if "results" in payload:
# See http://docs.buildbot.net/latest/developer/results.html
results = ("success", "warnings", "failure", "skipped", "exception", "retry", "cancelled")
status = results[payload["results"].tame(check_int)]
event = payload["event"].tame(check_string)
if event == "new":
body = "Build [#{id}]({url}) for **{name}** started.".format(
id=payload["buildid"].tame(check_int),
name=payload["buildername"].tame(check_string),
url=payload["url"].tame(check_string),
)
elif event == "finished":
body = "Build [#{id}]({url}) (result: {status}) for **{name}** finished.".format(
id=payload["buildid"].tame(check_int),
name=payload["buildername"].tame(check_string),
url=payload["url"].tame(check_string),
status=status,
)
return body