##// END OF EJS Templates
integrations: added explanation into webhook based vars...
marcink -
r2583:89ebc4d4 default
parent child Browse files
Show More
@@ -118,26 +118,26 b' class EEIntegration(IntegrationTypeBase)'
118
118
119 # common vars for url template
119 # common vars for url template
120 CI_URL_VARS = [
120 CI_URL_VARS = [
121 'repo_name',
121 ('event_name', 'Unique name of the event type, e.g pullrequest-update'),
122 'repo_type',
122 ('repo_name', 'Full name of the repository'),
123 'repo_id',
123 ('repo_type', 'VCS type of repository'),
124 'repo_url',
124 ('repo_id', 'Unique id of repository'),
125 ('repo_url', 'Repository url'),
125 # extra repo fields
126 # extra repo fields
126 'extra:<extra_key_name>',
127 ('extra:<extra_key_name>', 'Extra repo variables, read from its settings.'),
127
128
128 # special attrs below that we handle, using multi-call
129 # special attrs below that we handle, using multi-call
129 'branch',
130 ('branch', 'Name of each brach submitted, if any.'),
130 'commit_id',
131 ('commit_id', 'Id of each commit submitted, if any.'),
131
132
132 # pr events vars
133 # pr events vars
133 'pull_request_id',
134 ('pull_request_id', 'Unique ID of the pull request.'),
134 'pull_request_url',
135 ('pull_request_url', 'Pull request url.'),
135 'pull_request_shadow_url',
136 ('pull_request_shadow_url', 'Pull request shadow repo clone url.'),
136
137
137 # user who triggers the call
138 # user who triggers the call
138 'username',
139 ('username', 'User who triggered the call.'),
139 'user_id',
140 ('user_id', 'User id who triggered the call.'),
140
141 ]
141 ]
142
142
143
143
@@ -151,4 +151,4 b' def get_auth(settings):'
151
151
152
152
153 def get_url_vars(url_vars):
153 def get_url_vars(url_vars):
154 return ', '.join('${' + x + '}' for x in url_vars)
154 return ', '.join('${' + key + '}' for key, explanation in url_vars)
@@ -20,7 +20,7 b''
20
20
21 from __future__ import unicode_literals
21 from __future__ import unicode_literals
22 import string
22 import string
23 from collections import OrderedDict
23 import collections
24
24
25 import deform
25 import deform
26 import deform.widget
26 import deform.widget
@@ -42,26 +42,26 b' log = logging.getLogger(__name__)'
42
42
43 # updating this required to update the `common_vars` passed in url calling func
43 # updating this required to update the `common_vars` passed in url calling func
44 WEBHOOK_URL_VARS = [
44 WEBHOOK_URL_VARS = [
45 'repo_name',
45 ('event_name', 'Unique name of the event type, e.g pullrequest-update'),
46 'repo_type',
46 ('repo_name', 'Full name of the repository'),
47 'repo_id',
47 ('repo_type', 'VCS type of repository'),
48 'repo_url',
48 ('repo_id', 'Unique id of repository'),
49 ('repo_url', 'Repository url'),
49 # extra repo fields
50 # extra repo fields
50 'extra:<extra_key_name>',
51 ('extra:<extra_key_name>', 'Extra repo variables, read from its settings.'),
51
52
52 # special attrs below that we handle, using multi-call
53 # special attrs below that we handle, using multi-call
53 'branch',
54 ('branch', 'Name of each brach submitted, if any.'),
54 'commit_id',
55 ('commit_id', 'Id of each commit submitted, if any.'),
55
56
56 # pr events vars
57 # pr events vars
57 'pull_request_id',
58 ('pull_request_id', 'Unique ID of the pull request.'),
58 'pull_request_url',
59 ('pull_request_url', 'Pull request url.'),
59 'pull_request_shadow_url',
60 ('pull_request_shadow_url', 'Pull request shadow repo clone url.'),
60
61
61 # user who triggers the call
62 # user who triggers the call
62 'username',
63 ('username', 'User who triggered the call.'),
63 'user_id',
64 ('user_id', 'User id who triggered the call.'),
64
65 ]
65 ]
66 URL_VARS = get_url_vars(WEBHOOK_URL_VARS)
66 URL_VARS = get_url_vars(WEBHOOK_URL_VARS)
67
67
@@ -84,7 +84,8 b' class WebhookHandler(object):'
84 'repo_id': data['repo']['repo_id'],
84 'repo_id': data['repo']['repo_id'],
85 'repo_url': data['repo']['url'],
85 'repo_url': data['repo']['url'],
86 'username': data['actor']['username'],
86 'username': data['actor']['username'],
87 'user_id': data['actor']['user_id']
87 'user_id': data['actor']['user_id'],
88 'event_name': data['name']
88 }
89 }
89
90
90 extra_vars = {}
91 extra_vars = {}
@@ -98,11 +99,11 b' class WebhookHandler(object):'
98 def repo_push_event_handler(self, event, data):
99 def repo_push_event_handler(self, event, data):
99 url = self.get_base_parsed_template(data)
100 url = self.get_base_parsed_template(data)
100 url_cals = []
101 url_cals = []
101 branch_data = OrderedDict()
102 branch_data = collections.OrderedDict()
102 for obj in data['push']['branches']:
103 for obj in data['push']['branches']:
103 branch_data[obj['name']] = obj
104 branch_data[obj['name']] = obj
104
105
105 branches_commits = OrderedDict()
106 branches_commits = collections.OrderedDict()
106 for commit in data['push']['commits']:
107 for commit in data['push']['commits']:
107 if commit.get('git_ref_change'):
108 if commit.get('git_ref_change'):
108 # special case for GIT that allows creating tags,
109 # special case for GIT that allows creating tags,
General Comments 0
You need to be logged in to leave comments. Login now