Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 # == Class: adblockplus::buildmaster | 1 # == Class: adblockplus::buildmaster |
2 # | 2 # |
3 # An authoritative build-server setup based on Buildbot and Nginx. | 3 # An authoritative build-server setup based on Buildbot and Nginx. |
4 # | 4 # |
5 # === Parameters: | 5 # === Parameters: |
6 # | 6 # |
7 # [*domain*] | 7 # [*domain*] |
8 # The domain name associated with the Buildbot waterfall page. | 8 # The domain name associated with the Buildbot waterfall page. |
9 # | 9 # |
10 # [*is_default_domain*] | 10 # [*is_default_domain*] |
11 # Whether the Buildbot page should serve as the default content | 11 # Whether the Buildbot page should serve as the default content |
12 # handler with the HTTP server setup. | 12 # handler with the HTTP server setup. |
13 # | 13 # |
14 # [*project*] | 14 # [*buildbot_config*] |
15 # A hash to optionally contain a 'title' and 'url' for the project; | 15 # Translates directly into the $buildbot::master::config option. |
16 # translats directly into the $buildbot::master::project option. | |
Felix Dahlke
2015/11/19 19:50:00
Typo: "translats"
mathias
2016/01/20 16:13:51
Acknowledged.
| |
17 # | 16 # |
18 # [*ssl_cert*] | 17 # [*ssl_cert*] |
19 # The SSL certificate file name within the private module, if any. | 18 # The SSL certificate file name within the private module, if any. |
20 # Requires an $ssl_key to be provided as well. | 19 # Requires an $ssl_key to be provided as well. |
21 # | 20 # |
22 # [*ssl_key*] | 21 # [*ssl_key*] |
23 # The SSL key file name within the private module, if any. | 22 # The SSL key file name within the private module, if any. |
24 # Requires an $ssl_cert to be provided as well. | 23 # Requires an $ssl_cert to be provided as well. |
25 # | 24 # |
26 # [*slaves*] | 25 # [*slaves*] |
27 # Local buildbot::slave records to setup with the master. | 26 # Local buildbot::slave records to setup with the master. |
28 # | 27 # |
29 # [*slave_credentials*] | 28 # [*slave_credentials*] |
30 # Name => password pairs of e.g. remote build slaves. | 29 # Name => password pairs of e.g. remote build slaves. |
Felix Dahlke
2015/11/19 19:50:01
Why "e.g.", do we need credentials for local slave
mathias
2016/01/20 16:13:51
Yes.
| |
31 # | 30 # |
32 # === Examples: | 31 # === Examples: |
33 # | 32 # |
34 # class {'adblockplus::buildmaster': | 33 # class {'adblockplus::buildmaster': |
35 # domain => 'localhost', | 34 # domain => 'localhost', |
36 # is_default_domain => true, | 35 # is_default_domain => true, |
37 # } | 36 # } |
38 # | 37 # |
39 class adblockplus::buildmaster ( | 38 class adblockplus::buildmaster ( |
40 $domain, | 39 $domain, |
41 $is_default_domain = false, | 40 $is_default_domain = false, |
42 $project = {}, | 41 $buildbot_config = {}, |
43 $ssl_cert = hiera('adblockplus::buildmaster::ssl_cert', 'undef'), | 42 $ssl_cert = hiera('adblockplus::buildmaster::ssl_cert', 'undef'), |
44 $ssl_key = hiera('adblockplus::buildmaster::ssl_key', 'undef'), | 43 $ssl_key = hiera('adblockplus::buildmaster::ssl_key', 'undef'), |
45 $slaves = hiera('adblockplus::buildmaster::slaves', {}), | 44 $slaves = hiera('adblockplus::buildmaster::slaves', {}), |
46 $slave_credentials = hiera('adblockplus::buildmaster::slave_credentials', {}), | 45 $slave_credentials = hiera('adblockplus::buildmaster::slave_credentials', {}), |
47 ) { | 46 ) { |
48 | 47 |
49 include nginx | 48 include nginx |
50 | 49 |
51 # change default behavior, but still recognize hiera values | 50 # change default behavior, but still recognize hiera values |
52 class {'buildbot': | 51 class {'buildbot': |
53 master_service => hiera('buildbot::master_service', 'running'), | 52 master_service => hiera('buildbot::master_service', 'running'), |
54 slave_service => hiera('buildbot::slave_service', 'running'), | 53 slave_service => hiera('buildbot::slave_service', 'running'), |
55 } | 54 } |
56 | 55 |
56 # Computable $buildbot::master::config parameters | |
57 $default_scheme = $ssl_cert ? {/^(undef|)$/ => 'http', default => 'https'} | |
58 $default_config = { | |
59 'buildbotURL' => sprintf('%s://%s/', $default_scheme, $domain), | |
60 } | |
61 | |
57 buildbot::master {'default': | 62 buildbot::master {'default': |
58 project => $project, | 63 config => merge($default_config, $buildbot_config), |
59 slaves => $slaves, | 64 slaves => $slaves, |
60 slave_credentials => $slave_credentials, | 65 slave_credentials => $slave_credentials, |
61 system => true, | 66 system => true, |
62 } | 67 } |
63 | 68 |
64 buildbot::fragment {'custom': | 69 buildbot::fragment {'custom': |
65 authority => Buildbot::Master['default'], | 70 authority => Buildbot::Master['default'], |
66 content => template('adblockplus/buildmaster.erb'), | 71 content => template('adblockplus/buildmaster.erb'), |
67 } | 72 } |
68 | 73 |
69 nginx::hostconfig {$domain: | 74 nginx::hostconfig {$domain: |
70 certificate => $ssl_cert ? { | 75 certificate => $ssl_cert ? { |
71 'undef' => undef, | 76 'undef' => undef, |
72 default => $ssl_cert, | 77 default => $ssl_cert, |
73 }, | 78 }, |
74 source => 'puppet:///modules/adblockplus/nginx/buildmaster.conf', | 79 source => 'puppet:///modules/adblockplus/nginx/buildmaster.conf', |
75 is_default => $is_default_domain, | 80 is_default => $is_default_domain, |
76 log => 'access_log_buildbot', | 81 log => 'access_log_buildbot', |
77 private_key => $ssl_key ? { | 82 private_key => $ssl_key ? { |
78 'undef' => undef, | 83 'undef' => undef, |
79 default => $ssl_key, | 84 default => $ssl_key, |
80 }, | 85 }, |
81 } | 86 } |
82 } | 87 } |
LEFT | RIGHT |