Split buildd class into small pieces
[mirror/dsa-puppet.git] / modules / buildd / manifests / pybuildd.pp
diff --git a/modules/buildd/manifests/pybuildd.pp b/modules/buildd/manifests/pybuildd.pp
new file mode 100644 (file)
index 0000000..6f73b05
--- /dev/null
@@ -0,0 +1,54 @@
+# pybuildd configuration
+class buildd {
+  package { 'buildd':
+    ensure => purged,
+  }
+
+  package { ['python3-retrying', 'python3-yaml']:
+    ensure => installed,
+  }
+  file { '/home/buildd/.profile':
+    content  => @(EOT),
+      export XDG_RUNTIME_DIR="/run/user/$(id -u)"
+      export DBUS_SESSION_BUS_ADDRESS="unix:path=${XDG_RUNTIME_DIR}/bus"
+      | EOT
+    group   => buildd,
+    owner   => buildd,
+  }
+  file { '/home/buildd/logs':
+    ensure  => directory,
+    mode    => '2750',
+    group   => buildd,
+    owner   => buildd,
+  }
+  file { '/var/lib/systemd/linger':
+    ensure  => directory,
+    mode    => '755',
+  }
+  file { "/var/lib/systemd/linger/buildd":
+    ensure => present,
+  }
+  file { '/etc/systemd/journald.conf.d':
+    ensure  => directory,
+    mode    => '755',
+  }
+  file { '/etc/systemd/journald.conf.d/persistency.conf':
+    source => 'puppet:///modules/dsa_systemd/persistency.conf',
+  }
+
+  # Make sure that the build directory have the correct permissions.
+  # This should go away once pybuildd issue #3 is solved.
+  file { '/home/buildd/build':
+    ensure  => directory,
+    mode    => '2750',
+    group   => buildd,
+    owner   => buildd,
+  }
+  # work around https://salsa.debian.org/wb-team/pybuildd/issues/11
+  concat::fragment { 'dsa-puppet-stuff--pybuildd-expire-logs':
+    target => '/etc/cron.d/dsa-puppet-stuff',
+    content  => @(EOF)
+      @daily buildd [ -d ~buildd/logs ] && find ~buildd/logs -type f -mtime +90 -delete
+      | EOF
+  }
+}