Giuseppe Lavagetto has submitted this change and it was merged.

Change subject: zuul: refactor to use hiera
......................................................................


zuul: refactor to use hiera

The manifests have been written pre hiera.  Migrate to it.

Drop:
  role::zuul::hiera::configuration
  role::zuul::install

Replace 'include ::zuul' with class calls.

Bug: T139527
Change-Id: Ibe39ccc3a482b3aec7d0e8624324be1c809f4cbd
---
A hieradata/common/zuul.yaml
M hieradata/hosts/gallium.yaml
D hieradata/hosts/scandium.yaml
M hieradata/role/common/zuul/merger.yaml
A hieradata/role/common/zuul/server.yaml
M modules/contint/manifests/website.pp
M modules/role/manifests/ci/slave.pp
M modules/role/manifests/ci/slave/browsertests.pp
M modules/role/manifests/ci/slave/labs.pp
M modules/role/manifests/ci/slave/localbrowser.pp
M modules/role/manifests/ci/website.pp
D modules/role/manifests/zuul/configuration.pp
D modules/role/manifests/zuul/install.pp
M modules/role/manifests/zuul/merger.pp
M modules/role/manifests/zuul/server.pp
M modules/zuul/manifests/merger.pp
16 files changed, 65 insertions(+), 119 deletions(-)

Approvals:
  Giuseppe Lavagetto: Verified; Looks good to me, approved



diff --git a/hieradata/common/zuul.yaml b/hieradata/common/zuul.yaml
new file mode 100644
index 0000000..4a31991
--- /dev/null
+++ b/hieradata/common/zuul.yaml
@@ -0,0 +1,5 @@
+zuul::common:
+    gerrit_server: gerrit.wikimedia.org
+    gerrit_user: jenkins-bot
+    url_pattern: 
'https://integration.wikimedia.org/ci/job/{job.name}/{build.number}/console'
+    status_url: 'https://integration.wikimedia.org/zuul/'
diff --git a/hieradata/hosts/gallium.yaml b/hieradata/hosts/gallium.yaml
index 22133eb..b3b343b 100644
--- a/hieradata/hosts/gallium.yaml
+++ b/hieradata/hosts/gallium.yaml
@@ -6,4 +6,3 @@
 ssh::server::explicit_macs: false
 cluster: misc
 contactgroups: 'admins,contint'
-
diff --git a/hieradata/hosts/scandium.yaml b/hieradata/hosts/scandium.yaml
deleted file mode 100644
index ca439b8..0000000
--- a/hieradata/hosts/scandium.yaml
+++ /dev/null
@@ -1,5 +0,0 @@
-admin::groups:
-  - contint-users
-  - contint-admins
-cluster: misc
-contactgroups: 'admins,contint'
diff --git a/hieradata/role/common/zuul/merger.yaml 
b/hieradata/role/common/zuul/merger.yaml
index 466786b..e9195ce 100644
--- a/hieradata/role/common/zuul/merger.yaml
+++ b/hieradata/role/common/zuul/merger.yaml
@@ -1,3 +1,17 @@
 debdeploy::grains:
   debdeploy-zuulmerger:
     value: standard
+
+admin::groups:
+  - contint-users
+  - contint-admins
+cluster: misc
+contactgroups: 'admins,contint'
+
+zuul::merger:
+    gearman_server: '208.80.154.135'  # gallium.wikimedia.org
+    gerrit_ssh_key_file: 'ssh/ci/jenkins-bot_gerrit_id_rsa'
+    git_dir: '/srv/ssd/zuul/git'
+    git_email: "zuul-merger@%{::hostname}"
+    git_name: 'Wikimedia Zuul Merger'
+    zuul_url: "git://%{::fqdn}"
diff --git a/hieradata/role/common/zuul/server.yaml 
b/hieradata/role/common/zuul/server.yaml
new file mode 100644
index 0000000..51128dd
--- /dev/null
+++ b/hieradata/role/common/zuul/server.yaml
@@ -0,0 +1,9 @@
+zuul::server:
+    # ferm defaults to ACCEPT on loopback:
+    gearman_server: 127.0.0.1
+    config_git_branch: master
+    gearman_server_start: true
+    jenkins_server: http://127.0.0.1:8080/ci
+    jenkins_user: zuul-bot
+    # FIXME use a lookup?
+    statsd_host: statsd.eqiad.wmnet
diff --git a/modules/contint/manifests/website.pp 
b/modules/contint/manifests/website.pp
index 6162120..07bcc15 100644
--- a/modules/contint/manifests/website.pp
+++ b/modules/contint/manifests/website.pp
@@ -1,9 +1,7 @@
 # Class for website hosted on the continuous integration server
 # https://integration.mediawiki.org/
 # https://doc.wikimedia.org/
