From 9f424f39688bc90b31e5166019b7aeb0ddc7b130 Mon Sep 17 00:00:00 2001
From: Antoine Musso <hashar@free.fr>
Date: Mon, 19 Nov 2012 22:59:25 +0100
Subject: [PATCH] zuul: learn the ability to set push_change_refs

push_change_refs controls whether zuul should push its reference back in
Gerrit.  This might not be always wanted, for example on very busy
Gerrit installation that never use the refs/zuul/* hierarchy for any
purpose.

Pushing back to Gerrit is now disabled by default and is explicitly
enabled on OpenStack infrastructure (openstack_project::zuul).

Change-Id: I24111ba4b20ab3d5198fdf7deaf902485260d8a5
Reviewed-on: https://review.openstack.org/16475
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Reviewed-by: Jeremy Stanley <fungi@yuggoth.org>
Approved: Monty Taylor <mordred@inaugust.com>
Reviewed-by: Monty Taylor <mordred@inaugust.com>
Tested-by: Jenkins
---
 modules/openstack_project/manifests/zuul.pp | 13 +++++++------
 modules/zuul/manifests/init.pp              |  3 ++-
 modules/zuul/templates/zuul.conf.erb        |  2 +-
 3 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/modules/openstack_project/manifests/zuul.pp b/modules/openstack_project/manifests/zuul.pp
index 943dc28277..232b05c1f5 100644
--- a/modules/openstack_project/manifests/zuul.pp
+++ b/modules/openstack_project/manifests/zuul.pp
@@ -10,12 +10,13 @@ class openstack_project::zuul(
 ) {
 
   class { '::zuul':
-    jenkins_server => $jenkins_server,
-    jenkins_user   => $jenkins_user,
-    jenkins_apikey => $jenkins_apikey,
-    gerrit_server  => $gerrit_server,
-    gerrit_user    => $gerrit_user,
-    url_pattern    => $url_pattern,
+    jenkins_server   => $jenkins_server,
+    jenkins_user     => $jenkins_user,
+    jenkins_apikey   => $jenkins_apikey,
+    gerrit_server    => $gerrit_server,
+    gerrit_user      => $gerrit_user,
+    url_pattern      => $url_pattern,
+    push_change_refs => true
   }
 
   file { '/etc/zuul/layout.yaml':
diff --git a/modules/zuul/manifests/init.pp b/modules/zuul/manifests/init.pp
index 8e850b6bd0..dd08ffb02a 100644
--- a/modules/zuul/manifests/init.pp
+++ b/modules/zuul/manifests/init.pp
@@ -7,7 +7,8 @@ class zuul (
   $gerrit_user,
   $url_pattern,
   $status_url = "https://${::fqdn}/zuul/status",
-  $git_source_repo = 'https://github.com/openstack-ci/zuul.git'
+  $git_source_repo = 'https://github.com/openstack-ci/zuul.git',
+  $push_change_refs = false
 ) {
   $packages = [
     'python-webob',
diff --git a/modules/zuul/templates/zuul.conf.erb b/modules/zuul/templates/zuul.conf.erb
index a0b96a5118..960cf5559a 100644
--- a/modules/zuul/templates/zuul.conf.erb
+++ b/modules/zuul/templates/zuul.conf.erb
@@ -13,6 +13,6 @@ layout_config=/etc/zuul/layout.yaml
 log_config=/etc/zuul/logging.conf
 state_dir=/var/lib/zuul
 git_dir=/var/lib/zuul/git
-push_change_refs=true
+push_change_refs=<%= push_change_refs %>
 url_pattern=<%= url_pattern %>
 status_url=<%= status_url %>