-
Notifications
You must be signed in to change notification settings - Fork 36
/
status.py
79 lines (65 loc) · 2.62 KB
/
status.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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ###### 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.
from buildbot.status import html
from buildbot.status import words
from buildbot.status.web import authz, auth
from buildbot.status.github import GitHubStatus
from buildbot.process.properties import Interpolate
from buildstatusimage import BuildStatusImageResource
# using simplejson instead of json since Twisted wants ascii instead of unicode
import simplejson as json
status = []
# Load users from external file, see users.json.sample
users = []
for user in json.load(open("users.json")):
users.append((user['username'], user['password']))
authz_cfg = authz.Authz(
# change any of these to True to enable; see the manual for more
# options
auth=auth.BasicAuth(users),
gracefulShutdown=False,
forceBuild='auth', # use this to test your slave once it is set up
forceAllBuilds='auth',
pingBuilder='auth',
stopBuild='auth',
stopAllBuilds='auth',
cancelPendingBuild='auth',
)
class WebStatus(html.WebStatus):
def setupUsualPages(self, numbuilds, num_events, num_events_max):
html.WebStatus.setupUsualPages(self, numbuilds, num_events, num_events_max)
self.putChild("buildstatusimage", BuildStatusImageResource())
status.append(WebStatus(
# http_port="ssl:port=8443:privateKey=/etc/ssl/server.key:certKey=/etc/ssl/server.crt:extraCertChain=/etc/ssl/server.ca-bundle",
http_port=8080,
authz=authz_cfg,
change_hook_auth=["file:changehook.passwd"],
change_hook_dialects={'github': {}},
order_console_by_time=True))
# IRC bot
ircbot = json.load(open("ircbot.json"))
status.append(words.IRC(host=ircbot['server'],
nick=ircbot['nickname'],
password=ircbot['password'],
channels=ircbot['channels'],
notify_events={
'successToException': 1,
'successToFailure': 1,
'failureToSuccess': 1,
'exceptionToSuccess': 1}
))
# GitHub Status
tokens = json.load(open("tokens.json"))
for repo in tokens:
gs = GitHubStatus(
token=tokens[repo]["token"],
repoOwner=tokens[repo]["owner"],
repoName=repo,
sha=Interpolate("%(src:" + repo + ":revision)s"),
startDescription='DEV build started.',
endDescription='DEV build done.')
status.append(gs)