-class contint::website(
-  $zuul_git_dir = '/var/lib/zuul/git'
-){
+class contint::website(){
 
   # Need to send Vary: X-Forwarded-Proto since most sites are forced to HTTPS
   # and behind a varnish cache. See also T62822
diff --git a/modules/role/manifests/ci/slave.pp 
b/modules/role/manifests/ci/slave.pp
index 3d95a62..a04403c 100644
--- a/modules/role/manifests/ci/slave.pp
+++ b/modules/role/manifests/ci/slave.pp
@@ -11,10 +11,10 @@
     system::role { 'role::ci::slave': description => 'CI slave runner' }
 
     include contint::packages
-    include role::zuul::install
-
     require contint::master_dir
 
+    class { '::zuul': }
+
     class { 'jenkins::slave':
         # Master connect to itself via the fqdn / primary IP ipaddress
         ssh_key => "ssh-rsa 
AAAAB3NzaC1yc2EAAAABIwAAAQEA4QGc1Zs/S4s7znEYw7RifTuZ4y4iYvXl5jp5tJA9kGUGzzfL0dc4ZEEhpu+4C/TixZJXqv0N6yke67cM8hfdXnLOVJc4n/Z02uYHQpRDeLAJUAlGlbGZNvzsOLw39dGF0u3YmwDm6rj85RSvGqz8ExbvrneCVJSaYlIRvOEKw0e0FYs8Yc7aqFRV60M6fGzWVaC3lQjSnEFMNGdSiLp3Vl/GB4GgvRJpbNENRrTS3Te9BPtPAGhJVPliTflVYvULCjYVtPEbvabkW+vZznlcVHAZJVTTgmqpDZEHqp4bzyO8rBNhMc7BjUVyNVNC5FCk+D2LagmIriYxjirXDNrWlw==
 jenkins@gallium from=\"${::main_ipaddress}\"",
diff --git a/modules/role/manifests/ci/slave/browsertests.pp 
b/modules/role/manifests/ci/slave/browsertests.pp
index d70191d..5a7d0a4 100644
--- a/modules/role/manifests/ci/slave/browsertests.pp
+++ b/modules/role/manifests/ci/slave/browsertests.pp
@@ -6,9 +6,10 @@
     }
 
     include role::ci::slave::labs::common
-    include role::zuul::install
     include contint::browsertests
 
+    class { '::zuul': }
+
     # For CirrusSearch testing:
     file { '/mnt/elasticsearch':
         ensure => absent,
diff --git a/modules/role/manifests/ci/slave/labs.pp 
b/modules/role/manifests/ci/slave/labs.pp
index 729b35d..71c85c5 100644
--- a/modules/role/manifests/ci/slave/labs.pp
+++ b/modules/role/manifests/ci/slave/labs.pp
@@ -38,7 +38,8 @@
     include contint::php
 
     include role::ci::slave::labs::common
-    include role::zuul::install
+
+    class { '::zuul': }
 
     if os_version('ubuntu >= trusty || debian >= jessie') {
         include role::ci::slave::localbrowser
diff --git a/modules/role/manifests/ci/slave/localbrowser.pp 
b/modules/role/manifests/ci/slave/localbrowser.pp
index 6a51dae..77ca5ef 100644
--- a/modules/role/manifests/ci/slave/localbrowser.pp
+++ b/modules/role/manifests/ci/slave/localbrowser.pp
@@ -6,7 +6,7 @@
     }
 
     include role::ci::slave::labs::common
-    include role::zuul::install
     include contint::browsers
-}
 
+    class { '::zuul': }
+}
diff --git a/modules/role/manifests/ci/website.pp 
b/modules/role/manifests/ci/website.pp
index a19ee4a..58b7720 100644
--- a/modules/role/manifests/ci/website.pp
+++ b/modules/role/manifests/ci/website.pp
@@ -11,9 +11,5 @@
     # Needed at least for the jenkins-slave user
     require ::role::ci::slave
 
-    include role::zuul::configuration
-
-    class { 'contint::website':
-        zuul_git_dir => $role::zuul::configuration::zuul_git_dir,
-    }
+    class { 'contint::website': }
 }
