diff --git a/manifests/site.pp b/manifests/site.pp index 395187bdaf..673a6c0039 100644 --- a/manifests/site.pp +++ b/manifests/site.pp @@ -48,6 +48,13 @@ node "gerrit.openstack.org" { class { 'gerrit': canonicalweburl => "https://review.openstack.org/", email => "review@openstack.org", + github_projects => [ { + name => 'openstack/keystone', + close_pull => 'true' + }, { + name => 'openstack/glance', + close_pull => 'true' + } ] } class { 'iptables': @@ -60,6 +67,10 @@ node "gerrit-dev.openstack.org" { class { 'gerrit': canonicalweburl => "https://review-dev.openstack.org/", email => "review-dev@openstack.org", + github_projects => [ { + name => 'gtest-org/gerrit', + close_pull => 'true' + } ] } class { 'iptables': diff --git a/modules/gerrit/manifests/init.pp b/modules/gerrit/manifests/init.pp index 90b32694d3..89e1c48eb9 100644 --- a/modules/gerrit/manifests/init.pp +++ b/modules/gerrit/manifests/init.pp @@ -1,14 +1,55 @@ class gerrit($canonicalweburl='', - $openidssourl="https://login.launchpad.net/+openid", - $email='', - $commentlinks = [ { name => 'launchpad', - match => '([Bb]ug|[Ll][Pp])\\s*[#:]?\\s*(\\d+)', - link => 'https://code.launchpad.net/bugs/$2' } ] - ) { - +$openidssourl="https://login.launchpad.net/+openid", +$email='', +$github_projects = [], +$commentlinks = [ { name => 'launchpad', + match => '([Bb]ug|[Ll][Pp])\\s*[#:]?\\s*(\\d+)', + link => 'https://code.launchpad.net/bugs/$2' } ] + ) { + + package { "python-dev": + ensure => latest + } + package { "python-pip": + ensure => latest, + require => Package[python-dev] + } + package { "github2": + ensure => latest, + provider => pip, + require => Package[python-pip] + } + if $gerrit_installed { #notice('Gerrit is installed') + cron { "gerritupdateci": + user => gerrit2, + minute => "*/15", + command => "sleep $((RANDOM%60)) && cd /home/gerrit2/openstack-ci && /usr/bin/git pull -q origin master" + } + + cron { "gerritsyncusers": + user => gerrit2, + minute => "*/15", + command => "sleep $((RANDOM%60+60)) && cd /home/gerrit2/openstack-ci && python gerrit/update_gerrit_users.py" + } + + cron { "gerritclosepull": + user => gerrit2, + minute => "*/5", + command => "sleep $((RANDOM%60+90)) && cd /home/gerrit2/openstack-ci && python gerrit/close_pull_requests.py" + } + + file { '/home/gerrit2/github.config': + owner => 'root', + group => 'root', + mode => 444, + ensure => 'present', + content => template('gerrit/github.config.erb'), + replace => 'true', + } + file { '/home/gerrit2/review_site/etc/replication.config': owner => 'root', group => 'root', diff --git a/modules/gerrit/templates/github.config.erb b/modules/gerrit/templates/github.config.erb new file mode 100644 index 0000000000..6a55734f35 --- /dev/null +++ b/modules/gerrit/templates/github.config.erb @@ -0,0 +1,7 @@ +# This file is managed by puppet. +# https://github.com/openstack/openstack-ci-puppet + +<% github_projects.each do |project| -%> +[project "<%= project['name'] %>"] +close_pull = <%= project['close_pull'] %> +<% end -%>