1 |
misc |
213 |
class buildsystem { |
2 |
dmorgan |
86 |
|
3 |
boklm |
356 |
class base { |
4 |
|
|
$build_login = "iurt" |
5 |
blino |
387 |
$build_home_dir = "/home/$build_login" |
6 |
blino |
397 |
$sched_login = "schedbot" |
7 |
boklm |
917 |
$sched_home_dir = "/var/lib/$sched_login" |
8 |
boklm |
1223 |
$packages_archivedir = "$sched_home_dir/old" |
9 |
boklm |
861 |
$sign_login = "signbot" |
10 |
|
|
$sign_home_dir = "/var/lib/$sign_login" |
11 |
boklm |
969 |
$sign_keydir = "$sign_home_dir/keys" |
12 |
|
|
# FIXME: maybe keyid should be defined at an other place |
13 |
|
|
$sign_keyid = "80420F66" |
14 |
blino |
545 |
$repository_root = "/distrib/bootstrap" |
15 |
blino |
1398 |
$mirror_root = "/distrib/mirror" |
16 |
boklm |
1388 |
$maintdb_url = 'http://www.maintdb2.mageia.org.uk/maintainers_packages/create' |
17 |
boklm |
1384 |
# FIXME: Test password. Real password should be in extdata. |
18 |
|
|
$maintdb_key = 'm1g234' |
19 |
boklm |
817 |
$packagers_group = 'mga-packagers' |
20 |
|
|
$createsrpm_path = '/usr/share/repsys/create-srpm' |
21 |
blino |
366 |
|
22 |
|
|
include ssh::auth |
23 |
boklm |
918 |
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 |
boklm |
356 |
} |
30 |
boklm |
355 |
|
31 |
boklm |
356 |
class mainnode inherits base { |
32 |
blino |
381 |
include iurtuser |
33 |
blino |
353 |
|
34 |
blino |
395 |
sshuser { $sched_login: |
35 |
|
|
homedir => $sched_home_dir, |
36 |
|
|
comment => "System user used to schedule builds", |
37 |
|
|
} |
38 |
|
|
|
39 |
blino |
399 |
ssh::auth::client { $sched_login: } |
40 |
blino |
573 |
ssh::auth::server { $sched_login: } |
41 |
blino |
399 |
ssh::auth::server { $build_login: } |
42 |
|
|
|
43 |
pterjan |
703 |
# FIXME Add again task-bs-cluster-main when it will require mgarepo instead of repsys |
44 |
|
|
$package_list = ['iurt'] |
45 |
blino |
398 |
package { $package_list: |
46 |
blino |
350 |
ensure => "installed" |
47 |
|
|
} |
48 |
blino |
403 |
|
49 |
|
|
apache::vhost_other_app { "repository.$domain": |
50 |
blino |
404 |
vhost_file => "buildsystem/vhost_repository.conf", |
51 |
blino |
403 |
} |
52 |
|
|
|
53 |
misc |
1284 |
$location = "/var/www/bs" |
54 |
misc |
1283 |
apache::vhost_base { "pkgsubmit.$domain": |
55 |
|
|
aliases => { "/uploads" => "$sched_home_dir/uploads" }, |
56 |
misc |
1284 |
location => $location, |
57 |
boklm |
1300 |
content => template("buildsystem/vhost_pkgsubmit.conf"), |
58 |
blino |
466 |
} |
59 |
|
|
|
60 |
misc |
1284 |
subversion::snapshot { $location: |
61 |
|
|
source => "svn://svn.$domain/soft/buildsystem/web/", |
62 |
|
|
} |
63 |
|
|
|
64 |
blino |
430 |
include scheduler |
65 |
blino |
431 |
include gatherer |
66 |
pterjan |
700 |
include mgarepo |
67 |
blino |
517 |
include youri_submit |
68 |
misc |
860 |
include check_missing_deps |
69 |
boklm |
964 |
include signbot |
70 |
blino |
350 |
} |
71 |
|
|
|
72 |
boklm |
356 |
class buildnode inherits base { |
73 |
misc |
213 |
include iurt |
74 |
dmorgan |
86 |
} |
75 |
|
|
|
76 |
boklm |
964 |
class signbot { |
77 |
|
|
sshuser { $sign_login: |
78 |
|
|
homedir => $sign_home_dir, |
79 |
|
|
comment => "System user used to sign packages", |
80 |
|
|
groups => [$sched_login], |
81 |
|
|
} |
82 |
|
|
|
83 |
|
|
gnupg::keys{"packages": |
84 |
|
|
email => "packages@$domain", |
85 |
|
|
#FIXME there should be a variable somewhere to change the name of the distribution |
86 |
|
|
key_name => 'Mageia Packages', |
87 |
|
|
login => $sign_login, |
88 |
|
|
batchdir => "$sign_home_dir/batches", |
89 |
boklm |
969 |
keydir => $sign_keydir, |
90 |
boklm |
964 |
} |
91 |
boklm |
966 |
|
92 |
|
|
sudo::sudoers_config { "signpackage": |
93 |
|
|
content => template("buildsystem/sudoers.signpackage") |
94 |
|
|
} |
95 |
boklm |
976 |
|
96 |
|
|
file { "$sign_home_dir/.rpmmacros": |
97 |
|
|
ensure => present, |
98 |
|
|
owner => root, |
99 |
|
|
group => root, |
100 |
|
|
mode => 644, |
101 |
|
|
content => template("buildsystem/signbot-rpmmacros") |
102 |
|
|
} |
103 |
boklm |
1023 |
|
104 |
|
|
file { "/usr/local/bin/sign-check-package": |
105 |
|
|
ensure => present, |
106 |
|
|
owner => root, |
107 |
|
|
group => root, |
108 |
|
|
mode => 755, |
109 |
|
|
content => template("buildsystem/sign-check-package") |
110 |
|
|
} |
111 |
boklm |
964 |
} |
112 |
|
|
|
113 |
misc |
265 |
class scheduler { |
114 |
|
|
# ulri |
115 |
blino |
430 |
include iurtupload |
116 |
misc |
265 |
} |
117 |
|
|
|
118 |
blino |
431 |
class gatherer { |
119 |
misc |
265 |
# emi |
120 |
blino |
430 |
include iurtupload |
121 |
misc |
265 |
} |
122 |
blino |
430 |
|
123 |
|
|
class iurtupload { |
124 |
blino |
432 |
file { "/etc/iurt/upload.conf": |
125 |
blino |
430 |
ensure => present, |
126 |
|
|
owner => $build_login, |
127 |
|
|
group => $build_login, |
128 |
|
|
mode => 644, |
129 |
|
|
require => File["/etc/iurt"], |
130 |
|
|
content => template("buildsystem/upload.conf") |
131 |
|
|
} |
132 |
|
|
} |
133 |
misc |
265 |
|
134 |
pterjan |
700 |
class mgarepo { |
135 |
|
|
package { 'mgarepo': |
136 |
misc |
265 |
|
137 |
|
|
} |
138 |
|
|
|
139 |
blino |
505 |
package { 'rpm-build': |
140 |
|
|
} |
141 |
|
|
|
142 |
blino |
500 |
file { "repsys.conf": |
143 |
|
|
path => "/etc/repsys.conf", |
144 |
|
|
owner => root, |
145 |
|
|
group => root, |
146 |
|
|
mode => 644, |
147 |
|
|
content => template("buildsystem/repsys.conf") |
148 |
|
|
} |
149 |
blino |
502 |
|
150 |
boklm |
1223 |
file { "$packages_archivedir": |
151 |
|
|
ensure => "directory", |
152 |
|
|
owner => $sched_login, |
153 |
|
|
require => File[$sched_home_dir], |
154 |
|
|
} |
155 |
|
|
|
156 |
blino |
502 |
file { "$sched_home_dir/repsys": |
157 |
|
|
ensure => "directory", |
158 |
blino |
508 |
owner => $sched_login, |
159 |
blino |
502 |
require => File[$sched_home_dir], |
160 |
|
|
} |
161 |
|
|
|
162 |
|
|
file { "$sched_home_dir/repsys/tmp": |
163 |
|
|
ensure => "directory", |
164 |
blino |
508 |
owner => $sched_login, |
165 |
boklm |
512 |
group => "mga-packagers", |
166 |
boklm |
510 |
mode => 1775, |
167 |
blino |
502 |
require => File["$sched_home_dir/repsys"], |
168 |
|
|
} |
169 |
|
|
|
170 |
|
|
file { "$sched_home_dir/repsys/srpms": |
171 |
|
|
ensure => "directory", |
172 |
blino |
508 |
owner => $sched_login, |
173 |
boklm |
512 |
group => "mga-packagers", |
174 |
boklm |
510 |
mode => 1775, |
175 |
blino |
502 |
require => File["$sched_home_dir/repsys"], |
176 |
|
|
} |
177 |
blino |
885 |
|
178 |
boklm |
915 |
# FIXME: disabled temporarly as upload dir is a symlink to /var/lib/repsys/uploads |
179 |
|
|
#file { "$sched_home_dir/uploads": |
180 |
|
|
# ensure => "directory", |
181 |
|
|
# owner => $sched_login, |
182 |
|
|
# require => File[$sched_home_dir], |
183 |
|
|
#} |
184 |
misc |
886 |
|
185 |
|
|
# too tedious to create everything by hand |
186 |
|
|
# so I prefered to used some puppet ruby module |
187 |
|
|
# the exact content and directory name should IMHO be consolidated somewhere |
188 |
|
|
import "create_upload_dir.rb" |
189 |
boklm |
915 |
create_upload_dir { "$sched_home_dir/uploads": |
190 |
|
|
owner => $sched_login, |
191 |
boklm |
968 |
group => $sched_login, |
192 |
boklm |
915 |
} |
193 |
pterjan |
1224 |
|
194 |
|
|
tidy { "$packages_archivedir": |
195 |
pterjan |
1225 |
age => "1w", |
196 |
pterjan |
1224 |
matches => "*.rpm", |
197 |
|
|
recurse => true, |
198 |
pterjan |
1226 |
type => "ctime", |
199 |
pterjan |
1224 |
} |
200 |
misc |
265 |
} |
201 |
|
|
|
202 |
blino |
516 |
class youri_submit { |
203 |
boklm |
522 |
include sudo |
204 |
|
|
|
205 |
blino |
516 |
file { "/usr/local/bin/mdv-youri-submit": |
206 |
|
|
owner => root, |
207 |
|
|
group => root, |
208 |
|
|
mode => 755, |
209 |
|
|
content => template("buildsystem/mdv-youri-submit") |
210 |
|
|
} |
211 |
|
|
|
212 |
|
|
file { "/usr/local/bin/mdv-youri-submit.wrapper": |
213 |
|
|
owner => root, |
214 |
|
|
group => root, |
215 |
|
|
mode => 755, |
216 |
|
|
content => template("buildsystem/mdv-youri-submit.wrapper") |
217 |
|
|
} |
218 |
|
|
|
219 |
boklm |
770 |
sudo::sudoers_config { "mdv-youri-submit": |
220 |
blino |
516 |
content => template("buildsystem/sudoers.youri") |
221 |
|
|
} |
222 |
blino |
543 |
|
223 |
|
|
file { "/etc/youri": |
224 |
|
|
ensure => "directory", |
225 |
|
|
} |
226 |
|
|
|
227 |
|
|
file { "/etc/youri/submit-todo.conf": |
228 |
|
|
ensure => present, |
229 |
|
|
mode => 644, |
230 |
|
|
require => File["/etc/youri"], |
231 |
|
|
content => template("buildsystem/submit-todo.conf") |
232 |
|
|
} |
233 |
pterjan |
682 |
|
234 |
pterjan |
685 |
file { "/etc/youri/submit-upload.conf": |
235 |
pterjan |
682 |
ensure => present, |
236 |
|
|
mode => 644, |
237 |
|
|
require => File["/etc/youri"], |
238 |
pterjan |
685 |
content => template("buildsystem/submit-upload.conf") |
239 |
pterjan |
682 |
} |
240 |
boklm |
772 |
|
241 |
|
|
file { "/etc/youri/acl.conf": |
242 |
|
|
ensure => present, |
243 |
|
|
mode => 644, |
244 |
|
|
require => File["/etc/youri"], |
245 |
|
|
content => template("buildsystem/youri_acl.conf") |
246 |
|
|
} |
247 |
boklm |
817 |
|
248 |
|
|
file { '/usr/local/bin/submit_package': |
249 |
|
|
ensure => present, |
250 |
|
|
mode => 755, |
251 |
|
|
content => template('buildsystem/submit_package') |
252 |
|
|
} |
253 |
pterjan |
1390 |
|
254 |
|
|
# FIXME use the correct perl directory |
255 |
|
|
file { "/usr/lib/perl5/site_perl/5.10.1/Youri/Repository": |
256 |
|
|
ensure => "directory", |
257 |
|
|
} |
258 |
|
|
|
259 |
|
|
file { '/usr/lib/perl5/site_perl/5.10.1/Youri/Repository/Mageia.pm': |
260 |
|
|
ensure => present, |
261 |
|
|
mode => 644, |
262 |
|
|
require => File["/usr/lib/perl5/site_perl/5.10.1/Youri/Repository"], |
263 |
|
|
source => "puppet:///modules/buildsystem/Mageia.pm", |
264 |
|
|
} |
265 |
|
|
|
266 |
|
|
$package_list = ['perl-SVN', 'mdv-distrib-tools', 'perl-Youri-Media', |
267 |
|
|
'perl-Youri-Package', 'perl-Youri-Repository', |
268 |
|
|
'perl-Youri-Utils', 'perl-Youri-Config'] |
269 |
|
|
|
270 |
|
|
package { $package_list: |
271 |
|
|
ensure => installed; |
272 |
|
|
} |
273 |
blino |
516 |
} |
274 |
|
|
|
275 |
boklm |
862 |
# $groups: array of secondary groups (only local groups, no ldap) |
276 |
|
|
define sshuser($homedir, $comment, $groups = []) { |
277 |
blino |
394 |
group {"$title": |
278 |
blino |
351 |
ensure => present, |
279 |
|
|
} |
280 |
|
|
|
281 |
blino |
394 |
user {"$title": |
282 |
blino |
351 |
ensure => present, |
283 |
blino |
393 |
comment => $comment, |
284 |
blino |
351 |
managehome => true, |
285 |
boklm |
916 |
home => $homedir, |
286 |
blino |
394 |
gid => $title, |
287 |
boklm |
862 |
groups => $groups, |
288 |
blino |
351 |
shell => "/bin/bash", |
289 |
blino |
394 |
notify => Exec["unlock$title"], |
290 |
blino |
424 |
require => Group[$title], |
291 |
blino |
351 |
} |
292 |
blino |
372 |
|
293 |
blino |
386 |
# set password to * to unlock the account but forbid login through login |
294 |
blino |
394 |
exec { "unlock$title": |
295 |
|
|
command => "usermod -p '*' $title", |
296 |
blino |
386 |
refreshonly => true, |
297 |
|
|
} |
298 |
|
|
|
299 |
blino |
393 |
file { $homedir: |
300 |
blino |
383 |
ensure => "directory", |
301 |
blino |
423 |
require => User[$title], |
302 |
blino |
383 |
} |
303 |
|
|
|
304 |
blino |
393 |
file { "$homedir/.ssh": |
305 |
blino |
372 |
ensure => "directory", |
306 |
|
|
mode => 600, |
307 |
blino |
394 |
owner => $title, |
308 |
|
|
group => $title, |
309 |
blino |
423 |
require => File[$homedir], |
310 |
blino |
372 |
} |
311 |
blino |
351 |
} |
312 |
|
|
|
313 |
blino |
393 |
class iurtuser { |
314 |
blino |
394 |
sshuser { $build_login: |
315 |
|
|
homedir => $build_home_dir, |
316 |
|
|
comment => "System user used to run build bots", |
317 |
|
|
} |
318 |
blino |
429 |
|
319 |
|
|
file { "/etc/iurt": |
320 |
|
|
ensure => "directory", |
321 |
|
|
} |
322 |
blino |
393 |
} |
323 |
|
|
|
324 |
misc |
213 |
class iurt { |
325 |
boklm |
216 |
include sudo |
326 |
blino |
381 |
include iurtuser |
327 |
blino |
366 |
ssh::auth::client { $build_login: } |
328 |
blino |
396 |
ssh::auth::server { $sched_login: user => $build_login } |
329 |
misc |
213 |
|
330 |
|
|
# build node common settings |
331 |
|
|
# we could have the following skip list to use less space: |
332 |
|
|
# '/(drakx-installer-binaries|drakx-installer-advertising|gfxboot|drakx-installer-stage2|mandriva-theme)/' |
333 |
|
|
$package_list = ['task-bs-cluster-chroot', 'iurt'] |
334 |
|
|
package { $package_list: |
335 |
|
|
ensure => installed; |
336 |
|
|
} |
337 |
|
|
|
338 |
blino |
426 |
file { "/etc/iurt/build": |
339 |
|
|
ensure => "directory", |
340 |
blino |
428 |
require => File["/etc/iurt"], |
341 |
blino |
426 |
} |
342 |
|
|
|
343 |
blino |
425 |
file { "/etc/iurt/build/cauldron.conf": |
344 |
misc |
213 |
ensure => present, |
345 |
|
|
owner => $build_login, |
346 |
|
|
group => $build_login, |
347 |
|
|
mode => 644, |
348 |
blino |
426 |
require => File["/etc/iurt/build"], |
349 |
boklm |
218 |
content => template("buildsystem/iurt.cauldron.conf") |
350 |
misc |
213 |
} |
351 |
|
|
|
352 |
boklm |
648 |
file { "/etc/iurt/build/mandriva2010.1.conf": |
353 |
|
|
ensure => present, |
354 |
|
|
owner => $build_login, |
355 |
|
|
group => $build_login, |
356 |
|
|
mode => 644, |
357 |
|
|
require => File["/etc/iurt/build"], |
358 |
|
|
content => template("buildsystem/iurt.mandriva2010.1.conf") |
359 |
|
|
} |
360 |
|
|
|
361 |
boklm |
770 |
sudo::sudoers_config { "iurt": |
362 |
boklm |
218 |
content => template("buildsystem/sudoers.iurt") |
363 |
boklm |
216 |
} |
364 |
dmorgan |
86 |
} |
365 |
boklm |
696 |
|
366 |
|
|
# temporary script to create home dir with ssh key |
367 |
|
|
# taking login and url as arguments |
368 |
|
|
class mgacreatehome { |
369 |
|
|
file { "/usr/local/sbin/mgacreatehome": |
370 |
|
|
ensure => present, |
371 |
|
|
owner => root, |
372 |
|
|
group => root, |
373 |
|
|
mode => 700, |
374 |
|
|
content => template("buildsystem/mgacreatehome") |
375 |
|
|
} |
376 |
|
|
} |
377 |
misc |
859 |
|
378 |
|
|
class check_missing_deps { |
379 |
|
|
file { "/usr/local/bin/missing-deps.sh": |
380 |
|
|
ensure => present, |
381 |
|
|
owner => root, |
382 |
|
|
group => root, |
383 |
boklm |
869 |
mode => 755, |
384 |
boklm |
868 |
source => "puppet:///modules/buildsystem/missing-deps.sh", |
385 |
misc |
859 |
} |
386 |
|
|
|
387 |
|
|
# FIXME hardcoded path |
388 |
|
|
cron { "check missing deps": |
389 |
|
|
command => "cd /var/www/bs/data && /usr/local/bin/missing-deps.sh", |
390 |
|
|
minute => "*/15", |
391 |
|
|
} |
392 |
|
|
} |
393 |
dmorgan |
86 |
} |