-
Notifications
You must be signed in to change notification settings - Fork 1
/
master.cfg
418 lines (317 loc) · 20.1 KB
/
master.cfg
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
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
# -*- python -*-
# ex: set filetype=python:
from buildbot.plugins import *
# This is a sample buildmaster config file. It must be installed as
# 'master.cfg' in your buildmaster's base directory.
# This is the dictionary that the buildmaster pays attention to. We also use
# a shorter alias to save typing.
c = BuildmasterConfig = {}
####### WORKERS
# The 'workers' list defines the set of recognized workers. Each element is
# a Worker object, specifying a unique worker name and password. The same
# worker name and password must be configured on the worker.
c['workers'] = [worker.Worker("docker-image-worker", "gadgetron"),
worker.Worker("docker-image-worker2", "gadgetron"),
worker.Worker("gtprep-worker", "gadgetron")]
# 'protocols' contains information about protocols which master will use for
# communicating with workers. You must define at least 'port' option that workers
# could connect to your master with this protocol.
# 'port' must match the value configured into the workers (with their
# --master option)
c['protocols'] = {'pb': {'port': 9989}}
all_repositories = {
r'https://github.com/ismrmrd/ismrmrd.git': 'ismrmrd',
r'https://github.com/gadgetron/gadgetron.git': 'gadgetron',
r'https://github.com/ismrmrd/siemens_to_ismrmrd.git': 'siemens_to_ismrmrd',
r'https://github.com/ismrmrd/ismrmrd-python.git': 'ismrmrd-python',
r'https://github.com/ismrmrd/ismrmrd-python-tools.git': 'ismrmrd-python-tools',
r'[email protected]:NHLBI-MR/gtprep.git':'gtprep'
}
def getTheCodeBases():
codebases = {'ismrmrd': {'repository':'https://github.com/ismrmrd/ismrmrd.git',
'branch':'master',
'revision': None},
'gadgetron': {'repository':'https://github.com/gadgetron/gadgetron.git',
'branch':'master',
'revision': None},
'siemens_to_ismrmrd': {'repository':'https://github.com/ismrmrd/siemens_to_ismrmrd.git',
'branch':'master',
'revision': None},
'ismrmrd-python': {'repository':'https://github.com/ismrmrd/ismrmrd-python.git',
'branch':'master',
'revision': None},
'ismrmrd-python-tools': {'repository':'https://github.com/ismrmrd/ismrmrd-python-tools.git',
'branch':'master',
'revision': None},
'gtprep': {'repository':'[email protected]:NHLBI-MR/gtprep.git',
'branch':'master',
'revision': None}}
return codebases
def codebaseGenerator(chdict):
return all_repositories[chdict['repository']]
c['codebaseGenerator'] = codebaseGenerator
####### CHANGESOURCES
# the 'change_source' setting tells the buildmaster how it should find out
# about source code changes. Here we point to the buildbot clone of pyflakes.
polling_interval = 300 # seconds
project = 'gadgetron'
c['change_source'] = []
c['change_source'].append(changes.GitPoller(
project=project,
repourl='https://github.com/ismrmrd/ismrmrd.git',
workdir='gitpoller-ismrmrd-workdir',
branches=['master'],
pollinterval=polling_interval))
c['change_source'].append(changes.GitPoller(
project=project,
repourl='https://github.com/gadgetron/gadgetron.git',
workdir='gitpoller-gadgetron-workdir',
branches=['master'],
pollinterval=polling_interval))
c['change_source'].append(changes.GitPoller(
project=project,
repourl='https://github.com/ismrmrd/ismrmrd-python.git',
workdir='gitpoller-ismrmrd-python-workdir',
branches=['master'],
pollinterval=polling_interval))
c['change_source'].append(changes.GitPoller(
project=project,
repourl='https://github.com/ismrmrd/ismrmrd-python-tools.git',
workdir='gitpoller-ismrmrd-python-tools-workdir',
branches=['master'],
pollinterval=polling_interval))
c['change_source'].append(changes.GitPoller(
project=project,
repourl='https://github.com/ismrmrd/siemens_to_ismrmrd.git',
workdir='gitpoller-siemens_to_ismrmrd-workdir',
branches=['master'],
pollinterval=polling_interval))
c['change_source'].append(changes.GitPoller(
project=project,
repourl='[email protected]:NHLBI-MR/gtprep.git',
workdir='gitpoller-gtprep-workdir',
branches=['master'],
pollinterval=polling_interval))
####### SCHEDULERS
gtrepos_filter = [u'https://github.com/ismrmrd/ismrmrd.git',
u'https://github.com/gadgetron/gadgetron.git',
u'https://github.com/ismrmrd/siemens_to_ismrmrd.git',
u'https://github.com/ismrmrd/ismrmrd-python.git',
u'https://github.com/ismrmrd/ismrmrd-python-tools.git']
c['schedulers'] = []
c['schedulers'].append(schedulers.SingleBranchScheduler(
name="gadgetron_scheduler",
change_filter=util.ChangeFilter(project='gadgetron', repository=gtrepos_filter,branch='master'),
treeStableTimer=60,
codebases=getTheCodeBases(),
builderNames=["gadgetron_docker_image_builder_no_cuda"]))
image_sch55 = schedulers.SingleBranchScheduler(
name="gadgetron_img55_scheduler",
change_filter=util.ChangeFilter(project='gadgetron', repository=gtrepos_filter, branch='master'),
treeStableTimer=60,
codebases=getTheCodeBases(),
builderNames=["gadgetron_docker_image_builder_cuda55",])
image_sch75 = schedulers.SingleBranchScheduler(
name="gadgetron_img75_scheduler",
change_filter=util.ChangeFilter(project='gadgetron', repository=gtrepos_filter, branch='master'),
treeStableTimer=60,
codebases=getTheCodeBases(),
builderNames=["gadgetron_docker_image_builder_cuda75",])
c['schedulers'].append(image_sch55)
c['schedulers'].append(image_sch75)
c['schedulers'].append(schedulers.ForceScheduler(
name="force",
codebases=[
util.CodebaseParameter(
codebase="gadgetron",
branch="master",
revision="",
repository="https://github.com/gadgetron/gadgetron.git",
project="gadgetron"
),
],
builderNames=["gadgetron_docker_image_builder_no_cuda","gadgetron_docker_image_builder_cuda55", "gadgetron_docker_image_builder_cuda75"]))
c['schedulers'].append(schedulers.ForceScheduler(
codebases=[
util.CodebaseParameter(
codebase="gtprep",
branch="master",
revision="",
repository=u'[email protected]:NHLBI-MR/gtprep.git',
project="gadgetron"
),
util.CodebaseParameter(
codebase="gadgetron",
branch="master",
revision="",
repository="https://github.com/gadgetron/gadgetron.git",
project="gadgetron"
),
],
name="force_scheduler_gtprep",
builderNames=["gtprep_builder55","gtprep_builder75"]))
gtprep_dep_sch55 = schedulers.Dependent(name="gtprep_dependent_scheduler55",
upstream=image_sch55,
codebases=getTheCodeBases(),
builderNames=["gtprep_builder55"])
gtprep_dep_sch75 = schedulers.Dependent(name="gtprep_dependent_scheduler75",
upstream=image_sch75,
codebases=getTheCodeBases(),
builderNames=["gtprep_builder75"])
c['schedulers'].append(gtprep_dep_sch55)
c['schedulers'].append(gtprep_dep_sch75)
c['schedulers'].append(schedulers.SingleBranchScheduler(
name="gtprep_scheduler",
change_filter=util.ChangeFilter(project='gadgetron',repository=u'[email protected]:NHLBI-MR/gtprep.git', branch='master'),
treeStableTimer=60,
codebases=getTheCodeBases(),
builderNames=["gtprep_builder55","gtprep_builder75",]))
####### BUILDERS
# The 'builders' list defines the Builders, which tell Buildbot how to perform a build:
# what steps, and which workers can execute them. Note that any particular build will
# only take place on one worker.
def make_docker_gtprep_factory(base_image, tag, docker_file, tarfile_folder, container_name='gtprep_test_container'):
factory = util.BuildFactory()
# --------------------------------------------------------
# checkout gadgetron source
factory.addStep(steps.Git(repourl='https://github.com/gadgetron/gadgetron.git', workdir='gadgetron-source', branch='master', mode='incremental', codebase='gadgetron', haltOnFailure=True))
# --------------------------------------------------------
# checkout gtprep source
factory.addStep(steps.Git(repourl='[email protected]:NHLBI-MR/gtprep.git', workdir='gtprep-source', branch='master', mode='incremental', codebase='gtprep', haltOnFailure=True))
factory.addStep(steps.ShellCommand(command='cp gadgetron-source/test/integration/*.py gtprep-source/test/integration/', workdir=util.Interpolate('%(prop:builddir)s'), haltOnFailure=True))
# --------------------------------------------------------
# pull base docker image
factory.addStep(steps.ShellCommand(command=['docker', 'pull', base_image], haltOnFailure=True))
# acquire Gadgetron integration test data (2 hour timeout - slowly downloads 8 GBs from Amazon S3)
factory.addStep(steps.ShellCommand(command='python get_data.py', workdir='gadgetron-source/test/integration', timeout=7200, haltOnFailure=True))
# --------------------------------------------------------
# build gtprep
factory.addStep(steps.ShellCommand(command=['docker', 'build', '--no-cache', '--force-rm', '-t', tag, '-f', docker_file, '.'], workdir='gtprep-source', haltOnFailure=True))
# --------------------------------------------------------
# run gadgetron
factory.addStep(steps.ShellCommand(command=['docker/nvidia-docker', 'run', '--detach',
util.Interpolate('--volume=%(prop:builddir)s/gadgetron-source/test/integration:/opt/integration'),
'--name=' + container_name, tag],
workdir='gadgetron-source', env={'GPU': '0', 'NV_GPU': '0'}, haltOnFailure=True))
factory.addStep(steps.ShellCommand(command=['docker','exec','-i', container_name, '/opt/code/gadgetron/build/test/test_all']))
factory.addStep(steps.ShellCommand(command=['docker', 'exec', '-i', container_name, '/bin/bash', '-c', 'cd /opt/integration/ && python run_all_tests.py /opt/code/gadgetron/test/integration/test_cases.txt'],
logfiles={'gadgetronlog': 'gadgetron.log','clientlog':'client.log'},
description='Integration Tests',
workdir='gadgetron-source/test/integration',
timeout=3600, haltOnFailure=True))
factory.addStep(steps.ShellCommand(command=['docker', 'stop', container_name], haltOnFailure=False, alwaysRun=True))
factory.addStep(steps.ShellCommand(command=['docker', 'rm', container_name], haltOnFailure=False, alwaysRun=True))
factory.addStep(steps.ShellCommand(command=['docker/nvidia-docker', 'run', '--detach',
util.Interpolate('--volume=%(prop:builddir)s/gtprep-source/test/integration:/opt/integration'),
util.Interpolate('--volume=%(prop:builddir)s/gtprep_data:/opt/integration/data'),
'--name=' + container_name, tag],
workdir='gadgetron-source', env={'GPU': '0', 'NV_GPU': '0'}, haltOnFailure=True))
factory.addStep(steps.ShellCommand(command=['docker', 'exec', '-i', container_name, '/bin/bash', '-c', 'cd /opt/integration/ && python run_all_tests.py /opt/code/test_cases.txt'],
logfiles={'gadgetronlog': 'gadgetron.log','clientlog':'client.log'},
description='Integration Tests',
workdir='gtprep-source/test/integration',
timeout=3600, haltOnFailure=True))
factory.addStep(steps.ShellCommand(command=['docker', 'stop', container_name], haltOnFailure=False, alwaysRun=True))
factory.addStep(steps.ShellCommand(command=['docker', 'rm', container_name], haltOnFailure=False, alwaysRun=True))
factory.addStep(steps.ShellCommand(command=['./tag_image_with_version.sh', tag], workdir='gadgetron-source/docker', haltOnFailure=False))
factory.addStep(steps.ShellCommand(command=['docker','push',tag],haltOnFailure=True))
factory.addStep(steps.ShellCommand(command=['./remove_all_but_latest.sh', tag], workdir='gadgetron-source/docker', haltOnFailure=False))
return factory
def make_docker_image_generator_factory(base_image, docker_config_path, tag, rest_port, container_name='buildbot_test_container'):
factory = util.BuildFactory()
#Make sure we have the base image
factory.addStep(steps.ShellCommand(command=['docker', 'pull', base_image], haltOnFailure=True))
# check out the Gadgetron source
factory.addStep(steps.Git(repourl='https://github.com/gadgetron/gadgetron.git', workdir='gadgetron-source', branch='master', mode='incremental', codebase='gadgetron', haltOnFailure=True))
factory.addStep(steps.ShellCommand(command=['docker', 'build', '--no-cache', '--force-rm', '-t', tag, '.'], workdir='gadgetron-source'+docker_config_path, haltOnFailure=True))
#factory.addStep(ShellCommand(command=['docker', 'build', '-t', tag, '.'], workdir='gadgetron-source'+docker_config_path, haltOnFailure=True))
# acquire Gadgetron integration test data (2 hour timeout - slowly downloads 8 GBs from Amazon S3)
factory.addStep(steps.ShellCommand(command='python get_data.py', workdir='gadgetron-source/test/integration', timeout=7200, haltOnFailure=True))
#Start Docker container
factory.addStep(steps.ShellCommand(command=['docker/nvidia-docker', 'run', '--detach',
util.Interpolate('--volume=%(prop:builddir)s/gadgetron-source/test/integration:/opt/integration'),
'--name=' + container_name, tag],
workdir='gadgetron-source', env={'GPU': '0', 'NV_GPU': '0'}, haltOnFailure=True))
factory.addStep(steps.ShellCommand(command=['docker','exec','-i', container_name, '/opt/code/gadgetron/build/test/test_all']))
factory.addStep(steps.ShellCommand(command=['docker', 'exec', '-i', container_name, '/bin/bash', '-c', 'cd /opt/integration/ && python run_all_tests.py /opt/code/gadgetron/test/integration/test_cases.txt'],
logfiles={'gadgetronlog': 'gadgetron.log','clientlog':'client.log'},
description='Integration Tests',
workdir='gadgetron-source/test/integration',
timeout=3600, haltOnFailure=True))
factory.addStep(steps.ShellCommand(command=['./tag_image_with_version.sh', tag], workdir='gadgetron-source/docker', haltOnFailure=False))
factory.addStep(steps.ShellCommand(command=['docker','push',tag],haltOnFailure=True))
#Stop and delete container
factory.addStep(steps.ShellCommand(command=['docker', 'stop', container_name], haltOnFailure=False, alwaysRun=True))
factory.addStep(steps.ShellCommand(command=['docker', 'rm', container_name], haltOnFailure=False, alwaysRun=True))
factory.addStep(steps.ShellCommand(command=['./remove_all_but_latest.sh', tag], workdir='gadgetron-source/docker', haltOnFailure=False))
return factory
build_lock = util.WorkerLock("slave_builds", maxCount = 10)
gtprep_build_lock = util.WorkerLock("gtprep_slave_builds", maxCount = 10)
c['builders'] = []
factory = make_docker_image_generator_factory("gadgetron/ubuntu1604_base", "/docker/incremental/ubuntu_1604_no_cuda","gadgetron/ubuntu_1604_no_cuda", 9902,"buildbot_gadgetron_no_cuda_test")
c['builders'].append(
util.BuilderConfig(name="gadgetron_docker_image_builder_no_cuda",
slavenames=["docker-image-worker"],
factory=factory, locks=[build_lock.access('exclusive')]))
factory = make_docker_image_generator_factory("gadgetron/ubuntu1604_cuda55_base", "/docker/incremental/ubuntu_1604_cuda55","gadgetron/ubuntu_1604_cuda55", 9902,"buildbot_gadgetron_cuda55_test")
c['builders'].append(
util.BuilderConfig(name="gadgetron_docker_image_builder_cuda55",
slavenames=["docker-image-worker"],
factory=factory, locks=[build_lock.access('exclusive')]))
factory = make_docker_image_generator_factory("gadgetron/ubuntu1604_cuda75_base", "/docker/incremental/ubuntu_1604_cuda75","gadgetron/ubuntu_1604_cuda75", 9902,"buildbot_gadgetron_cuda75_test")
c['builders'].append(
util.BuilderConfig(name="gadgetron_docker_image_builder_cuda75",
slavenames=["docker-image-worker2"],
factory=factory, locks=[build_lock.access('exclusive')]))
factory = make_docker_gtprep_factory("gadgetron/ubuntu_1604_cuda75", "xueh2/gadgetron_ubuntu1604_cuda_gtprep", "docker/incremental_ubuntu_1604/gtprep_cuda75_mkl/Dockerfile", '/home/GADGETRON_CUDA75/',container_name='gtprep_test_container75')
c['builders'].append(
util.BuilderConfig(name="gtprep_builder75",
slavenames=["gtprep-worker"],
factory=factory, locks=[gtprep_build_lock.access('exclusive')]))
factory = make_docker_gtprep_factory("gadgetron/ubuntu_1604_cuda55", "hansenms/gadgetron_ubuntu1604_cuda_gtprep55", "docker/incremental_ubuntu_1604/gtprep_cuda55_mkl/Dockerfile", '/home/GADGETRON_CUDA55/', container_name='gtprep_test_container55')
c['builders'].append(
util.BuilderConfig(name="gtprep_builder55",
slavenames=["gtprep-worker"],
factory=factory, locks=[gtprep_build_lock.access('exclusive')]))
####### BUILDBOT SERVICES
# 'services' is a list of BuildbotService items like reporter targets. The
# status of each build will be pushed to these targets. buildbot/reporters/*.py
# has a variety to choose from, like IRC bots.
c['services'] = []
mn = reporters.MailNotifier(fromaddr="[email protected]",
sendToInterestedUsers=True,
extraRecipients=["[email protected]"],
relayhost="smtp.sendgrid.net", smtpPort=587,
smtpUser="[email protected]",
smtpPassword="Gadg3tr0n!")
c['services'].append(mn)
####### PROJECT IDENTITY
# the 'title' string will appear at the top of this buildbot installation's
# home pages (linked to the 'titleURL').
c['title'] = "Gadgetron"
c['titleURL'] = "https://github.com/gadgetron/gadgetron"
# the 'buildbotURL' string should point to the location where the buildbot's
# internal web server is visible. This typically uses the port number set in
# the 'www' entry below, but with an externally-visible host name which the
# buildbot cannot figure out without some help.
c['buildbotURL'] = "http://gtbuildbot.eastus.cloudapp.azure.com:8010/"
# minimalistic config to activate new web UI
c['www'] = dict(port=8010,
plugins=dict(waterfall_view={}, console_view={}))
authz = util.Authz(
allowRules=[
util.AnyEndpointMatcher(role="gadgetron")
],
roleMatchers=[
util.RolesFromGroups()
]
)
auth=util.GitHubAuth('10b9eeffb0a37d6efc4b', 'e2766b00ab59c894d25132e5def6e91a02aa3d9c')
c['www']['auth'] = auth
c['www']['authz'] = authz
####### DB URL
c['db'] = {
# This specifies what database buildbot uses to store its state. You can leave
# this at its default for all but the largest installations.
'db_url' : "sqlite:///state.sqlite",
}