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