summaryrefslogtreecommitdiff
path: root/buildbot/master.cfg
blob: a5dab56ee5640cd5f26f25272cba523a61eac419 (plain)
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
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
import re
from getpass import getuser
from buildbot.steps.source.git import Git
from buildbot.steps.shell import ShellCommand
from buildbot.plugins import (reporters, worker, changes, schedulers, util)

# 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 = {}

# Silence warning and allow very basic phoning home.
c["buildbotNetUsageData"] = "basic"

####### 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"] = [

    ##
    # This worker makes the code coverage and publishes it
    # under the "lcov" Website.
    worker.Worker("lcov-worker", "lcov-pass"),

    ##
    # This worker builds manuals / API docs / tutorials.
    #
    worker.Worker("doc-worker", "doc-pass"),

    ##
    # This worker builds Websites: www and stage.
    #
    worker.Worker("sites-worker", "sites-pass"),

    ##
    # This worker builds Taler for the 'test' deployment.
    worker.Worker("test-worker", "test-pass"),

    ##
    # Tip reserve toppers.
    worker.Worker("test-topper-worker", "test-topper-pass"),
    worker.Worker("demo-topper-worker", "demo-topper-pass"),

    ##
    # This worker compiles the auditor reports for the "green"
    # demo deployment.
    worker.Worker("test-auditor-worker", "test-auditor-pass"),
    worker.Worker("demo-auditor-worker", "test-auditor-pass"),

    ##
    # This worker checks that all the services run under the
    # 'demo' deployment are up&running.
    worker.Worker("demo-worker", "demo-pass"),

    ##
    # This worker builds wallet-core.
    worker.Worker("wallet-worker", "wallet-pass"),
]

# '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": "tcp:9989:interface=127.0.0.1"}}

####### CHANGESOURCES

# the 'change_source' setting tells the buildmaster how it should
# find out about source code changes.

# NOTE: BB is bound to localhost
ALLCS = changes.PBChangeSource(user="allcs", passwd="allcs")

c["change_source"] = [ALLCS]

####### SCHEDULERS

# Configure the Schedulers, which decide how to react to incoming
# changes.


def twister_web_page(change):
    _change = change.asDict()
    repo = _change.get("project")
    if repo in ["www"]:
        return True

    files = _change.get("files")
    for file in files:
        if re.search(r"web", file.get("name", "")) \
                and "twister" == repo:
            return True

    return False


NIGHTLY_SCHEDULER = schedulers.Nightly(
    name="nightly-scheduler",
    builderNames=["lcov-builder",
                  "auditor-builder-demo",
                  "auditor-builder-test"],
    branch="master",
    hour=6,
    minute=0
)

DOC_SCHEDULER = schedulers.SingleBranchScheduler(
    name="periodic-doc-scheduler",
    builderNames=["doc-builder"],
    change_filter=util.ChangeFilter(
        branch_re="(master|stable)", project_re="(docs)"
    ),
    treeStableTimer=None
)

SITES_SCHEDULER = schedulers.SingleBranchScheduler(
    name="sites-scheduler",
    builderNames=["sites-builder"],
    change_filter=util.ChangeFilter(
        branch_re="(master|stable)",
        # Given that filter_fn is used, the line below could be
        # removed (?)
        project_re="(www|twister)",
        filter_fn=twister_web_page
    ),
    treeStableTimer=None
)

WALLET_SCHEDULER = schedulers.SingleBranchScheduler(
    name="wallet-scheduler",
    change_filter=util.ChangeFilter(
        branch="master",
        project_re="(wallet|deployment)"
    ),
    treeStableTimer=None,
    builderNames=["wallet-builder"]
)

DEMO_SERVICES_CHECKER_SCHEDULER = schedulers.Periodic(
    name="demo-services-checker-scheduler",
    periodicBuildTimer=60 * 60,  # 1 hour
    builderNames=["demo-services-checker-builder"]
)

TIP_RESERVE_TOPPER_SCHEDULER = schedulers.Periodic(
    name="tip-reserve-topper-scheduler",
    periodicBuildTimer=60 * 60 * 24 * 10,  # 10 days
    builderNames=["tip-reserve-topper-builder-demo",
                  "tip-reserve-topper-builder-test"]
)

ALL_SCHEDULER = schedulers.SingleBranchScheduler(
    name="all-scheduler",
    change_filter=util.ChangeFilter(
        branch_re="(master|stable)",
        project_re="(backoffice|wallet|bank|exchange|"
        "merchant|deployment|donations|twister|"
        "blog|help|survey|landing)"
    ),
    treeStableTimer=None,
    builderNames=["test-builder"]
)

