/[adm]/puppet/modules/buildsystem/manifests/init.pp
ViewVC logotype

Contents of /puppet/modules/buildsystem/manifests/init.pp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1859 - (show annotations) (download)
Tue Jul 19 22:32:05 2011 UTC (12 years, 11 months ago) by misc
File size: 14141 byte(s)
fix permission on maint db dump ( so the cron job can update it )

1 class buildsystem {
2
3 class base {
4 $build_login = "iurt"
5 $build_home_dir = "/home/$build_login"
6 $sched_login = "schedbot"
7 $sched_home_dir = "/var/lib/$sched_login"
8 $packages_archivedir = "$sched_home_dir/old"
9 $sign_login = "signbot"
10 $sign_home_dir = "/var/lib/$sign_login"
11 $sign_keydir = "$sign_home_dir/keys"
12 # FIXME: maybe keyid should be defined at an other place
13 $sign_keyid = "80420F66"
14 $repository_root = "/distrib/bootstrap"
15 $mirror_root = "/distrib/mirror"
16 $maintdb_url = 'http://www.maintdb2.mageia.org.uk/maintainers_packages/create'
17 # FIXME: Test password. Real password should be in extdata.
18 $maintdb_key = 'm1g234'
19 $packagers_group = 'mga-packagers'
20 $createsrpm_path = '/usr/share/repsys/create-srpm'
21
22 include ssh::auth
23 ssh::auth::key { $build_login: # declare a key for build bot: RSA, 2048 bits
24 home => $build_home_dir,
25 }
26 ssh::auth::key { $sched_login: # declare a key for sched bot: RSA, 2048 bits
27 home => $sched_home_dir,
28 }
29 }
30
31 class mainnode inherits base {
32 include iurtuser
33
34 sshuser { $sched_login:
35 homedir => $sched_home_dir,
36 comment => "System user used to schedule builds",
37 }
38
39 ssh::auth::client { $sched_login: }
40 ssh::auth::server { $sched_login: }
41 ssh::auth::server { $build_login: }
42
43 # FIXME Add again task-bs-cluster-main when it will require mgarepo instead of repsys
44 $package_list = ['iurt']
45 package { $package_list:
46 ensure => "installed"
47 }
48
49 apache::vhost_other_app { "repository.$domain":
50 vhost_file => "buildsystem/vhost_repository.conf",
51 }
52
53 $location = "/var/www/bs"
54 apache::vhost_base { "pkgsubmit.$domain":
55 aliases => { "/uploads" => "$sched_home_dir/uploads" },
56 location => $location,
57 content => template("buildsystem/vhost_pkgsubmit.conf"),
58 }
59
60 subversion::snapshot { $location:
61 source => "svn://svn.$domain/soft/buildsystem/web/",
62 }
63
64 file { "$repository_root/distrib/cauldron/i586/media/media_info/media.cfg":
65 ensure => present,
66 owner => $sched_login,
67 group => $sched_login,
68 mode => 644,
69 source => "puppet:///modules/buildsystem/i586/media.cfg",
70 }
71
72 file { "$repository_root/distrib/cauldron/x86_64/media/media_info/media.cfg":
73 ensure => present,
74 owner => $sched_login,
75 group => $sched_login,
76 mode => 644,
77 source => "puppet:///modules/buildsystem/x86_64/media.cfg",
78 }
79
80 include scheduler
81 include gatherer
82 include mgarepo
83 include youri_submit
84 include check_missing_deps
85 include signbot
86 }
87
88 class buildnode inherits base {
89 include iurt
90 }
91
92 class signbot {
93 sshuser { $sign_login:
94 homedir => $sign_home_dir,
95 comment => "System user used to sign packages",
96 groups => [$sched_login],
97 }
98
99 gnupg::keys{"packages":
100 email => "packages@$domain",
101 #FIXME there should be a variable somewhere to change the name of the distribution
102 key_name => 'Mageia Packages',
103 login => $sign_login,
104 batchdir => "$sign_home_dir/batches",
105 keydir => $sign_keydir,
106 }
107
108 sudo::sudoers_config { "signpackage":
109 content => template("buildsystem/sudoers.signpackage")
110 }
111
112 file { "$sign_home_dir/.rpmmacros":
113 ensure => present,
114 owner => root,
115 group => root,
116 mode => 644,
117 content => template("buildsystem/signbot-rpmmacros")
118 }
119
120 file { "/usr/local/bin/sign-check-package":
121 ensure => present,
122 owner => root,
123 group => root,
124 mode => 755,
125 content => template("buildsystem/sign-check-package")
126 }
127 }
128
129 class scheduler {
130 # ulri
131 include iurtupload
132 }
133
134 class gatherer {
135 # emi
136 include iurtupload
137 }
138
139 class iurtupload {
140 file { "/etc/iurt/upload.conf":
141 ensure => present,
142 owner => $build_login,
143 group => $build_login,
144 mode => 644,
145 require => File["/etc/iurt"],
146 content => template("buildsystem/upload.conf")
147 }
148 }
149
150 class maintdb inherits base {
151 include sudo
152 $maintdb_login = "maintdb"
153 $maintdb_homedir = "/var/lib/maintdb"
154 $maintdb_dbdir = "$maintdb_homedir/db"
155 $maintdb_binpath = "/usr/local/sbin/maintdb"
156 $maintdb_wrappath = "/usr/local/bin/wrapper.maintdb"
157 $maintdb_dump = "/var/www/bs/data/maintdb.txt"
158
159 user {"$maintdb_login":
160 ensure => present,
161 comment => "Maintainers database",
162 managehome => true,
163 shell => "/bin/bash",
164 home => "$maintdb_homedir",
165 }
166
167 file { "$maintdb_dbdir":
168 ensure => directory,
169 owner => "$maintdb_login",
170 group => "$maintdb_login",
171 mode => 700,
172 require => User["$maintdb_login"],
173 }
174
175 file { "$maintdb_binpath":
176 ensure => present,
177 owner => root,
178 group => root,
179 mode => 755,
180 content => template("buildsystem/maintdb")
181 }
182
183 file { "$maintdb_wrappath":
184 ensure => present,
185 owner => root,
186 group => root,
187 mode => 755,
188 content => template("buildsystem/wrapper.maintdb")
189 }
190
191 sudo::sudoers_config { "maintdb":
192 content => template("buildsystem/sudoers.maintdb")
193 }
194
195 file { "$maintdb_dump":
196 ensure => present,
197 owner => $maintdb_login,
198 mode => 644,
199 }
200
201 cron { "update maintdb export":
202 user => $maintdb_login,
203 command => "$maintdb_binpath root get > $maintdb_dump",
204 minute => "*/30",
205 }
206
207 }
208
209 class mgarepo {
210 package { 'mgarepo':
211
212 }
213
214 package { 'rpm-build':
215 }
216
217 file { "repsys.conf":
218 path => "/etc/repsys.conf",
219 owner => root,
220 group => root,
221 mode => 644,
222 content => template("buildsystem/repsys.conf")
223 }
224
225 file { "$packages_archivedir":
226 ensure => "directory",
227 owner => $sched_login,
228 require => File[$sched_home_dir],
229 }
230
231 file { "$sched_home_dir/repsys":
232 ensure => "directory",
233 owner => $sched_login,
234 require => File[$sched_home_dir],
235 }
236
237 file { ["$sched_home_dir/repsys/tmp", "$sched_home_dir/repsys/srpms"]:
238 ensure => "directory",
239 owner => $sched_login,
240 group => "mga-packagers",
241 mode => 1775,
242 require => File["$sched_home_dir/repsys"],
243 }
244
245 # FIXME: disabled temporarly as upload dir is a symlink to /var/lib/repsys/uploads
246 #file { "$sched_home_dir/uploads":
247 # ensure => "directory",
248 # owner => $sched_login,
249 # require => File[$sched_home_dir],
250 #}
251
252 # too tedious to create everything by hand
253 # so I prefered to used some puppet ruby module
254 # the exact content and directory name should IMHO be consolidated somewhere
255 import "create_upload_dir.rb"
256 create_upload_dir { "$sched_home_dir/uploads":
257 owner => $sched_login,
258 group => $sched_login,
259 }
260
261 tidy { "$sched_home_dir/uploads":
262 age => "2w",
263 recurse => true,
264 type => "ctime",
265 }
266
267 tidy { "$packages_archivedir":
268 age => "1w",
269 matches => "*.rpm",
270 recurse => true,
271 type => "ctime",
272 }
273 }
274
275 class youri_submit {
276 include sudo
277
278 file { "/usr/local/bin/mga-youri-submit":
279 owner => root,
280 group => root,
281 mode => 755,
282 content => template("buildsystem/mga-youri-submit")
283 }
284
285 file { "/usr/local/bin/mga-youri-submit.wrapper":
286 owner => root,
287 group => root,
288 mode => 755,
289 content => template("buildsystem/mga-youri-submit.wrapper")
290 }
291
292 sudo::sudoers_config { "mga-youri-submit":
293 content => template("buildsystem/sudoers.youri")
294 }
295
296 file { "/etc/youri":
297 ensure => "directory",
298 }
299
300 file { "/etc/youri/submit-todo.conf":
301 ensure => present,
302 mode => 644,
303 require => File["/etc/youri"],
304 content => template("buildsystem/submit-todo.conf")
305 }
306
307 file { "/etc/youri/submit-upload.conf":
308 ensure => present,
309 mode => 644,
310 require => File["/etc/youri"],
311 content => template("buildsystem/submit-upload.conf")
312 }
313
314 file { "/etc/youri/acl.conf":
315 ensure => present,
316 mode => 644,
317 require => File["/etc/youri"],
318 content => template("buildsystem/youri_acl.conf")
319 }
320
321 file { '/usr/local/bin/submit_package':
322 ensure => present,
323 mode => 755,
324 content => template('buildsystem/submit_package')
325 }
326
327 # FIXME use the correct perl directory
328 file { "/usr/lib/perl5/site_perl/5.10.1/Youri/Repository":
329 ensure => "directory",
330 }
331
332 file { '/usr/lib/perl5/site_perl/5.10.1/Youri/Repository/Mageia.pm':
333 ensure => present,
334 mode => 644,
335 require => File["/usr/lib/perl5/site_perl/5.10.1/Youri/Repository"],
336 source => "puppet:///modules/buildsystem/Mageia.pm",
337 }
338
339 $package_list = ['perl-SVN', 'mdv-distrib-tools', 'perl-Youri-Media',
340 'perl-Youri-Package', 'perl-Youri-Repository',
341 'perl-Youri-Utils', 'perl-Youri-Config', 'mga-youri-submit']
342
343 package { $package_list:
344 ensure => installed;
345 }
346 }
347
348 # $groups: array of secondary groups (only local groups, no ldap)
349 define sshuser($homedir, $comment, $groups = []) {
350 group {"$title":
351 ensure => present,
352 }
353
354 user {"$title":
355 ensure => present,
356 comment => $comment,
357 managehome => true,
358 home => $homedir,
359 gid => $title,
360 groups => $groups,
361 shell => "/bin/bash",
362 notify => Exec["unlock$title"],
363 require => Group[$title],
364 }
365
366 # set password to * to unlock the account but forbid login through login
367 exec { "unlock$title":
368 command => "usermod -p '*' $title",
369 refreshonly => true,
370 }
371
372 file { $homedir:
373 ensure => "directory",
374 require => User[$title],
375 }
376
377 file { "$homedir/.ssh":
378 ensure => "directory",
379 mode => 600,
380 owner => $title,
381 group => $title,
382 require => File[$homedir],
383 }
384 }
385
386 class iurtuser {
387 sshuser { $build_login:
388 homedir => $build_home_dir,
389 comment => "System user used to run build bots",
390 }
391
392 file { "/etc/iurt":
393 ensure => "directory",
394 }
395 }
396
397 class iurt {
398 include sudo
399 include iurtuser
400 ssh::auth::client { $build_login: }
401 ssh::auth::server { $sched_login: user => $build_login }
402
403 # build node common settings
404 # we could have the following skip list to use less space:
405 # '/(drakx-installer-binaries|drakx-installer-advertising|gfxboot|drakx-installer-stage2|mandriva-theme)/'
406 $package_list = ['task-bs-cluster-chroot', 'iurt']
407 package { $package_list:
408 ensure => installed;
409 }
410
411 file { "/etc/iurt/build":
412 ensure => "directory",
413 require => File["/etc/iurt"],
414 }
415
416 file { "/etc/iurt/build/cauldron.conf":
417 ensure => present,
418 owner => $build_login,
419 group => $build_login,
420 mode => 644,
421 require => File["/etc/iurt/build"],
422 content => template("buildsystem/iurt.cauldron.conf")
423 }
424
425 file { "/etc/iurt/build/1.conf":
426 ensure => present,
427 owner => $build_login,
428 group => $build_login,
429 mode => 644,
430 require => File["/etc/iurt/build"],
431 content => template("buildsystem/iurt.1.conf")
432 }
433
434 file { "/etc/iurt/build/mandriva2010.1.conf":
435 ensure => present,
436 owner => $build_login,
437 group => $build_login,
438 mode => 644,
439 require => File["/etc/iurt/build"],
440 content => template("buildsystem/iurt.mandriva2010.1.conf")
441 }
442
443 sudo::sudoers_config { "iurt":
444 content => template("buildsystem/sudoers.iurt")
445 }
446 }
447
448 # temporary script to create home dir with ssh key
449 # taking login and url as arguments
450 class mgacreatehome {
451 file { "/usr/local/sbin/mgacreatehome":
452 ensure => present,
453 owner => root,
454 group => root,
455 mode => 700,
456 content => template("buildsystem/mgacreatehome")
457 }
458 }
459
460 class check_missing_deps {
461 file { "/usr/local/bin/missing-deps.sh":
462 ensure => present,
463 owner => root,
464 group => root,
465 mode => 755,
466 source => "puppet:///modules/buildsystem/missing-deps.sh",
467 }
468
469 # FIXME hardcoded path
470 cron { "check missing deps":
471 command => "cd /var/www/bs/data && /usr/local/bin/missing-deps.sh",
472 minute => "*/15",
473 }
474 }
475
476 class release {
477 subversion::snapshot { "/root/release":
478 source => "svn://svn.$domain/soft/release/trunk/",
479 }
480
481 package { "hardlink":
482 ensure => "installed",
483 }
484 }
485
486 # A script to copy on valstar the 2010.1 rpms built on jonund
487 class sync20101 inherits base {
488 file { "/usr/local/bin/sync2010.1":
489 ensure => present,
490 owner => root,
491 group => root,
492 mode => 755,
493 content => template("buildsystem/sync2010.1"),
494 }
495 }
496
497 # a script to build 2010.1 packages. used on jonund
498 class iurt20101 inherits base {
499 file { "/usr/local/bin/iurt2010.1":
500 ensure => present,
501 owner => root,
502 group => root,
503 mode => 755,
504 content => template("buildsystem/iurt2010.1"),
505 }
506 }
507 }

  ViewVC Help
Powered by ViewVC 1.1.30