mirror of
https://github.com/zulip/zulip.git
synced 2026-06-03 21:01:43 +08:00
webhooks/dbt: Rename "DBT" to "dbt".
Some checks failed
API Documentation Update Check / check-feature-level-updated (push) Has been cancelled
Code scanning / CodeQL (push) Has been cancelled
Zulip production suite / Ubuntu 22.04 production build (push) Has been cancelled
Zulip CI / ${{ matrix.name }} (zulip/ci:bookworm, true, false, Debian 12 (Python 3.11, backend + documentation), bookworm) (push) Has been cancelled
Zulip CI / ${{ matrix.name }} (zulip/ci:jammy, false, true, Ubuntu 22.04 (Python 3.10, backend + frontend), jammy) (push) Has been cancelled
Zulip CI / ${{ matrix.name }} (zulip/ci:noble, false, false, Ubuntu 24.04 (Python 3.12, backend), noble) (push) Has been cancelled
Zulip CI / ${{ matrix.name }} (zulip/ci:resolute, false, false, Ubuntu 26.04 (Python 3.14, backend), resolute) (push) Has been cancelled
Zulip CI / ${{ matrix.name }} (zulip/ci:trixie, false, false, Debian 13 (Python 3.13, backend), trixie) (push) Has been cancelled
API Documentation Update Check / notify-if-api-docs-changed (push) Has been cancelled
Zulip production suite / ${{ matrix.name }} (zulip/ci:bookworm, --test-custom-db, Debian 12 production install with custom db name and user, bookworm) (push) Has been cancelled
Zulip production suite / ${{ matrix.name }} (zulip/ci:jammy, , Ubuntu 22.04 production install and PostgreSQL upgrade with pgroonga, jammy) (push) Has been cancelled
Zulip production suite / ${{ matrix.name }} (zulip/ci:noble, , Ubuntu 24.04 production install, noble) (push) Has been cancelled
Zulip production suite / ${{ matrix.name }} (zulip/ci:resolute, , Ubuntu 26.04 production install, resolute) (push) Has been cancelled
Zulip production suite / ${{ matrix.name }} (zulip/ci:trixie, , Debian 13 production install, trixie) (push) Has been cancelled
Zulip production suite / ${{ matrix.name }} (zulip/ci:bookworm-7.0, 7.0 Version Upgrade, bookworm) (push) Has been cancelled
Zulip production suite / ${{ matrix.name }} (zulip/ci:bookworm-8.0, 8.0 Version Upgrade, bookworm) (push) Has been cancelled
Zulip production suite / ${{ matrix.name }} (zulip/ci:jammy-6.0, 6.0 Version Upgrade, jammy) (push) Has been cancelled
Zulip production suite / ${{ matrix.name }} (zulip/ci:noble-10.0, 10.0 Version Upgrade, noble) (push) Has been cancelled
Zulip production suite / ${{ matrix.name }} (zulip/ci:noble-9.0, 9.0 Version Upgrade, noble) (push) Has been cancelled
Zulip production suite / ${{ matrix.name }} (zulip/ci:trixie-11.0, 11.0 Version Upgrade, trixie) (push) Has been cancelled
Zulip production suite / Required jobs (push) Has been cancelled
Zulip CI / Required jobs (push) Has been cancelled
Some checks failed
API Documentation Update Check / check-feature-level-updated (push) Has been cancelled
Code scanning / CodeQL (push) Has been cancelled
Zulip production suite / Ubuntu 22.04 production build (push) Has been cancelled
Zulip CI / ${{ matrix.name }} (zulip/ci:bookworm, true, false, Debian 12 (Python 3.11, backend + documentation), bookworm) (push) Has been cancelled
Zulip CI / ${{ matrix.name }} (zulip/ci:jammy, false, true, Ubuntu 22.04 (Python 3.10, backend + frontend), jammy) (push) Has been cancelled
Zulip CI / ${{ matrix.name }} (zulip/ci:noble, false, false, Ubuntu 24.04 (Python 3.12, backend), noble) (push) Has been cancelled
Zulip CI / ${{ matrix.name }} (zulip/ci:resolute, false, false, Ubuntu 26.04 (Python 3.14, backend), resolute) (push) Has been cancelled
Zulip CI / ${{ matrix.name }} (zulip/ci:trixie, false, false, Debian 13 (Python 3.13, backend), trixie) (push) Has been cancelled
API Documentation Update Check / notify-if-api-docs-changed (push) Has been cancelled
Zulip production suite / ${{ matrix.name }} (zulip/ci:bookworm, --test-custom-db, Debian 12 production install with custom db name and user, bookworm) (push) Has been cancelled
Zulip production suite / ${{ matrix.name }} (zulip/ci:jammy, , Ubuntu 22.04 production install and PostgreSQL upgrade with pgroonga, jammy) (push) Has been cancelled
Zulip production suite / ${{ matrix.name }} (zulip/ci:noble, , Ubuntu 24.04 production install, noble) (push) Has been cancelled
Zulip production suite / ${{ matrix.name }} (zulip/ci:resolute, , Ubuntu 26.04 production install, resolute) (push) Has been cancelled
Zulip production suite / ${{ matrix.name }} (zulip/ci:trixie, , Debian 13 production install, trixie) (push) Has been cancelled
Zulip production suite / ${{ matrix.name }} (zulip/ci:bookworm-7.0, 7.0 Version Upgrade, bookworm) (push) Has been cancelled
Zulip production suite / ${{ matrix.name }} (zulip/ci:bookworm-8.0, 8.0 Version Upgrade, bookworm) (push) Has been cancelled
Zulip production suite / ${{ matrix.name }} (zulip/ci:jammy-6.0, 6.0 Version Upgrade, jammy) (push) Has been cancelled
Zulip production suite / ${{ matrix.name }} (zulip/ci:noble-10.0, 10.0 Version Upgrade, noble) (push) Has been cancelled
Zulip production suite / ${{ matrix.name }} (zulip/ci:noble-9.0, 9.0 Version Upgrade, noble) (push) Has been cancelled
Zulip production suite / ${{ matrix.name }} (zulip/ci:trixie-11.0, 11.0 Version Upgrade, trixie) (push) Has been cancelled
Zulip production suite / Required jobs (push) Has been cancelled
Zulip CI / Required jobs (push) Has been cancelled
This commit is contained in:
parent
94315ab635
commit
ac97afa408
Binary file not shown.
|
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 57 KiB |
@ -599,9 +599,9 @@ INCOMING_WEBHOOK_INTEGRATIONS: list[IncomingWebhookIntegration] = [
|
||||
"dbt",
|
||||
["deployment"],
|
||||
[WebhookScreenshotConfig("job_run_completed_errored.json")],
|
||||
display_name="DBT",
|
||||
display_name="dbt",
|
||||
url_options=[
|
||||
WebhookUrlOption(name="access_url", label="DBT Access URL", input_type="text")
|
||||
WebhookUrlOption(name="access_url", label="dbt Access URL", input_type="text")
|
||||
],
|
||||
),
|
||||
IncomingWebhookIntegration(
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# Zulip DBT integration
|
||||
# Zulip dbt integration
|
||||
|
||||
Get notifications about DBT cloud job runs in Zulip!
|
||||
Get notifications about dbt cloud job runs in Zulip!
|
||||
|
||||
{start_tabs}
|
||||
|
||||
@ -8,11 +8,11 @@ Get notifications about DBT cloud job runs in Zulip!
|
||||
|
||||
1. {!generate-webhook-url-basic.md!}
|
||||
|
||||
If you'd like your notification messages to link to your DBT job
|
||||
runs, make sure you include the [**DBT Access URL**][DBT Access URLs]
|
||||
If you'd like your notification messages to link to your dbt job
|
||||
runs, make sure you include the [**dbt Access URL**][dbt Access URLs]
|
||||
when generating the integration URL.
|
||||
|
||||
1. From your DBT Dashboard, navigate to **Account settings**. Select
|
||||
1. From your dbt Dashboard, navigate to **Account settings**. Select
|
||||
**Notification Settings**, go to the **Webhooks** section, and
|
||||
click **Create webhook**.
|
||||
|
||||
@ -33,8 +33,8 @@ Get notifications about DBT cloud job runs in Zulip!
|
||||
|
||||
### Related documentation
|
||||
|
||||
- [DBT's webhooks documentation](https://docs.getdbt.com/docs/deploy/webhooks)
|
||||
- [DBT Access URLs][DBT Access URLs]
|
||||
- [dbt's webhooks documentation](https://docs.getdbt.com/docs/deploy/webhooks)
|
||||
- [dbt Access URLs][dbt Access URLs]
|
||||
{!webhooks-url-specification.md!}
|
||||
|
||||
[DBT Access URLs]: https://docs.getdbt.com/docs/cloud/about-cloud/access-regions-ip-addresses#api-access-urls
|
||||
[dbt Access URLs]: https://docs.getdbt.com/docs/cloud/about-cloud/access-regions-ip-addresses#api-access-urls
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
|
||||
|
||||
class DBTHookTests(WebhookTestCase):
|
||||
class DbtHookTests(WebhookTestCase):
|
||||
def test_dbt_webhook_when_job_started(self) -> None:
|
||||
expected_message = """:yellow_circle: Daily Job (dbt build) deployment started in **Production**.\n
|
||||
Job #123 was kicked off from the UI by bwilliams@example.com at <time:2023-01-31T19:28:07Z>."""
|
||||
@ -23,7 +23,7 @@ Job #123 was kicked off from the UI by bwilliams@example.com at <time:2023-01-31
|
||||
self.check_webhook("job_run_errored", "Example Project", expected_message)
|
||||
|
||||
|
||||
class DBTHookWithAccessUrlTests(WebhookTestCase):
|
||||
class DbtHookWithAccessUrlTests(WebhookTestCase):
|
||||
URL_TEMPLATE = "/api/v1/external/dbt?&api_key={api_key}&stream={stream}&access_url=https%3A%2F%2Fexample.us1.dbt.com"
|
||||
|
||||
def test_dbt_webhook_with_valid_access_url(self) -> None:
|
||||
|
||||
@ -9,13 +9,13 @@ 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
|
||||
|
||||
DBT_NOTIFICATION_TEMPLATE = """
|
||||
NOTIFICATION_TEMPLATE = """
|
||||
{emoji} {job_name} {run_text} {status} in **{environment}**.
|
||||
|
||||
{job_text} was {run_reason} at <time:{start_time}>.
|
||||
"""
|
||||
|
||||
DBT_EVENT_TYPE_MAPPER = {
|
||||
EVENT_TYPE_MAPPER = {
|
||||
"job.run.started": {
|
||||
"running": (":yellow_circle:", "started"),
|
||||
},
|
||||
@ -28,7 +28,7 @@ DBT_EVENT_TYPE_MAPPER = {
|
||||
},
|
||||
}
|
||||
|
||||
ALL_EVENT_TYPES = list(DBT_EVENT_TYPE_MAPPER.keys())
|
||||
ALL_EVENT_TYPES = list(EVENT_TYPE_MAPPER.keys())
|
||||
|
||||
|
||||
def extract_data_from_payload(payload: JsonBodyPayload[WildValue]) -> dict[str, str]:
|
||||
@ -52,7 +52,7 @@ def extract_data_from_payload(payload: JsonBodyPayload[WildValue]) -> dict[str,
|
||||
|
||||
|
||||
def get_job_run_body(data: dict[str, str], access_url: str | None) -> str:
|
||||
emoji, status = DBT_EVENT_TYPE_MAPPER[data["event_type"]][data["run_status"]]
|
||||
emoji, status = EVENT_TYPE_MAPPER[data["event_type"]][data["run_status"]]
|
||||
|
||||
project_url = (
|
||||
urljoin(
|
||||
@ -69,7 +69,7 @@ def get_job_run_body(data: dict[str, str], access_url: str | None) -> str:
|
||||
)
|
||||
run_text = f"[deployment]({project_url}/runs/{data['run_id']})" if project_url else "deployment"
|
||||
|
||||
body = DBT_NOTIFICATION_TEMPLATE.format(
|
||||
body = NOTIFICATION_TEMPLATE.format(
|
||||
emoji=emoji,
|
||||
status=status,
|
||||
run_text=run_text,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user