summaryrefslogtreecommitdiff
path: root/buildbot/demo-checker-master.cfg
blob: 3b25e2f497ce47afd47bbfd2d09f1ca930bb16f0 (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
import re
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"] = [
    worker.Worker("demo-checker", "demo-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.

# No need for change sources.

####### SCHEDULERS

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

DEMO_SERVICES_CHECKER_SCHEDULER = schedulers.Periodic(
    name="demo-check-scheduler",
    periodicBuildTimer=60*30, # 1/2 hour
    builderNames=["demo-check-builder"])


# Provide "force" button in the web UI.  To be removed in the
# future ?
FORCE_SCHEDULER = schedulers.ForceScheduler(
    name="force-scheduler",
    builderNames=[
        "demo-check-builder"])

c["schedulers"] = [
    DEMO_SERVICES_CHECKER_SCHEDULER,
    FORCE_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.

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!.",
    # a symlink to a nonupdated deployment checkout.
    command=["/home/demo/demo-oldchecks.sh"],
    workdir="build/buildbot",
    haltOnFailure=True))

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

c["builders"] = [
    DEMO_SERVICES_CHECKER_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.


##
# Currently not used.
def message_formatter(mode, name, build, results, master_status):

    logs = list()
    for line in build.getLogs():
        logs.append(line.getText().splitlines())

    return {
        "body": "\n".join(logs),
        "type": "plain"}

EMAIL = reporters.MailNotifier(
fromaddr="noreply-demochecks@taler.net",
sendToInterestedUsers=False,
# notify from pass to fail, and viceversa.
mode=("change"),
builders=("demo-check-builder"),
    extraRecipients=["demo-feedback@taler.net"],
    subject="Demo state changed.")

c["services"] = [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 = ["demo-check-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",
}