# Scheduler monitoring the help.git repo; a forgotten repo we
# use to test BB.
DEBUG_SCHEDULER = schedulers.SingleBranchScheduler(
    name="debug-scheduler",
    change_filter=util.ChangeFilter(branch="master", project="help"),
    treeStableTimer=None,
    builderNames=["debug-builder"]
)

# Consider adding other Python parts, like the various frontends.
LINT_SCHEDULER = schedulers.SingleBranchScheduler(
    name="lint-scheduler",
    change_filter=util.ChangeFilter(
        branch="master", project_re="(bank|donations|survey|blog)"
    ),
    treeStableTimer=None,
    builderNames=["lint-builder"]
)

# Provide "force" button in the web UI.  To be removed in the
# future ?
FORCE_SCHEDULER = schedulers.ForceScheduler(
    name="force-scheduler",
    builderNames=[
        "lcov-builder",
        "auditor-builder-test",
        "auditor-builder-demo",
        "test-builder",
        "doc-builder",
        "sites-builder",
        "wallet-builder",
        "tip-reserve-topper-builder-test",
        "tip-reserve-topper-builder-demo"
    ]
)

c["schedulers"] = [
    NIGHTLY_SCHEDULER,
    TIP_RESERVE_TOPPER_SCHEDULER,
    DEMO_SERVICES_CHECKER_SCHEDULER,
    DOC_SCHEDULER,
    SITES_SCHEDULER,
    ALL_SCHEDULER,
    FORCE_SCHEDULER,
    WALLET_SCHEDULER,

    ##
    # Rarely/never used, excluding.
    # DEBUG_SCHEDULER,
    # LINT_SCHEDULER
]

####### 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 git_step(repo):
    return Git(
        repourl=repo,
        mode="full",
        method="fresh",
        logEnviron=False,
        alwaysUseLatest=True,
        haltOnFailure=True,
        branch="master"
    )


WALLET_FACTORY = util.BuildFactory()
WALLET_FACTORY.addStep(git_step("git://git.taler.net/wallet-core.git"))
WALLET_FACTORY.addStep(
    ShellCommand(
        name="fetch",
        description="Running yarn install",
        descriptionDone="Correctly installed",
        command=["npm", "install", "-g", "--prefix", "$HOME", "taler-wallet"],
        workdir="build/"
    )
)
#WALLET_FACTORY.addStep(
#    ShellCommand(
#        name="configuration",
#        description="Running configure script",
#        descriptionDone="Correctly configured",
#        command=["./configure"],
#        workdir="build/"
#    )
#)
WALLET_FACTORY.addStep(
    ShellCommand(
        name="test",
        description="Running wallet tests",
        descriptionDone="Test correctly run",
        command=["./$HOME/bin/taler-wallet-cli", "integrationtest", "--verbose"],
        workdir="build/",
        timeout=3600
    )
)
# WALLET_FACTORY.addStep(
#     ShellCommand(
#         name="lint",
#         description="Linting the wallet",
#         descriptionDone="Linting done",
#         command=["make", "lint"],
#         workdir="build/"
#     )
# )

DEBUG_FACTORY = util.BuildFactory()
DEBUG_FACTORY.addStep(
    ShellCommand(
        name="echo debug",
        description="just echoing a word",
        descriptionDone="builder responded",
        command=["echo", "I'm here!"]
    )
)


def lint_dispatcher(project):
    return "./lint_%s.sh" % project


LINT_FACTORY = util.BuildFactory()
LINT_FACTORY.addStep(
    ShellCommand(
        name="Python linter",
        description="linting Python",
        descriptionDone="linting done",
        command=util.Transform(lint_dispatcher, util.Property("project")),
        workdir="../../deployment/taler-build"
    )
)

LCOV_FACTORY = util.BuildFactory()
LCOV_FACTORY.addStep(
    ShellCommand(
        haltOnFailure=True,
        name="invalidation",
        description="Invalidating timestamps",
        descriptionDone="timestamps invalidated",
        command=["./invalidate.sh"],
        workdir="../../deployment/taler-build",
        env={"TALER_ENV_NAME": "not-test"}
    )
)  # work-around 'set -eu'
LCOV_FACTORY.addStep(
    ShellCommand(
        name="build",
        description="Compiling..",
        descriptionDone="lcov files generated",
        command=["make", "lcov"],
        workdir="../../deployment/taler-build",
        env={
            "PATH": "${HOME}/local/bin:${PATH}",
            "TALER_CHECKDB": "postgres:///talercheck-${USER}"
        }
    )
)

# FIXME: 'demo' reports generator missing.
AUDITOR_FACTORY = util.BuildFactory()
AUDITOR_FACTORY.addStep(
    ShellCommand(
        name="Auditor reports generator",
        description="Generating auditor reports.",
        descriptionDone="Auditor reports correctly generated.",
        command=["./make_auditor_reports.sh"],
        workdir="../../deployment/buildbot"
    )
)

