Merge "Add configurations for gerrit its plugins"

This commit is contained in:
Jenkins 2016-08-03 16:33:54 +00:00 committed by Gerrit Code Review
commit 53ec1731cc
5 changed files with 89 additions and 0 deletions

View File

@ -62,6 +62,34 @@
# Gerrit configuration options; see Gerrit docs.
# commentlinks:
# A list of regexes Gerrit should hyperlink.
# its_plugins:
# A list of its (issue tracking system) plugins to configure.
# Example:
# its_plugins => [
# {
# 'name' => 'its-storyboard',
# 'password' => 'secret_token',
# 'url' => 'https://storyboard.openstack.org',
# },
# ],
#
# its_rules:
# A list of actions to perform on the its.
# Example:
# its_rules => [
# {
# 'name' => 'change_updates',
# 'event_type' => 'patchset-created',
# 'action' => 'add-standard-comment',
# label => [
# {
# 'name' => 'approval-Code-Review',
# 'approvals' => '-2, -1',
# },
# ]
# },
# ]
#
# trackingids:
# A list of regexes to reference external tracking systems.
# war:
@ -205,6 +233,8 @@ class gerrit(
$httpd_maxqueued = '',
$httpd_maxwait = '',
$commentlinks = [],
$its_plugins = [],
$its_rules = [],
$trackingids = [],
$contactstore = false,
$contactstore_appsec = '',
@ -397,6 +427,8 @@ class gerrit(
# - $httpd_maxthreads
# - $httpd_maxqueued
# - $commentlinks
# - $its_plugins
# - $its_rules
# - $trackingids
# - $enable_melody
# - $melody_session
@ -444,6 +476,23 @@ class gerrit(
require => File['/home/gerrit2/review_site/etc'],
}
# setup rules for its (issue tracking system) plugins
file { '/home/gerrit2/review_site/etc/its':
ensure => 'directory',
owner => 'gerrit2',
group => 'gerrit2',
mode => '0644',
require => File['/home/gerrit2/review_site/etc'],
}
file { '/home/gerrit2/review_site/etc/its/actions.config':
ensure => present,
owner => 'gerrit2',
group => 'gerrit2',
mode => '0644',
content => template('gerrit/gerrit.its_rules.erb'),
replace => true,
}
# Set up apache.
# Template uses:

View File

@ -40,6 +40,26 @@ class { '::gerrit':
longLinesThreshold => '20',
rejectTooLong => 'true',
},
its_plugins => [
{
'name' => 'its-storyboard',
'password' => 'secret_token',
'url' => 'https://storyboard.openstack.org',
},
],
its_rules => [
{
'name' => 'change_updates',
'event_type' => 'patchset-created',
'action' => 'add-standard-comment',
label => [
{
'name' => 'approval-Code-Review',
'approvals' => '-2, -1',
},
]
},
]
}
class { '::gerrit::cron': }

View File

@ -141,6 +141,10 @@
html = "<%= commentlink['html'] %>"
<% end -%>
<% end -%>
<% @its_plugins.each do |its_plugin| -%>
[<%= its_plugin['name'] %>]
url = <%= its_plugin['url'] %>
<% end -%>
<% @trackingids.each do |trackingid| -%>
[trackingid "<%= trackingid['name'] %>"]
match = "<%= trackingid['match'] %>"

View File

@ -0,0 +1,12 @@
<% @its_rules.each do |its_rule| -%>
[rule "<%= its_rule['name'] %>"]
action = <%= its_rule['action'] %>
<% unless its_rule['event-type'].nil? -%>
event-type = <%= its_rule['event_type'] %>
<% end -%>
<% unless its_rule['label'].nil? -%>
<% its_rule['label'].each do |its_label| -%>
<%= its_label['name'] %> = <%= its_label['approvals'] %>
<% end -%>
<% end -%>
<% end -%>

View File

@ -3,3 +3,7 @@
[auth]
registerEmailPrivateKey = <%= @email_private_key %>
restTokenPrivateKey = <%= @token_private_key %>
<% @its_plugins.each do |its_plugin| -%>
[<%= its_plugin['name'] %>]
password = <%= its_plugin['password'] %>
<% end -%>