From 1ae208113da0f5318e2aa6f0dda8d8f9597efaeb Mon Sep 17 00:00:00 2001 From: Elizabeth Krumbach Date: Thu, 18 Jul 2013 15:19:07 -0700 Subject: [PATCH] Add replication of git from gerrit to git.o.o Modify gerrit's git replication configuration so that it pulls in from a list of replication targets defined in puppet rather than individually added stanzas. Pull the replicate_github variable from files, since it is no longer required. The replicate_local variable remains because it's used in the apache configuration and for setup of the local replication space for git. Also add the cgit server to the list of servers. Change-Id: I68de89bb216565f1754eb9b192bd437adcbf768b --- modules/gerrit/manifests/init.pp | 4 +-- .../gerrit/templates/replication.config.erb | 30 +++++++++++-------- modules/openstack_project/manifests/gerrit.pp | 4 +-- modules/openstack_project/manifests/review.pp | 26 ++++++++++++++-- .../openstack_project/manifests/review_dev.pp | 18 +++++++++-- 5 files changed, 60 insertions(+), 22 deletions(-) diff --git a/modules/gerrit/manifests/init.pp b/modules/gerrit/manifests/init.pp index eab26428ed..1d2ed192a1 100644 --- a/modules/gerrit/manifests/init.pp +++ b/modules/gerrit/manifests/init.pp @@ -56,8 +56,6 @@ # A public key with which to encrypt contact information # contactstore_url: # A URL for the remote contact store application -# replicate_github: -# A boolean enabling replication to github # replicate_local: # A boolean enabling local replication for apache acceleration # gitweb: @@ -108,8 +106,8 @@ class gerrit( $contactstore_url = '', $enable_melody = false, $melody_session = false, - $replicate_github = false, $replicate_local = false, + $replication = [], $replication_targets = [], $gitweb = true, $testmode = false diff --git a/modules/gerrit/templates/replication.config.erb b/modules/gerrit/templates/replication.config.erb index 8cd4c8e153..c2c918041a 100644 --- a/modules/gerrit/templates/replication.config.erb +++ b/modules/gerrit/templates/replication.config.erb @@ -1,18 +1,22 @@ # This file is managed by puppet. # https://github.com/openstack-infra/config -<% if replicate_github -%> -[remote "github"] -url = git@github.com:${name}.git -authGroup = Anonymous Users -replicatePermissions = false -mirror = true +<% replication.each do |replication| -%> +[remote "<%= replication['name'] %>"] + url = <%= replication['url'] %>${name}.git +<% if replication['replicationDelay'] != nil -%> + replicationDelay = <%= replication['replicationDelay'] %> +<% end -%> +<% if replication['threads'] != nil -%> + threads = <%= replication['threads'] %> +<% end -%> +<% if replication['authGroup'] != nil -%> + authGroup = <%= replication['authGroup'] %> +<% end -%> +<% if replication['replicatePermissions'] != nil -%> + replicatePermissions = <%= replication['replicatePermissions'] %> +<% end -%> +<% if replication['mirror'] != nil -%> + mirror = <%= replication['mirror'] %> <% end -%> - -<% if replicate_local -%> -[remote "local"] -url = file:///var/lib/git/${name}.git -replicationDelay = 0 -threads = 4 -mirror = true <% end -%> diff --git a/modules/openstack_project/manifests/gerrit.pp b/modules/openstack_project/manifests/gerrit.pp index ae7db8c68a..7e878462bd 100644 --- a/modules/openstack_project/manifests/gerrit.pp +++ b/modules/openstack_project/manifests/gerrit.pp @@ -49,8 +49,8 @@ class openstack_project::gerrit ( $mysql_root_password = '', $trivial_rebase_role_id = '', $email_private_key = '', - $replicate_github = true, $replicate_local = true, + $replication = [], $local_git_dir = '/var/lib/git', $cla_description = 'OpenStack Individual Contributor License Agreement', $cla_file = 'static/cla.html', @@ -148,8 +148,8 @@ class openstack_project::gerrit ( mysql_password => $mysql_password, mysql_root_password => $mysql_root_password, email_private_key => $email_private_key, - replicate_github => $replicate_github, replicate_local => $replicate_local, + replication => $replication, testmode => $testmode, require => Class[openstack_project::server], } diff --git a/modules/openstack_project/manifests/review.pp b/modules/openstack_project/manifests/review.pp index e9a2c3fa52..5665c2a5ce 100644 --- a/modules/openstack_project/manifests/review.pp +++ b/modules/openstack_project/manifests/review.pp @@ -53,7 +53,6 @@ class openstack_project::review ( $lp_sync_secret='', $contactstore_appsec='', $contactstore_pubkey='', - $replicate_github=true, $sysadmins = [], $swift_username = '', $swift_password = '' @@ -102,11 +101,34 @@ class openstack_project::review ( mysql_root_password => $mysql_root_password, trivial_rebase_role_id => 'trivial-rebase@review.openstack.org', email_private_key => $email_private_key, - replicate_github => $replicate_github, sysadmins => $sysadmins, swift_username => $swift_username, swift_password => $swift_password, + replication => [ + { + name => 'github', + url => 'git@github.com:', + authGroup => 'Anonymous Users', + replicatePermissions => false, + mirror => true, + }, + { + name => 'local', + url => 'file:///var/lib/git/', + replicationDelay => '0', + threads => '4', + mirror => true, + }, + { + name => 'cgit', + url => 'cgit@git.openstack.org:/var/lib/git/', + replicationDelay => '0', + threads => '4', + mirror => true, + }, + ], } + class { 'gerritbot': nick => 'openstackgerrit', password => $gerritbot_password, diff --git a/modules/openstack_project/manifests/review_dev.pp b/modules/openstack_project/manifests/review_dev.pp index 7c9cb45ea1..9e66aa1e47 100644 --- a/modules/openstack_project/manifests/review_dev.pp +++ b/modules/openstack_project/manifests/review_dev.pp @@ -20,7 +20,6 @@ class openstack_project::review_dev ( $lp_sync_consumer_key = '', $lp_sync_token = '', $lp_sync_secret = '', - $replicate_github = true, $sysadmins = [], $swift_username = '', $swift_password = '' @@ -59,10 +58,25 @@ class openstack_project::review_dev ( trivial_rebase_role_id => 'trivial-rebase@review-dev.openstack.org', email_private_key => $email_private_key, - replicate_github => $replicate_github, sysadmins => $sysadmins, swift_username => $swift_username, swift_password => $swift_password, + replication => [ + { + name => 'github', + url => 'git@github.com:', + authGroup => 'Anonymous Users', + replicatePermissions => false, + mirror => true, + }, + { + name => 'local', + url => 'file:///var/lib/git/', + replicationDelay => '0', + threads => '4', + mirror => true, + }, + ], } file { '/var/log/gerrit_user_sync':