-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmaster.cfg
245 lines (172 loc) · 7.46 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
# -*- python -*-
# ex: set syntax=python:
import os, deb822
from buildbot.plugins import *
from debian.changelog import Changelog
####### Config Generic
c = BuildmasterConfig = {}
c['status'] = []
c['slaves'] = []
c['change_source'] = []
c['schedulers'] = []
c['builders'] = []
c['buildbotURL'] = 'http://localhost:8010/'
forced_builders = []
######## CONFIGURACION VCS
vcs = {}
vcs['branches'] = ['master', 'desarrollo']
# rama de desarrollo, de momento la unica donde se construyen paquetes
vcs['dev'] = 'master'
# Cada cuanto tiempo buildbot espera por nuevos cambios en el git
vcs['time'] = 60
# Cada cuanto tiempo buildbot revisar cambios en el git
vcs['pollinterval'] = 60
# '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)
c['protocols'] = {'pb': {'port': 9989}}
##################### FUNCTIONS GENERICS
def parse_changelog(rc, stdout, stderr):
'''
Parsear changelog a partir de un cat <archivo-changelog>
'''
c = Changelog(stdout)
return {'version' : c.full_version,
'package' : c.package}
def parse_control(rc, stdout, stderr):
'''
Parsear un archivo debian control
'''
archi = ''
for control in deb822.Deb822.iter_paragraphs(stdout):
archi = control.get('Architecture')
return {'architecture' : archi}
def check_i386(step):
'''
Funcion que solamente chequea la arquitectura
'''
arch = step.build.getProperty('architecture')
if arch == 'i386' or arch == 'any':
return True
return False
def check_amd64(step):
'''
Funcion que solamente chequea la arquitectura
'''
arch = step.build.getProperty('architecture')
if arch == 'amd64' or arch == 'all':
return True
return False
####### 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.
from buildbot.buildslave import BuildSlave
c['slaves'] = [buildslave.BuildSlave("builder", "11")]
####### 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.
from buildbot.changes.gitpoller import GitPoller
c['change_source'].append(
GitPoller(repourl="https://github.com/Pdosplusplus/connect-vpn",
project= "geekos-buildbot",
branches=["master"],
pollinterval=60)
)
####### 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 buildbot.steps.shell import SetPropertyFromCommand, ShellCommand
from buildbot.process.properties import WithProperties, Interpolate
from buildbot.process.factory import BuildFactory
REPO_DIR = '/var/www/html/repositorio'
package = "connect-vpn"
URL_REPO = "https://github.com/Pdosplusplus/connect-vpn"
CLONE_DIR = 'build'
BUILD_DIR = os.path.join(CLONE_DIR, package)
steps_bdp = [
ShellCommand(command = 'rm -rf *'),
ShellCommand(command = ['git', 'clone', URL_REPO], workdir=CLONE_DIR, haltOnFailure = True),
ShellCommand(command = ['git', 'checkout', vcs['dev']], workdir=BUILD_DIR),
SetPropertyFromCommand(command = "cat debian/changelog", extract_fn=parse_changelog, workdir=BUILD_DIR, haltOnFailure = True),
SetPropertyFromCommand(command = "cat debian/control", extract_fn=parse_control, workdir=BUILD_DIR, haltOnFailure = True),
ShellCommand(command = ['gbp', 'buildpackage', '--git-pbuilder', '--git-dist=jessie', '--git-debian-branch='+vcs['dev'],
'--git-upstream-tree='+vcs['dev'], '--git-arch=i386', '-us', '-uc'], doStepIf=check_i386, workdir=BUILD_DIR, haltOnFailure = True),
ShellCommand(command = ['gbp', 'buildpackage', '--git-pbuilder', '--git-dist=jessie', '--git-debian-branch='+vcs['dev'],
'--git-upstream-tree='+vcs['dev'], '--git-arch=amd64', '-us', '-uc'], doStepIf=check_amd64, workdir=BUILD_DIR, haltOnFailure = True),
ShellCommand(command = WithProperties("lintian %(package)s_%(version)s_%(architecture)s.changes"), workdir=CLONE_DIR, haltOnFailure = False),
ShellCommand(command = WithProperties("reprepro includedeb jessie %(package)s_%(version)s_%(architecture)s.changes"), workdir=REPO_DIR, haltOnFailure = True),
]
from buildbot.config import BuilderConfig
from buildbot.process.factory import BuildFactory
c['builders'].append(
BuilderConfig(
name=package,
factory=BuildFactory(steps_bdp),
slavenames='builder'
)
)
####### SCHEDULERS
# Configure the Schedulers, which decide how to react to incoming changes. In this
# case, just kick off a 'runtests' build
from buildbot.schedulers.basic import SingleBranchScheduler
from buildbot.schedulers.forcesched import ForceScheduler
from buildbot.changes import filter
sbched = SingleBranchScheduler(
name=package,
change_filter = filter.ChangeFilter(project=package,
branch='master'
),
treeStableTimer = 10,
builderNames = [package])
c['schedulers'].append(sbched)
forced_builders.append(package)
#And now we created a ForceScheduler that contain all forced builders:
forced_scheduler = ForceScheduler(
name='Forzar',
builderNames = forced_builders
)
# And we add the force_builders to the schedulers:
c['schedulers'].append(forced_scheduler)
####### 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'] = []
from buildbot.status import html
from buildbot.status.web import authz, auth
authz_cfg=authz.Authz(
# change any of these to True to enable; see the manual for more
# options
auth=auth.BasicAuth([("gescolar","gescolar")]),
gracefulShutdown = False,
forceBuild = 'auth', # use this to test your slave once it is set up
forceAllBuilds = 'auth', # ..or this
pingBuilder = False,
stopBuild = False,
stopAllBuilds = False,
cancelPendingBuild = False,
)
c['status'].append(html.WebStatus(http_port=8010, authz=authz_cfg))
####### 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'] = "Gescolar Buildbot"
c['titleURL'] = "https://geekos-wiki.herokuapp.com"
# 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'] = "http://localhost:8010/"
####### 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",
}