##// END OF EJS Templates
integrations: register dummy jenkins integrations.
marcink -
r2578:ebd41bed default
parent child Browse files
Show More
@@ -1,68 +1,70 b''
1 1 # -*- coding: utf-8 -*-
2 2
3 3 # Copyright (C) 2012-2018 RhodeCode GmbH
4 4 #
5 5 # This program is free software: you can redistribute it and/or modify
6 6 # it under the terms of the GNU Affero General Public License, version 3
7 7 # (only), as published by the Free Software Foundation.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU Affero General Public License
15 15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 16 #
17 17 # This program is dual-licensed. If you wish to learn more about the
18 18 # RhodeCode Enterprise Edition, including its added features, Support services,
19 19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20 20
21 21 import logging
22 22
23 23 from rhodecode.integrations.registry import IntegrationTypeRegistry
24 24 from rhodecode.integrations.types import webhook, slack, hipchat, email, base
25 25 log = logging.getLogger(__name__)
26 26
27 27
28 28 # TODO: dan: This is currently global until we figure out what to do about
29 29 # VCS's not having a pyramid context - move it to pyramid app configuration
30 30 # includeme level later to allow per instance integration setup
31 31 integration_type_registry = IntegrationTypeRegistry()
32 32
33 33 integration_type_registry.register_integration_type(
34 34 webhook.WebhookIntegrationType)
35 35 integration_type_registry.register_integration_type(
36 36 slack.SlackIntegrationType)
37 37 integration_type_registry.register_integration_type(
38 38 hipchat.HipchatIntegrationType)
39 39 integration_type_registry.register_integration_type(
40 40 email.EmailIntegrationType)
41 41
42 42
43 43 # dummy EE integration to show users what we have in EE edition
44 44 integration_type_registry.register_integration_type(
45 45 base.EEIntegration('Jira Issues integration', 'jira'))
46 46 integration_type_registry.register_integration_type(
47 47 base.EEIntegration('Redmine Tracker integration', 'redmine'))
48 integration_type_registry.register_integration_type(
49 base.EEIntegration('Jenkins CI integration', 'jenkins'))
48 50
49 51
50 52 def integrations_event_handler(event):
51 53 """
52 54 Takes an event and passes it to all enabled integrations
53 55 """
54 56 from rhodecode.model.integration import IntegrationModel
55 57
56 58 integration_model = IntegrationModel()
57 59 integrations = integration_model.get_for_event(event)
58 60 for integration in integrations:
59 61 try:
60 62 integration_model.send_event(integration, event)
61 63 except Exception:
62 64 log.exception(
63 65 'failure occurred when sending event %s to integration %s' % (
64 66 event, integration))
65 67
66 68
67 69 def includeme(config):
68 70 config.include('rhodecode.integrations.routes')
General Comments 0
You need to be logged in to leave comments. Login now