forked from buildbot/metabbotcfg
-
Notifications
You must be signed in to change notification settings - Fork 1
/
slaves.py
268 lines (232 loc) · 7.38 KB
/
slaves.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
import os
from buildbot.buildslave import BuildSlave
class MySlaveBase(object):
# true if this box is buildbot.net, and can build docs, etc.
buildbot_net = False
# true if this box should use a 'simple' factory, meaning no virtualenv
# (basically good for windows)
use_simple = False
# true if this box can test the buildmaster and buildslave, respectively
test_master = True
test_slave = True
# true if this slave should have a single-slave builder of its own
run_single = True
# true if this host has PyQt4 installed in its default python
pyqt4 = False
# true if this slave can contribute to the virtualenv-managed pool of
# specific-configuration builders. Specific supported python versions
# are given, too
run_config = False
py26 = False
py27 = False
pypy17 = False
pypy18 = False
tw0900 = True
tw1020 = True
tw1110 = True
tw1220 = True
tw1320 = True
tw1402 = True
tw1611 = True
# true if this has nodejs installed, suitable for www
nodejs = False
# dictionary mapping databases to the env vars required to make them go
databases = {}
# operating system, for os-specific builders; this should only be used
# for fleets of machines that are basically interchangebale
os = None
def extract_attrs(self, name, **kwargs):
self.slavename = name
remaining = {}
for k in kwargs:
if hasattr(self, k):
setattr(self, k, kwargs[k])
else:
remaining[k] = kwargs[k]
return remaining
def get_pass(self, name):
if os.environ.get('CHECK_CONFIG') == 'true':
return ''
# get the password based on the name
path = os.path.join(os.path.dirname(__file__), "%s.pass" % name)
pw = open(path).read().strip()
return pw
class MySlave(MySlaveBase, BuildSlave):
def __init__(self, name, **kwargs):
password = self.get_pass(name)
kwargs = self.extract_attrs(name, **kwargs)
BuildSlave.__init__(self, name, password, **kwargs)
slaves = [
# Local
MySlave('buildbot.net',
buildbot_net=True,
run_config=False,
run_single=False,
max_builds=1,
),
# Mozilla
MySlave('buildbot-linux4', # buildbot-linux4.community.scl3.mozilla.com
max_builds=4,
run_single=False,
run_config=True,
py26=True,
py27=True, # hand-compiled in /usr/local
pyqt4=True, # installed in system python
databases={
'postgres': {'BUILDBOT_TEST_DB_URL':
'postgresql+pg8000://metabuildslave@localhost/metabuildslave'},
# this runs MySQL 5.1, which we do not support
# http://trac.buildbot.net/ticket/3457#comment:1
# 'mysql': {'BUILDBOT_TEST_DB_URL':
# 'mysql+mysqldb://metabuildslave@localhost/metabuildslave'},
},
),
# VM on Buildbot hardware
MySlave('linux',
max_builds=4,
run_single=False,
run_config=True,
py27=True,
pyqt4=False,
databases={
'postgres': {'BUILDBOT_TEST_DB_URL':
'postgresql+pg8000://${POSTGRESQL_ENV_POSTGRES_USER}:${POSTGRESQL_ENV_POSTGRES_PASSWORD}@${POSTGRESQL_PORT_5432_TCP_ADDR}:${POSTGRESQL_PORT_5432_TCP_PORT}/${POSTGRESQL_ENV_POSTGRES_USER}'},
'mysql': {'BUILDBOT_TEST_DB_URL':
"mysql+mysqldb://${MYSQL_ENV_MYSQL_USER}:${MYSQL_ENV_MYSQL_PASSWORD}@${MYSQL_PORT_3306_TCP_ADDR}:${MYSQL_PORT_3306_TCP_PORT}/${MYSQL_ENV_MYSQL_DATABASE}"},
}
),
# Bill Deegan
MySlave('bdbaddog-eight',
max_builds=4,
run_single=False,
run_config=True,
py27=True,
pyqt4=False,
databases={
'postgres': {'BUILDBOT_TEST_DB_URL':
'postgresql+pg8000://${POSTGRESQL_ENV_POSTGRES_USER}:${POSTGRESQL_ENV_POSTGRES_PASSWORD}@${POSTGRESQL_PORT_5432_TCP_ADDR}:${POSTGRESQL_PORT_5432_TCP_PORT}/${POSTGRESQL_ENV_POSTGRES_USER}'},
'mysql': {'BUILDBOT_TEST_DB_URL':
"mysql+mysqldb://${MYSQL_ENV_MYSQL_USER}:${MYSQL_ENV_MYSQL_PASSWORD}@${MYSQL_PORT_3306_TCP_ADDR}:${MYSQL_PORT_3306_TCP_PORT}/${MYSQL_ENV_MYSQL_DATABASE}"},
}
),
# koobs - Kubilay Kocak <koobs dot freebsd at gmail.com>
MySlave(
'koobs-freebsd9',
max_builds=4,
run_single=False,
run_config=True,
py26=False,
py27=True,
),
MySlave(
'koobs-freebsd10',
max_builds=4,
run_single=False,
run_config=True,
py26=False,
py27=True,
),
# (EC2 - kept here as an indication of how to set it up)
# MyEC2LatentBuildSlave('ec2slave', 'm1.small',
# ami='ami-5a749c33',
# keypair_name='buildbot-setup',
# security_name='buildslaves',
# ),
]
# these are slaves that haven't been up and from whose owners I have not heard in a while
retired_slaves = [
# Dustin Sallings
MySlave('ubuntu810-64',
max_builds=1),
MySlave('minime',
max_builds=1),
MySlave('freebsd_7',
max_builds=1),
# (gets command timeouts while doing virtualenv install)
MySlave('minimata'),
# maruel
MySlave(
'xp-msysgit',
max_builds=1,
run_single=False,
os='winxp-msys',
# note that use_simple is implicit
),
MySlave(
'win7-cygwin',
max_builds=1,
run_single=False,
os='win7-cygwin',
test_master=False, # master doesn't work on cygwin
# note that use_simple is implicit
),
# tomprince
MySlave(
'tomprince-socrates-winxp-1',
max_builds=1,
run_single=False,
os='winxp-msys',
# note that use_simple is implicit
),
# Reto Sonderegger <reto.sonderegger@gmx.ch>
MySlave(
'metrohm-win81',
max_builds=1,
run_single=False,
os='win81',
# note that use_simple is implicit
),
# tomprince
MySlave(
'tomprince-hermes-gentoo-1',
max_builds=1,
run_single=False,
run_config=True,
pypy17=True,
pypy18=True,
),
# Steve 'Ashcrow' Milner
MySlave('centos_5_python2_4'),
# LSU
MySlave(
'bghimi4-2', # ssh -p 2525 djmitche@josh.cct.lsu.edu
max_builds=2,
run_single=False,
run_config=True,
py26=True,
py27=True,
os='osx-mtnlion',
),
MySlave("debian", run_single=False, run_config=False, max_builds=4),
# Dustin Mitchell
MySlave(
'knuth.r.igoro.us',
max_builds=4,
run_single=False,
run_config=True,
py26=True,
py27=True,
nodejs=True,
databases={
'postgres': {'BUILDBOT_TEST_DB_URL':
'postgresql+pg8000://metabuildslave@localhost/metabuildslave'},
'mysql': {'BUILDBOT_TEST_DB_URL':
'mysql+mysqldb://metabuildslave@localhost/metabuildslave'},
},
),
]
def get_slaves(db=None, *args, **kwargs):
rv = {}
for arg in args:
rv.update(arg)
for sl in slaves:
if db and db not in sl.databases:
continue
for k in kwargs:
if getattr(sl, k) != kwargs[k]:
break
else:
rv[sl.slavename] = sl
return rv
def names(slavedict):
return slavedict.keys()