integrations: Remove Solano integration.

This commit is contained in:
Niloth P 2024-07-20 15:25:33 +05:30 committed by Tim Abbott
parent de430f541c
commit 16abd82fa5
10 changed files with 0 additions and 244 deletions

View File

@ -123,7 +123,6 @@ not_yet_fully_covered = [
# Webhook integrations with incomplete coverage
"zerver/webhooks/greenhouse/view.py",
"zerver/webhooks/jira/view.py",
"zerver/webhooks/solano/view.py",
"zerver/webhooks/teamcity/view.py",
"zerver/webhooks/travis/view.py",
"zerver/webhooks/zapier/view.py",

View File

@ -472,7 +472,6 @@ WEBHOOK_INTEGRATIONS: list[WebhookIntegration] = [
logo="images/integrations/logos/slack.svg",
),
WebhookIntegration("slack", ["communication"]),
WebhookIntegration("solano", ["continuous-integration"], display_name="Solano Labs"),
WebhookIntegration("sonarqube", ["continuous-integration"], display_name="SonarQube"),
WebhookIntegration("sonarr", ["entertainment"], display_name="Sonarr"),
WebhookIntegration("splunk", ["monitoring"], display_name="Splunk"),
@ -805,7 +804,6 @@ DOC_SCREENSHOT_CONFIG: dict[str, list[BaseScreenshotConfig]] = {
ScreenshotConfig("issue_assigned_to_team.json", "002.png"),
],
"slack": [ScreenshotConfig("message_info.txt")],
"solano": [ScreenshotConfig("build_001.json")],
"sonarqube": [ScreenshotConfig("error.json")],
"sonarr": [ScreenshotConfig("sonarr_episode_grabbed.json")],
"splunk": [ScreenshotConfig("search_one_result.json")],

View File

@ -1,25 +0,0 @@
Get Zulip notifications for your Solano CI builds!
1. {!create-channel.md!}
1. {!create-an-incoming-webhook.md!}
1. {!generate-integration-url.md!}
1. Go to your Solano CI **Organizations** page, and click on
**Organization Settings**. Click on **Web Hooks**.
1. Under **Add a Web Hook**, provide the URL constructed above.
Set **Repo** to the repository you'd like to be notified about.
Leave the **Username** and **Password** fields blank, and click
**Add Web Hook**.
!!! tip ""
For more information, see [Solano Labs' Web Hook documentation][1].
[1]: http://docs.solanolabs.com/Setup/webhooks/#build-notification-web-hooks-outgoing
{!congrats.md!}
![](/static/images/integrations/solano/001.png)

View File

@ -1 +0,0 @@
{"event":"first-fail","timestamp":"2016-12-31T13:31:31+00:00","session":3316175,"profile_name":"default","url":"https://ci.solanolabs.com:443/reports/3316175","commit_id":"5f438401eb7cc7268cbc28438bfa70bb99f48a03","committers":["solano-ci[bot]@users.noreply.github.com"],"status":"failed","counts":{"notstarted":0,"started":48,"aborted":0,"passed":10,"failed":1,"pending":1,"skipped":0,"error":0},"workers":4,"timing":{"ci_received_at":1483191022.138977,"queue_first_seen_at":"1483191025.159813","queue_first_allowed_at":"1483191025.4943628","workers_assigned_at":"1483191025.9718277","setup":{"timestamp":1483191031.0,"has_failure":false},"setup_cache":{"timestamp":1483191033.0,"has_failure":false},"package_setup":{"timestamp":1483191035.0,"has_failure":false},"services_setup":{"timestamp":1483191080.0,"has_failure":false},"setup_hooks":{"timestamp":1483191082.0,"has_failure":false},"worker_hooks":{"timestamp":1483191082.0,"has_failure":false},"setup_post_hooks":{"timestamp":1483191082.0,"has_failure":false},"exec":{"timestamp":1483191083.0,"has_failure":false}},"branch":"master","ref":"refs/heads/master","repository":{"name":"solano","url":"ssh://git@github.com/fazerlicourice7/solano","org_name":"fazerlicourice7"},"gen":1,"xid":"6b2d0793e"}

View File

@ -1 +0,0 @@
{"event":"stop","timestamp":"2016-12-31T23:28:45Z","session":3316723,"profile_name":"default","url":"https://ci.solanolabs.com:443/reports/3316723","commit_id":"5d0b92e26448a9e91db794bfed4b8c3556eabc4e", "commiters":["random.user@email.com"],"status":"failed","counts":{"notstarted":0,"started":0,"aborted":0,"passed":0,"failed":0,"pending":0,"skipped":0,"error":0},"workers":0,"timing":{"ci_received_at":1483226288.415732,"queue_first_seen_at":"1483226306.774112","queue_first_allowed_at":"1483226307.247373","workers_assigned_at":"1483226307.9570494","setup":{"timestamp":1483226315.0,"has_failure":false},"post_build":{"timestamp":1483226316.0,"has_failure":false},"worker_rendezvous":{"timestamp":1483226316.0,"has_failure":false},"post_build_hook":{"timestamp":1483226925.0,"has_failure":false},"artifact_collect":{"timestamp":1483226925.0,"has_failure":false},"capture_cache":{"timestamp":1483226925.0,"has_failure":false},"done":{"timestamp":1483226925.0,"has_failure":false},"snapshot_creation":{"timestamp":1483226926.0,"has_failure":false}},"branch":"master","ref":"master","repository":{"name":"test","url":"ssh://git@bitbucket.org/fazerlicourice7/test","org_name":null},"gen":1,"xid":"522fa9d68"}

View File

@ -1,21 +0,0 @@
{
"event": "received",
"timestamp": "2017-01-02T18:23:06+00:00",
"session": 3317799,
"profile_name": "default",
"url": "https:\/\/ci.solanolabs.com:443\/reports\/3317799",
"commit_id": "191d34f9da8ff7279b051cd68e44223253e18408",
"committers": [
"solano-ci[bot]@users.noreply.github.com"
],
"status": "running",
"branch": "master",
"ref": "refs\/heads\/master",
"repository": {
"name": "scipy",
"url": "ssh:\/\/git@github.com\/anirudhjain75\/scipy",
"org_name": "anirudhjain75"
},
"gen": 1,
"xid": "8c7f63bf9"
}

View File

@ -1,37 +0,0 @@
{
"event": "test",
"timestamp": "2015-08-25T00:58:27Z",
"session": 351279,
"guid": "c946783126c9e74291d24465f0a60",
"url": "https://ci.solanolabs.com/1/reports/351279",
"parent_session": 351278,
"profile_name": "default",
"commit_id": "38d4d2548e85729e138fdba32e08421bb899ba37",
"committers": [],
"status": "passed",
"counts": {
"notstarted": 0,
"started": 0,
"passed": 234.0,
"failed": 0.0,
"pending": 3.0,
"skipped": 0.0,
"error": 0.0
},
"workers": 24,
"stopped_by": "user@mycompany.com",
"timing": {
"ci_received_at": 1475250402.480408,
"queue_first_seen_at": 1475250412.841408,
"queue_first_allowed_at": 1475250492.863428,
"workers_assigned_at": 1475250493.136248
},
"branch": "production",
"ref": "refs/head/production",
"repository": {
"name": "repo_name",
"url": "ssh://git@github.com/organization_name/repo_name",
"org_name": "organization_name"
},
"xid": "372da4f69"
}

View File

@ -1,75 +0,0 @@
from zerver.lib.test_classes import WebhookTestCase
class SolanoHookTests(WebhookTestCase):
CHANNEL_NAME = "solano labs"
URL_TEMPLATE = "/api/v1/external/solano?api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "solano"
def test_solano_message_001(self) -> None:
"""
Build notifications are generated by Solano Labs after build completes.
"""
expected_topic_name = "build update"
expected_message = """
Build update (see [build log](https://ci.solanolabs.com:443/reports/3316175)):
* **Author**: solano-ci[bot]@users.noreply.github.com
* **Commit**: [5f438401eb7](github.com/fazerlicourice7/solano/commit/5f438401eb7cc7268cbc28438bfa70bb99f48a03)
* **Status**: failed :thumbs_down:
""".strip()
self.check_webhook(
"build_001",
expected_topic_name,
expected_message,
content_type="application/x-www-form-urlencoded",
)
def test_solano_message_002(self) -> None:
"""
Build notifications are generated by Solano Labs after build completes.
"""
expected_topic_name = "build update"
expected_message = """
Build update (see [build log](https://ci.solanolabs.com:443/reports/3316723)):
* **Author**: Unknown
* **Commit**: [5d0b92e2644](bitbucket.org/fazerlicourice7/test/commits/5d0b92e26448a9e91db794bfed4b8c3556eabc4e)
* **Status**: failed :thumbs_down:
""".strip()
self.check_webhook(
"build_002",
expected_topic_name,
expected_message,
content_type="application/x-www-form-urlencoded",
)
def test_solano_message_received(self) -> None:
"""
Build notifications are generated by Solano Labs after build completes.
"""
expected_topic_name = "build update"
expected_message = """
Build update (see [build log](https://ci.solanolabs.com:443/reports/3317799)):
* **Author**: solano-ci[bot]@users.noreply.github.com
* **Commit**: [191d34f9da8](github.com/anirudhjain75/scipy/commit/191d34f9da8ff7279b051cd68e44223253e18408)
* **Status**: running :arrows_counterclockwise:
""".strip()
self.check_webhook(
"received",
expected_topic_name,
expected_message,
content_type="application/x-www-form-urlencoded",
)
def test_solano_test_message(self) -> None:
expected_topic_name = "build update"
expected_message = "Solano webhook set up correctly."
self.check_webhook(
"test",
expected_topic_name,
expected_message,
content_type="application/x-www-form-urlencoded",
)

View File

@ -1,81 +0,0 @@
# Webhooks for external integrations.
from django.core.exceptions import ValidationError
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_string
from zerver.lib.webhooks.common import check_send_webhook_message
from zerver.lib.webhooks.git import get_short_sha
from zerver.models import UserProfile
MESSAGE_TEMPLATE = """
Build update (see [build log]({build_log_url})):
* **Author**: {author}
* **Commit**: [{commit_id}]({commit_url})
* **Status**: {status} {emoji}
""".strip()
ALL_EVENT_TYPES = ["first-fail", "stop", "received"]
@webhook_view("SolanoLabs", all_event_types=ALL_EVENT_TYPES)
@typed_endpoint
def api_solano_webhook(
request: HttpRequest,
user_profile: UserProfile,
*,
payload: JsonBodyPayload[WildValue],
) -> HttpResponse:
event = payload["event"].tame(check_string)
topic_name = "build update"
if event == "test":
return handle_test_event(request, user_profile, topic_name)
try:
author = payload["committers"][0].tame(check_string)
except ValidationError:
author = "Unknown"
status = payload["status"].tame(check_string)
build_log = payload["url"].tame(check_string)
repository = payload["repository"]["url"].tame(check_string)
commit_id = payload["commit_id"].tame(check_string)
good_status = ["passed"]
bad_status = ["failed", "error"]
neutral_status = ["running"]
emoji = ""
if status in good_status:
emoji = ":thumbs_up:"
elif status in bad_status:
emoji = ":thumbs_down:"
elif status in neutral_status:
emoji = ":arrows_counterclockwise:"
# If the service is not one of the following, the URL is of the repository home, not the individual
# commit itself.
commit_url = repository.split("@")[1]
if "github" in repository:
commit_url += f"/commit/{commit_id}"
elif "bitbucket" in repository:
commit_url += f"/commits/{commit_id}"
elif "gitlab" in repository:
commit_url += f"/pipelines/{commit_id}"
body = MESSAGE_TEMPLATE.format(
author=author,
build_log_url=build_log,
commit_id=get_short_sha(commit_id),
commit_url=commit_url,
status=status,
emoji=emoji,
)
check_send_webhook_message(request, user_profile, topic_name, body, event)
return json_success(request)
def handle_test_event(request: HttpRequest, user_profile: UserProfile, topic: str) -> HttpResponse:
body = "Solano webhook set up correctly."
check_send_webhook_message(request, user_profile, topic, body)
return json_success(request)