TIP_RESERVE_TOPPER_FACTORY = util.BuildFactory()
TIP_RESERVE_TOPPER_FACTORY.addStep(
    ShellCommand(
        name="tip reserve topper",
        description="Topping the tip reserve.",
        descriptionDone="Tip reserve has been topped.",
        command=["./top_reserve.sh"],
        workdir="../../deployment/buildbot"
    )
)

BUILD_FACTORY = util.BuildFactory()
BUILD_FACTORY.addStep(
    ShellCommand(
        name="build",
        description="Building all Taler codebase.",
        descriptionDone="Taler built.",
        command=["./build.sh"],
        workdir="../../deployment/buildbot",
        haltOnFailure=True
    )
)

BUILD_FACTORY.addStep(
    ShellCommand(
        name="config",
        description="Generating configuration file.",
        descriptionDone="Configuration file generated.",
        command=["./config.sh"],
        workdir="../../deployment/buildbot",
        haltOnFailure=True
    )
)

BUILD_FACTORY.addStep(
    ShellCommand(
        name="keys generation and sign",
        description="Generating exchange keys, and auditor-sign them.",
        descriptionDone="Exchange keys generated, and auditor-signed.",
        command=["./keys.sh"],
        workdir="../../deployment/buildbot",
        haltOnFailure=True,
        env={'BRANCH': util.Property("branch")}
    )
)

BUILD_FACTORY.addStep(
    ShellCommand(
        name="wire details sign",
        description="Signing exchange wire details.",
        descriptionDone="Exchange wire details got signed.",
        command=["./sign.sh"],
        workdir="../../deployment/buildbot",
        haltOnFailure=True,
        env={'BRANCH': util.Property("branch")}
    )
)

BUILD_FACTORY.addStep(
    ShellCommand(
        name="restart services",
        description="Restarting inactive blue-green party.",
        descriptionDone="Restarting Taler.",
        command=["./restart.sh"],
        workdir="../../deployment/buildbot",
        haltOnFailure=True,
        env={'BRANCH': util.Property("branch")}
    )
)

BUILD_FACTORY.addStep(
    ShellCommand(
        name="check services correctly restarted",
        description="Checking services are correctly restarted.",
        descriptionDone="All services are correctly restarted.",
        command=["./checks.sh"],
        workdir="../../deployment/buildbot",
        haltOnFailure=True,
        env={'DEPLOYMENT': "test"}
    )
)

SELENIUM_FACTORY = util.BuildFactory()
SELENIUM_FACTORY.addStep(
    ShellCommand(
        name="selenium",
        description="Headless browser test",
        descriptionDone="Test finished",
        command=["launch_selenium_test"],
        env={'PATH': "${HOME}/local/bin:/usr/lib/chromium:${PATH}"}
    )
)

DOC_FACTORY = util.BuildFactory()
DOC_FACTORY.addStep(
    ShellCommand(
        name="build docs",
        description="Building documentation",
        descriptionDone="Documentation built.",
        command=["./build-docs.sh"],
        workdir="../../deployment/buildbot",
        haltOnFailure=True
    )
)

SITES_FACTORY = util.BuildFactory()
SITES_FACTORY.addStep(
    ShellCommand(
        name="build Web sites",
        description="Building all the Taler homepages",
        descriptionDone="Sites built.",
        command=["./build-sites.sh"],
        workdir="../../deployment/buildbot",
        haltOnFailure=True
    )
)

DEMO_SERVICES_CHECKER_FACTORY = util.BuildFactory()
DEMO_SERVICES_CHECKER_FACTORY.addStep(
    ShellCommand(
        name="demo services checker",
        description="Checking demo services are online",
        descriptionDone="Demo services are online!.",
        command=["./checks.sh"],
        workdir="../../deployment/buildbot",
        haltOnFailure=True,
        # Needed to test the 'demo' deployment.
        env={"DEPLOYMENT": "demo"}
    )
)

DEBUG_BUILDER = util.BuilderConfig(
    name="debug-builder",
    workernames=["debug-worker"],
    factory=DEBUG_FACTORY
)

LINT_BUILDER = util.BuilderConfig(
    name="lint-builder",
    workernames=["lint-worker"],
    factory=LINT_FACTORY
)

LCOV_BUILDER = util.BuilderConfig(
    name="lcov-builder",
    workernames=["lcov-worker"],
    factory=LCOV_FACTORY
)

AUDITOR_BUILDER_TEST = util.BuilderConfig(
    name="auditor-builder-test",
    workernames=["test-auditor-worker"],
    factory=AUDITOR_FACTORY
)

AUDITOR_BUILDER_DEMO = util.BuilderConfig(
    name="auditor-builder-demo",
    workernames=["demo-auditor-worker"],
    factory=AUDITOR_FACTORY
)

