summaryrefslogtreecommitdiff
path: root/master.cfg
blob: 4c7c398db6a40aadc080b9639d2cec4147bc7c83 (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
# -*- python -*-
# ex: set syntax=python:

import textwrap
import ConfigParser

config = ConfigParser.ConfigParser()
config.read('conf.cfg')

# This is the dictionary that the buildmaster pays attention to. We also use
# a shorter alias to save typing.
c = BuildmasterConfig = {}

####### BUILDSLAVES

# The 'slaves' list defines the set of recognized buildslaves. Each element is
# a BuildSlave object, specifying a unique slave name and password.  The same
# slave name and password must be configured on the slave.
import slaves
reload(slaves)
c['slaves'] = slaves.slaves

# 'protocols' contains information about protocols which master will use for
# communicating with slaves.
# You must define at least 'port' option that slaves could connect to your master
# with this protocol.
# 'port' must match the value configured into the buildslaves (with their
# --master option)
PORT_WEB = 8010           # Buildbot webserver port
PORT_MASTER = 9989      # Port where buildbot master listen buildworkers

c['protocols'] = {'pb': {'port': PORT_MASTER}}

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

default_branch = 'develop'
# XXX: leap_mx doesn't need bitmask_client or leap_mail, not sure if two
#      pipelines here are worth it
REPOS=[
    ('leap_pycommon', default_branch, 1, 'leap.common'),
    ('soledad', default_branch, 2, 'leap.soledad'),
    ('keymanager', default_branch, 3, 'leap.keymanager'),
    ('leap_mail', default_branch, 4, 'leap.mail'),
    ('bitmask_client', default_branch, 5, 'leap.bitmask'),
    ('leap_mx', default_branch, 6, 'leap.mx'),
]

from util import github_repo_url, order_repos_index

all_repositories = {
    r'https://github.com/leapcode/leap_pycommon.git': 'leap_pycommon',
    r'https://github.com/leapcode/soledad.git': 'soledad',
    r'https://github.com/leapcode/keymanager.git': 'keymanager',
    r'https://github.com/leapcode/leap_mail.git': 'leap_mail',
    r'https://github.com/leapcode/bitmask_client.git': 'bitmask_client',
    r'https://github.com/leapcode/leap_mx.git': 'leap_mx',
}
def codebaseGenerator(chdict):
    return all_repositories[chdict['repository']]

c['codebaseGenerator'] = codebaseGenerator

from buildbot.plugins import changes
poll_interval_minutes = 5
c['change_source'] = [changes.GitPoller(repourl=github_repo_url(repo_name),
                                        branches=[repo_branch],
                                        workdir=repo_name,
                                        pollInterval=poll_interval_minutes * 60)
                      for repo_name, repo_branch, _, _ in REPOS]

####### SCHEDULERS

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

from buildbot.schedulers.basic import AnyBranchScheduler
from buildbot.schedulers.forcesched import ForceScheduler, CodebaseParameter
from buildbot.changes.filter import ChangeFilter

from buildbot.plugins import schedulers
c['schedulers'] = []

def all_codebases(repo_name):
    codebases = {}

    repo_index = [repo[order_repos_index] for repo in REPOS if repo[0] is repo_name][0]
    for repo_name, repo_branch, _, namespace, in sorted(REPOS, key = lambda repo: repo[order_repos_index])[0:repo_index]:
        codebases[repo_name] = {
            'repository' : github_repo_url(repo_name),
            'branch' : None,
            'revision' : None
        }

    return codebases

def all_codebases_names(repo_name):
    codebases = []

    repo_index = [repo[order_repos_index] for repo in REPOS if repo[0] is repo_name][0]
    for codebase_repo_name, codebase_repo_branch, _, _, in sorted(REPOS, key = lambda repo: repo[order_repos_index])[0:repo_index]:
        codebases.append(CodebaseParameter(codebase=codebase_repo_name, branch=codebase_repo_branch, repository=github_repo_url(codebase_repo_name)))

    return codebases

for repo_name, repo_branch, order_, _ in REPOS:
    c['schedulers'].append(AnyBranchScheduler(
        name=repo_name,
        change_filter = ChangeFilter(codebase=repo_name),
        codebases = all_codebases(repo_name),
        treeStableTimer = 60,
        builderNames=['builder_' + repo_name]))

    c['schedulers'].append(ForceScheduler(
        name="force_build_of_" + repo_name,
        codebases = all_codebases_names(repo_name),
        builderNames=['builder_' + repo_name]))

c['schedulers'].append(ForceScheduler(
    name="force_build_of_wheels",
    builderNames=['builder_wheels']))

c['schedulers'].append(ForceScheduler(
    name="force_build_of_bundler",
    builderNames=['builder_bundler']))

c['schedulers'].append(
    schedulers.Nightly(name='nightly_bundle',
                       branch=None,
                       builderNames=['builder_bundler'],
                       hour=0, minute=0))
c['schedulers'].append(
    schedulers.Nightly(name='nightly_bitmask_client',
                       branch=None,
                       builderNames=['builder_bitmask_client'],
                       hour=23, minute=55))

####### BUILDERS

# The 'builders' list defines the Builders, which tell Buildbot how to perform a build:
# what steps, and which slaves can execute them.  Note that any particular build will
# only take place on one slave.

from builders import Builders

builders = Builders(config, slaves, REPOS)

c['builders'] = []

for repo_name, _, _, _ in REPOS:
    c['builders'].append(builders.create_builder(repo_name))

c['builders'].append(builders.make_wheel_builder())
c['builders'].append(builders.make_bundler_builder())

####### STATUS TARGETS

# 'status' is a list of Status Targets. The results of each build will be
# pushed to these targets. buildbot/status/*.py has a variety to choose from,
# including web pages, email senders, and IRC bots.

c['status'] = []

webinterface_username = "web_interface"
c['www'] = dict(port=PORT_WEB,
                plugins=dict(waterfall_view={}, console_view={}),
                change_hook_dialects={'github': { }})

####### PROJECT IDENTITY

# the 'title' string will appear at the top of this buildbot
# installation's html.WebStatus home page (linked to the
# 'titleURL') and is embedded in the title of the waterfall HTML page.

c['title'] = config.get('Buildbot', 'title')
c['titleURL'] = "https://github.com/leapcode/bitmask_client"

# the 'buildbotURL' string should point to the location where the buildbot's
# internal web server (usually the html.WebStatus page) is visible. This
# typically uses the port number set in the Waterfall 'status' entry, but
# with an externally-visible host name which the buildbot cannot figure out
# without some help.

c['buildbotURL'] = config.get('Buildbot', 'url')

####### 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",
}