diff --git a/modules/role/manifests/zuul/configuration.pp 
b/modules/role/manifests/zuul/configuration.pp
deleted file mode 100644
index 21ba745..0000000
--- a/modules/role/manifests/zuul/configuration.pp
+++ /dev/null
@@ -1,62 +0,0 @@
-# == Class: role::zuul::configuration
-#
-# Realm based configuration for Zuul roles.
-class role::zuul::configuration {
-
-    $shared = {
-        'production' => {
-            'gerrit_server'       => 'gerrit.wikimedia.org',
-            'gerrit_user'         => 'jenkins-bot',
-            'url_pattern'         => 
'https://integration.wikimedia.org/ci/job/{job.name}/{build.number}/console',
-            'status_url'          => 'https://integration.wikimedia.org/zuul/',
-        },
-        'labs' => {
-            'gerrit_server'       => '127.0.0.1',
-            'gerrit_user'         => 'jenkins',
-            'url_pattern'         => 
'http://integration.wmflabs.org/ci/job/{job.name}/{build.number}/console',
-            'status_url'          => 
'http://integration.wmflabs.org/zuul/status',
-        },
-    }
-
-    $merger = {
-        'production' => {
-            'gearman_server'      => '208.80.154.135',  # gallium.wikimedia.org
-            'gerrit_ssh_key_file' => 'ssh/ci/jenkins-bot_gerrit_id_rsa',
-            'git_dir'             => '/srv/ssd/zuul/git',
-            'git_email'           => "zuul-merger@${::hostname}",
-            'git_name'            => 'Wikimedia Zuul Merger',
-            'zuul_url'            => "git://${::fqdn}",
-        },
-        'labs' => {
-            'gearman_server'      => '127.0.0.1',
-            'gerrit_ssh_key_file' => 'ssh/ci/jenkins-bot_gerrit_id_rsa',
-            # FIXME migrate under /data/project whenever T66868 is solved
-            #   'git_dir'       => '/data/project/zuul/git',
-            'git_dir' => '/srv/zuul/git',
-            'git_email' => "zuul-merger@${::hostname}",
-            'git_name'  => 'Wikimedia Zuul Merger',
-            # FIXME should be $::fqdn
-            'zuul_url'  => 'git://localhost',
-        },
-    }
-
-    $server = {
-        'production' => {
-            'gearman_server'       => '127.0.0.1',  # ferm default to accept 
on loopback
-            'config_git_branch'    => 'master',
-            'gearman_server_start' => true,
-            'jenkins_server'       => 'http://127.0.0.1:8080/ci',
-            'jenkins_user'         => 'zuul-bot',
-            'statsd_host'          => 'statsd.eqiad.wmnet',
-        },
-        'labs' => {
-            'gearman_server'       => '127.0.0.1',
-            'config_git_branch'    => 'labs',
-            'gearman_server_start' => true,
-            'jenkins_server'       => 'http://127.0.0.1:8080/ci',
-            'jenkins_user'         => 'zuul',
-            'statsd_host'          => '',
-        },
-    }
-
-}
diff --git a/modules/role/manifests/zuul/install.pp 
b/modules/role/manifests/zuul/install.pp
deleted file mode 100644
index ec674b7..0000000
--- a/modules/role/manifests/zuul/install.pp
+++ /dev/null
@@ -1,11 +0,0 @@
-# == Class role::zuul::install
-#
-# Wrapper around ::zuul class which is needed by both merger and server roles
-# that can in turn be installed on the same node. Prevent a duplication error.
-#
-class role::zuul::install {
-
-    include role::zuul::configuration
-
-    class { '::zuul': }
-}
diff --git a/modules/role/manifests/zuul/merger.pp 
b/modules/role/manifests/zuul/merger.pp
index 82d9981..b6dbb77 100644
--- a/modules/role/manifests/zuul/merger.pp
+++ b/modules/role/manifests/zuul/merger.pp
@@ -1,29 +1,29 @@
 class role::zuul::merger {
     system::role { 'role::zuul::merger': description => 'Zuul merger' }
 
-    include role::zuul::configuration
-    include role::zuul::install
     include ::zuul::monitoring::merger
 
+    $conf_common = hiera('zuul::common')
+    $conf_merger = hiera('zuul::merger')
     class { '::zuul::merger':
         # Shared settings
-        gerrit_server       => 
$role::zuul::configuration::shared[$::realm]['gerrit_server'],
-        gerrit_user         => 
$role::zuul::configuration::shared[$::realm]['gerrit_user'],
-        url_pattern         => 
$role::zuul::configuration::shared[$::realm]['url_pattern'],
-        status_url          => 
$role::zuul::configuration::shared[$::realm]['status_url'],
+        gerrit_server       => $conf_common['gerrit_server'],
+        gerrit_user         => $conf_common['gerrit_user'],
+        url_pattern         => $conf_common['url_pattern'],
+        status_url          => $conf_common['status_url'],
 
         # Merger related
-        gearman_server      => 
$role::zuul::configuration::merger[$::realm]['gearman_server'],
-        gerrit_ssh_key_file => 
$role::zuul::configuration::merger[$::realm]['gerrit_ssh_key_file'],
-        git_dir             => 
$role::zuul::configuration::merger[$::realm]['git_dir'],
-        git_email           => 
$role::zuul::configuration::merger[$::realm]['git_email'],
-        git_name            => 
$role::zuul::configuration::merger[$::realm]['git_name'],
-        zuul_url            => 
$role::zuul::configuration::merger[$::realm]['zuul_url'],
+        gearman_server      => $conf_merger['gearman_server'],
+        gerrit_ssh_key_file => $conf_merger['gerrit_ssh_key_file'],
+        git_dir             => $conf_merger['git_dir'],
+        git_email           => $conf_merger['git_email'],
+        git_name            => $conf_merger['git_name'],
+        zuul_url            => $conf_merger['zuul_url'],
     }
 
     # Serves Zuul git repositories
     class { 'contint::zuul::git_daemon':
-        zuul_git_dir => 
$role::zuul::configuration::merger[$::realm]['git_dir'],
+        zuul_git_dir => $conf_merger['git_dir'],
     }
 
     # We run a git-daemon process to exposes the zuul-merger git repositories.
diff --git a/modules/role/manifests/zuul/server.pp 
b/modules/role/manifests/zuul/server.pp
index 0c25507..1803d56 100644
--- a/modules/role/manifests/zuul/server.pp
+++ b/modules/role/manifests/zuul/server.pp
@@ -2,28 +2,28 @@
     system::role { 'role::zuul::server': description => 'Zuul server 
(scheduler)' }
 
     include contint::proxy_zuul
-    include role::zuul::configuration
-    include role::zuul::install
     include ::zuul::monitoring::server
 
     # Zuul server needs an API key to interact with Jenkins:
     require passwords::misc::contint::jenkins
     $jenkins_apikey = $::passwords::misc::contint::jenkins::zuul_user_apikey
 
+    $conf_common = hiera('zuul::common')
+    $conf_server = hiera('zuul::server')
     class { '::zuul::server':
         # Shared settings
-        gerrit_server        => 
$role::zuul::configuration::shared[$::realm]['gerrit_server'],
-        gerrit_user          => 
$role::zuul::configuration::shared[$::realm]['gerrit_user'],
-        url_pattern          => 
$role::zuul::configuration::shared[$::realm]['url_pattern'],
-        status_url           => 
$role::zuul::configuration::shared[$::realm]['status_url'],
+        gerrit_server        => $conf_common['gerrit_server'],
+        gerrit_user          => $conf_common['gerrit_user'],
+        url_pattern          => $conf_common['url_pattern'],
+        status_url           => $conf_common['status_url'],
 
         # Server settings
-        gearman_server       => 
$role::zuul::configuration::server[$::realm]['gearman_server'],
-        gearman_server_start => 
$role::zuul::configuration::server[$::realm]['gearman_server_start'],
         jenkins_apikey       => $jenkins_apikey,
-        jenkins_server       => 
$role::zuul::configuration::server[$::realm]['jenkins_server'],
-        jenkins_user         => 
$role::zuul::configuration::server[$::realm]['jenkins_user'],
-        statsd_host          => 
$role::zuul::configuration::server[$::realm]['statsd_host'],
+        gearman_server       => $conf_server['gearman_server'],
+        gearman_server_start => $conf_server['gearman_server_start'],
+        jenkins_server       => $conf_server['jenkins_server'],
+        jenkins_user         => $conf_server['jenkins_user'],
+        statsd_host          => $conf_server['statsd_host'],
     }
 
     # Deploy Wikimedia Zuul configuration files.
@@ -37,7 +37,7 @@
         mode      => '0775',
         umask     => '002',
         origin    => 'https://gerrit.wikimedia.org/r/p/integration/config.git',
-        branch    => 
$role::zuul::configuration::server[$::realm]['config_git_branch'],
+        branch    => $conf_server['config_git_branch'],
     }
 
 }