TIP_RESERVE_TOPPER_BUILDER_DEMO = util.BuilderConfig(
    name="tip-reserve-topper-builder-demo",
    workernames=["demo-topper-worker"],
    factory=TIP_RESERVE_TOPPER_FACTORY
)

TIP_RESERVE_TOPPER_BUILDER_TEST = util.BuilderConfig(
    name="tip-reserve-topper-builder-test",
    workernames=["test-topper-worker"],
    factory=TIP_RESERVE_TOPPER_FACTORY
)

DEMO_SERVICES_CHECKER_BUILDER = util.BuilderConfig(
    name="demo-services-checker-builder",
    workernames="demo-worker",
    factory=DEMO_SERVICES_CHECKER_FACTORY
)

TEST_BUILDER = util.BuilderConfig(
    name="test-builder", workernames=["test-worker"], factory=BUILD_FACTORY
)

SELENIUM_BUILDER = util.BuilderConfig(
    name="selenium-builder",
    workernames=["selenium-worker"],
    factory=SELENIUM_FACTORY
)

DOC_BUILDER = util.BuilderConfig(
    name="doc-builder", workernames=["doc-worker"], factory=DOC_FACTORY
)

SITES_BUILDER = util.BuilderConfig(
    name="sites-builder", workernames=["sites-worker"], factory=SITES_FACTORY
)

WALLET_BUILDER = util.BuilderConfig(
    name="wallet-builder",
    workernames=["wallet-worker"],
    factory=WALLET_FACTORY
)

c["builders"] = [
    LCOV_BUILDER,
    AUDITOR_BUILDER_TEST,
    AUDITOR_BUILDER_DEMO,
    TEST_BUILDER,
    TIP_RESERVE_TOPPER_BUILDER_DEMO,
    TIP_RESERVE_TOPPER_BUILDER_TEST,
    DEMO_SERVICES_CHECKER_BUILDER,
    DOC_BUILDER,
    SITES_BUILDER,
    WALLET_BUILDER,
]

####### 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.

IRC = reporters.IRC(
    "irc.eu.freenode.net",
    "taler-bb",
    useColors=False,
    channels=[{
        "channel": "#taler"
    }],
    password="taler-bb-pass19",
    notify_events={
        'exception': 1,
        'successToFailure': 1,
        'failureToSuccess': 1
    }
)

EMAIL = reporters.MailNotifier(
    fromaddr="testbuild@taler.net",
    sendToInterestedUsers=False,
    # notify from pass to fail, and viceversa.
    mode=("change"),
    builders=(
        "lcov-builder",
        "doc-builder",
        "test-builder",
        ##
        # Rarely/never used, excluding.
        # "wallet-builder",
        # "selenium-builder"
    ),
    extraRecipients=["buildfailures@taler.net"],
    subject="Taler build."
)

c["services"] = [IRC, EMAIL]

####### PROJECT IDENTITY

c["title"] = "Taler"
c["titleURL"] = "https://taler.net"

# We use nginx to expose the BB under this URL.
c["buildbotURL"] = "https://buildbot.taler.net/"

from taler_bb_userpass_db import USER_PASSWORD_DB

BUILDER_LIST = [
    "doc-builder",
    "lcov-builder",
    "auditor-builder",
    "auditor-builder-test",
    "auditor-builder-demo",
    "demo-services-checker-builder",
    "tip-reserve-topper-builder-demo",
    "tip-reserve-topper-builder-test",
    "sites-builder",
    "test-builder",
    "wallet-builder",
]

authz = util.Authz(
    allowRules=[
        util.ForceBuildEndpointMatcher(role="admins",
                                       builder=b)
        for b in BUILDER_LIST
    ] + [
        util.StopBuildEndpointMatcher(role="admins",
                                      builder=b)
        for b in BUILDER_LIST
    ] + [
        util.RebuildBuildEndpointMatcher(role="admins",
                                         builder=b)
        for b in BUILDER_LIST
    ] + [
        util.ForceBuildEndpointMatcher(role="norole",
                                       builder=b)
        for b in BUILDER_LIST
    ] + [
        util.StopBuildEndpointMatcher(role="norole",
                                      builder=b)
        for b in BUILDER_LIST
    ] + [
        util.RebuildBuildEndpointMatcher(role="norole",
                                         builder=b)
        for b in BUILDER_LIST
    ],
    roleMatchers=[
        util.RolesFromUsername(
            roles=["admins"],
            usernames=["marcello", "florian", "christian"]
        )
    ]
)

# minimalistic config to activate new web UI
c["www"] = {
    "port": 8010,
    "plugins": {
        "waterfall_view": {},
        "console_view": {}
    },
    "allowed_origins": ["https://*.taler.net"],
    "avatar_methods": [],
    "auth": util.UserPasswordAuth(USER_PASSWORD_DB),
    "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",
}