From 02f20ce998f5ec221155ece754169ae59dc85e93 Mon Sep 17 00:00:00 2001
From: "James E. Blair" <jeblair@hp.com>
Date: Tue, 29 May 2012 22:47:59 +0000
Subject: [PATCH] Install Zuul on jenkins.

Change-Id: I732622576c318d82155cdd15c632a57070c2d850
---
 manifests/site.pp                             |  9 +++++
 modules/openstack-ci-config/README            |  1 +
 .../files/zuul/layout.yaml                    | 35 +++++++++++++++++++
 .../files/zuul/logging.conf                   |  1 +
 modules/zuul/manifests/init.pp                | 28 +++++++++++++++
 5 files changed, 74 insertions(+)
 create mode 100644 modules/openstack-ci-config/README
 create mode 100644 modules/openstack-ci-config/files/zuul/layout.yaml
 create mode 100644 modules/openstack-ci-config/files/zuul/logging.conf
 create mode 100644 modules/zuul/manifests/init.pp

diff --git a/manifests/site.pp b/manifests/site.pp
index 117677d8a0..b5be61a1db 100644
--- a/manifests/site.pp
+++ b/manifests/site.pp
@@ -243,6 +243,15 @@ node "jenkins.openstack.org" {
       'swift',
     ]
   }
+  class { 'zuul': }
+  file { "/etc/zuul/layout.yaml":
+    ensure => 'present',
+    source => 'puppet:///modules/openstack-ci-config/zuul/layout.yaml'
+  }
+  file { "/etc/zuul/logging.conf":
+    ensure => 'present',
+    source => 'puppet:///modules/openstack-ci-config/zuul/logging.conf'
+  }
 }
 
 node "jenkins-dev.openstack.org" {
diff --git a/modules/openstack-ci-config/README b/modules/openstack-ci-config/README
new file mode 100644
index 0000000000..5589a02bf2
--- /dev/null
+++ b/modules/openstack-ci-config/README
@@ -0,0 +1 @@
+This file stores config files specific to the OpenStack CI project.
diff --git a/modules/openstack-ci-config/files/zuul/layout.yaml b/modules/openstack-ci-config/files/zuul/layout.yaml
new file mode 100644
index 0000000000..254c3a9b98
--- /dev/null
+++ b/modules/openstack-ci-config/files/zuul/layout.yaml
@@ -0,0 +1,35 @@
+queue:
+  - name: check
+    manager: IndependentQueueManager
+    trigger:
+      - event: patchset-uploaded
+    success:
+      verified: 1
+    failure:
+      verified: -1
+  - name: gate
+    manager: DependentQueueManager
+    trigger:
+      - event: comment-added
+        approval:
+          - approved: 1
+    success:
+      verified: 2
+      submit: true
+    failure:
+      verified: -2
+
+jobs:
+  - name: zuul-merge
+    failure-message: This change was unable to be automatically merged with the current state of the repository. Please rebase your change and upload a new patchset.
+
+projects:
+  - name: openstack-ci/zuul
+    check:
+      - gate-zuul-merge:
+        - gate-zuul-pep8
+        - gate-zuul-pyflakes
+    gate:
+      - gate-zuul-merge:
+        - gate-zuul-pep8
+        - gate-zuul-pyflakes
diff --git a/modules/openstack-ci-config/files/zuul/logging.conf b/modules/openstack-ci-config/files/zuul/logging.conf
new file mode 100644
index 0000000000..9e544d3ace
--- /dev/null
+++ b/modules/openstack-ci-config/files/zuul/logging.conf
@@ -0,0 +1 @@
+#empty for now
diff --git a/modules/zuul/manifests/init.pp b/modules/zuul/manifests/init.pp
new file mode 100644
index 0000000000..b668355e3e
--- /dev/null
+++ b/modules/zuul/manifests/init.pp
@@ -0,0 +1,28 @@
+class zuul ()
+{
+  # if we already have the repo the pull updates
+
+  exec { "update_zuul":
+    command => "git pull --ff-only",
+    cwd => "/opt/zuul",
+    path => "/bin:/usr/bin",
+    onlyif => "test -d /opt/zuul",
+    before => Exec["get_zuul"],
+  }
+
+  # otherwise get a new clone of it
+
+  exec { "get_zuul":
+    command => "git clone https://github.com/openstack-ci/zuul /opt/zuul",
+    path => "/bin:/usr/bin",
+    onlyif => "test ! -d /opt/zuul"
+  }
+
+  exec { "install_zuul":
+    command => "python setup.py install",
+    cwd => "/opt/zuul",
+    path => "/bin:/usr/bin",
+    subscribe => [ Exec["get_zuul"], Exec["update_zuul"] ],
+  }
+
+}