diff --git a/modules/zuul/manifests/merger.pp b/modules/zuul/manifests/merger.pp
index 2f9fb55..3b56c19 100644
--- a/modules/zuul/manifests/merger.pp
+++ b/modules/zuul/manifests/merger.pp
@@ -29,7 +29,8 @@
     $zuul_url       = $::fqdn,
 ) {
 
-    require ::zuul
+    class { '::zuul': }
+    Class['::zuul'] -> Class['zuul::merger']
 
     exec { 'zuul merger recursive mkdir of git_dir':
         command => "/bin/mkdir -p ${git_dir}",

-- 
To view, visit https://gerrit.wikimedia.org/r/308778
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibe39ccc3a482b3aec7d0e8624324be1c809f4cbd
Gerrit-PatchSet: 12
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Hashar <has...@free.fr>
Gerrit-Reviewer: Chad <ch...@wikimedia.org>
Gerrit-Reviewer: Dzahn <dz...@wikimedia.org>
Gerrit-Reviewer: Giuseppe Lavagetto <glavage...@wikimedia.org>
Gerrit-Reviewer: Hashar <has...@free.fr>
Gerrit-Reviewer: Muehlenhoff <mmuhlenh...@wikimedia.org>
Gerrit-Reviewer: Paladox <thomasmulhall...@yahoo.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to