Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: modules/buildbot/manifests/slave.pp

Issue 29325436: Issue 1281 - Introduce module buildbot (Closed)
Patch Set: Issue 1281 - Rebase branch buildbot on top of upstream Created Sept. 5, 2015, 11:27 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: modules/buildbot/manifests/slave.pp
diff --git a/modules/buildbot/manifests/slave.pp b/modules/buildbot/manifests/slave.pp
new file mode 100644
index 0000000000000000000000000000000000000000..03486d37d6a04cc847873fab09e7884f7bee3c46
--- /dev/null
+++ b/modules/buildbot/manifests/slave.pp
@@ -0,0 +1,110 @@
+# == Type: buildbot::slave
+#
+# Manage Buildbot (http://buildbot.net/) slave instances.
+#
+# === Parameters:
+#
+# [*basedir*]
+# The base directory of the slave, which can be configured elsewhere or,
+# if it's anchestors are present, relied upon the builtin defaults.
Felix Dahlke 2015/10/02 12:39:43 Typo.
mathias 2015/10/02 13:47:41 Acknowledged.
+#
+# [*ensure*]
+# Whether to setup the slave (anything but 'absent' or 'purged') or
+# remove the associated resources. Note that only 'purged' implies the
+# removal of $basedir.
+#
+# [*master*]
+# The "$hostname:$port" combination of the build master.
+#
+# [*name*]
+# The build slave's name.
+#
+# [*password*]
+# The build slave's password with the master.
+#
+# [*system*]
+# Any value beside 'false' will cause the slave operations to also
+# affect the buildbot::buildslave service. Use this option to include
+# the slave instance with the system daemon.
+#
+# [*user*]
+# The user to whom the slave instance belongs to. Note that the user
+# is not created implicitly by this setup, except if the creation is
+# implied with any of the $buildbot::slave_packages.
+#
+# === Examples:
+#
+# buildbot::slave {'alpha':
+# basedir => '/var/buildslave-alpha',
+# }
+#
+# buildbot::slave {'beta':
+# ensure => absent,
+# }
+#
+define buildbot::slave (
+ $admin = 'buildbot@localhost',
+ $basedir = "$::buildbot::slave_directory/$name",
+ $ensure = 'present',
+ $master = 'localhost:9989',
+ $password = 'changeme',
+ $system = false,
+ $user = $::buildbot::slave_user,
+) {
+
+ if $ensure !~ /^(absent|purged)$/ {
+ ensure_packages($::buildbot::slave_packages)
+ realize(File[$::buildbot::slave_directory])
+
+ exec {"buildslave#$title":
+ command => shellquote([
+ $::buildbot::slave_runner,
+ 'create-slave',
+ $basedir,
+ $master,
+ $name,
+ $password,
+ ]),
+ creates => "$basedir/buildbot.tac",
+ require => [
+ File[$::buildbot::master_directory],
+ Package[$::buildbot::master_packages],
+ ],
+ user => $user,
+ }
+
+ Exec["buildslave#$title"] <- Exec <|creates == $basedir|>
+ Exec["buildslave#$title"] <- File <|path == $basedir|>
+
+ file {"$basedir/info/admin":
+ content => $admin,
+ owner => $user,
+ require => Exec["buildslave#$title"],
+ }
+ }
+
+ if $system != false {
+ ensure_packages($::buildbot::slave_packages)
+ realize(Concat['buildslave'])
+ realize(Concat::Fragment['buildslave'])
+ realize(Service['buildslave'])
+
+ concat::fragment {"buildslave#$title":
+ content => template('buildbot/buildslave_fragment.erb'),
+ ensure => $ensure ? {'present' => $ensure, default => 'absent'},
+ notify => Service['buildslave'],
+ order => 1,
+ target => 'buildslave',
+ }
+
+ Service['buildslave'] <~ Exec <|creates == "$basedir"|>
+ Service['buildslave'] <~ Exec <|creates == "$basedir/buildbot.tac"|>
+
+ Service['buildslave'] <~ File <|path == "$basedir"|>
+ Service['buildslave'] <~ File <|path == "$basedir/info/admin"|>
+ }
+
+ if $ensure == 'purged' {
+ file {$basedir: ensure => 'absent'}
+ }
+}

Powered by Google App Engine
This is Rietveld