mirror of https://github.com/zulip/zulip.git
integrations: Remove deprecated Stash integration.
This commit is contained in:
parent
a267c61cdd
commit
ef2ff9f9a0
Binary file not shown.
Before Width: | Height: | Size: 62 KiB |
Binary file not shown.
Before Width: | Height: | Size: 34 KiB |
Binary file not shown.
Before Width: | Height: | Size: 31 KiB |
Binary file not shown.
Before Width: | Height: | Size: 51 KiB |
Binary file not shown.
Before Width: | Height: | Size: 41 KiB |
|
@ -146,12 +146,6 @@ WEBHOOK_INTEGRATIONS = [
|
|||
WebhookIntegration('basecamp'),
|
||||
WebhookIntegration('bitbucket2', logo='static/images/integrations/logos/bitbucket.svg', display_name='Bitbucket'),
|
||||
WebhookIntegration('bitbucket', display_name='Bitbucket', secondary_line_text='(Enterprise)'),
|
||||
WebhookIntegration(
|
||||
'stash',
|
||||
display_name='Bitbucket Server',
|
||||
secondary_line_text='(Stash)',
|
||||
logo='static/images/integrations/logos/bitbucket.svg'
|
||||
),
|
||||
WebhookIntegration('circleci', display_name='CircleCI'),
|
||||
WebhookIntegration('codeship'),
|
||||
WebhookIntegration('crashlytics'),
|
||||
|
|
|
@ -1,68 +0,0 @@
|
|||
<h4>Stash</h4>
|
||||
|
||||
<p>
|
||||
See what the team is committing to Stash right in Zulip with the Zulip
|
||||
Stash plugin!
|
||||
</p>
|
||||
|
||||
<p>
|
||||
First, create the stream you'd like to use for Stash notifications, and
|
||||
subscribe all interested parties to this stream. We recommend the
|
||||
name <code>commits</code>.
|
||||
</p>
|
||||
|
||||
<p>Next, on your {{ settings_html|safe }}, create a Stash bot.</p>
|
||||
|
||||
<p>Then:</p>
|
||||
|
||||
<ol>
|
||||
<li>
|
||||
<p>
|
||||
Visit the Settings page for the Project that you'd like to generate
|
||||
Zulip notifications. Click the "Hooks" option in the left sidebar, and
|
||||
click "Add Hook" on the resulting page. Click the "Search for hook
|
||||
plugins" link:
|
||||
</p>
|
||||
|
||||
<img class="screenshot" src="/static/images/integrations/stash/001.png"/>
|
||||
</li>
|
||||
<li>
|
||||
<p>
|
||||
On the search results page, look for and install the "Post-Receive
|
||||
WebHook for Stash" plugin:
|
||||
</p>
|
||||
|
||||
<img class="screenshot" src="/static/images/integrations/stash/002.png"/>
|
||||
</li>
|
||||
<li>
|
||||
<p>
|
||||
Return to the Settings page for this Project and click the "Hooks"
|
||||
option in the left sidebar. The newly-installed post-receive webhook
|
||||
plugin is now listed in the "Post-receive" hooks section. Click the
|
||||
edit icon next to the hook to configure it:
|
||||
</p>
|
||||
|
||||
<img class="screenshot" src="/static/images/integrations/stash/003.png"/>
|
||||
</li>
|
||||
<li>
|
||||
<p>
|
||||
Supply the following webhook URL, replacing the bot email address,
|
||||
bot API key, and Zulip stream with the appropriate
|
||||
information. <b>Note:</b> the <code>@</code>-sign in the bot e-mail
|
||||
address must be escaped to <code>%40</code>:
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<code>{{ external_uri_scheme }}<font color="#00A26F">stash-bot%40example.com</font>:<font color="#00A26F">api_key</font>@{{ external_api_path_subdomain }}/v1/external/stash?stream=<font color="#00A26F">commits</font></code>
|
||||
</p>
|
||||
|
||||
<img class="screenshot" src="/static/images/integrations/stash/004.png"/>
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
<p>
|
||||
<b>Congratulations! You're done!</b><br/> When you push to Stash, the
|
||||
team can see these updates in real time in Zulip:
|
||||
</p>
|
||||
|
||||
<img class="screenshot" src="/static/images/integrations/stash/005.png"/>
|
|
@ -1,27 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from typing import Text
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
|
||||
class StashHookTests(WebhookTestCase):
|
||||
STREAM_NAME = 'stash'
|
||||
URL_TEMPLATE = u"/api/v1/external/stash?stream={stream}"
|
||||
|
||||
def test_stash_message(self):
|
||||
# type: () -> None
|
||||
"""
|
||||
Messages are generated by Stash on a `git push`.
|
||||
|
||||
The subject describes the repo and Stash "project". The
|
||||
content describes the commits pushed.
|
||||
"""
|
||||
expected_subject = u"Secret project/Operation unicorn: master"
|
||||
expected_message = """`f259e90` was pushed to **master** in **Secret project/Operation unicorn** with:
|
||||
|
||||
* `f259e90`: Updating poms ..."""
|
||||
self.send_and_test_stream_message('push', expected_subject, expected_message,
|
||||
content_type="application/x-www-form-urlencoded",
|
||||
**self.api_auth(self.TEST_USER_EMAIL))
|
||||
|
||||
def get_body(self, fixture_name):
|
||||
# type: (Text) -> Text
|
||||
return self.fixture_data("stash", fixture_name, file_type="json")
|
|
@ -1,44 +0,0 @@
|
|||
# Webhooks for external integrations.
|
||||
from __future__ import absolute_import
|
||||
|
||||
from django.http import HttpRequest, HttpResponse
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
from zerver.models import get_client
|
||||
from zerver.lib.actions import check_send_message
|
||||
from zerver.lib.response import json_success, json_error
|
||||
from zerver.decorator import REQ, has_request_variables, authenticated_rest_api_view
|
||||
from zerver.models import UserProfile
|
||||
import ujson
|
||||
|
||||
from typing import Any, Dict, Text
|
||||
|
||||
|
||||
@authenticated_rest_api_view(is_webhook=True)
|
||||
@has_request_variables
|
||||
def api_stash_webhook(request, user_profile, payload=REQ(argument_type='body'),
|
||||
stream=REQ(default='commits')):
|
||||
# type: (HttpRequest, UserProfile, Dict[str, Any], Text) -> HttpResponse
|
||||
# We don't get who did the push, or we'd try to report that.
|
||||
try:
|
||||
repo_name = payload["repository"]["name"]
|
||||
project_name = payload["repository"]["project"]["name"]
|
||||
branch_name = payload["refChanges"][0]["refId"].split("/")[-1]
|
||||
commit_entries = payload["changesets"]["values"]
|
||||
commits = [(entry["toCommit"]["displayId"],
|
||||
entry["toCommit"]["message"].split("\n")[0]) for
|
||||
entry in commit_entries]
|
||||
head_ref = commit_entries[-1]["toCommit"]["displayId"]
|
||||
except KeyError as e:
|
||||
return json_error(_("Missing key %s in JSON") % (str(e),))
|
||||
|
||||
subject = "%s/%s: %s" % (project_name, repo_name, branch_name)
|
||||
|
||||
content = "`%s` was pushed to **%s** in **%s/%s** with:\n\n" % (
|
||||
head_ref, branch_name, project_name, repo_name)
|
||||
content += "\n".join("* `%s`: %s" % (
|
||||
commit[0], commit[1]) for commit in commits)
|
||||
|
||||
check_send_message(user_profile, get_client("ZulipStashWebhook"), "stream",
|
||||
[stream], subject, content)
|
||||
return json_success()
|
Loading…
Reference in New Issue