root / guide / master.cfg

Revision 144:60ec3971f3f6, 3.7 kB (checked in by Tarek Ziad?? <tarek@…>, 13 months ago)

Added scripts from the book

Line 
1#!/usr/bin/python
2# -*- coding: UTF-8 -*-
3#
4# Copyright (c) 2007 Tarek Ziadé
5#
6# Authors:
7#   Tarek Ziadé <tarek@ziade.org>
8#
9# This program is free software; you can redistribute it and/or
10# modify it under the terms of the GNU General Public License
11# as published by the Free Software Foundation; either version 2
12# of the License, or (at your option) any later version.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17# GNU General Public License for more details.
18#
19# You should have received a copy of the GNU General Public License
20# along with this program; if not, write to the Free Software
21# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22import datetime, time, os.path
23from buildbot.scheduler import Scheduler, Nightly
24from buildbot.process import step, factory
25from buildbot.status import html
26from buildbot.status import mail
27from buildbot.changes.pb import PBChangeSource
28from twisted.python import log
29
30# configuration
31SVN_USER = 'buildbot'
32SVN_PASSWORD = 'bb426hy544'
33SVN_SERVER = 'localhost/repo'
34TEST_BUNDLE = '/private/ecs/bundles/emencia'
35PATH_BUNDLE = '/private/ecs/build/ecs'
36TARGET_MAIL = 'checkins@lists.emencia.net'
37SOURCE_MAIL = 'buildbot@lists.emencia.net'
38SVN_FRONT_NAME = 'svn.emencia.net'
39
40svnserver = 'http://%s:%s@/%s' % (SVN_USER, SVN_PASSWORD, SVN_SERVER)
41port = 9989
42wport = 8010
43
44class RepositoryScheduler(Scheduler):
45        def __init__(self, name, branch, treeStableTimer, builderNames,
46                     repository, fileIsImportant=None):
47                Scheduler.__init__(self, name, branch, treeStableTimer,
48                                   builderNames, fileIsImportant)
49                self.repository = repository
50
51        def addChange(self, change):
52                # check to make sure the repository matches!
53                cs = change.comments.split(' ')
54                if len(cs) > 0:
55                        repo = cs[0]
56                        log.msg('checking %s vs %s' %
57                                 (repo, self.repository))
58                        if repo != self.repository:
59                                log.msg("%s ignoring repository %s" %
60                                        (self, repo))
61                                return
62                # call our parent since this on the correct repository
63                Scheduler.addChange(self, change)
64
65s = factory.s
66c = BuildmasterConfig = {}
67c['bots'] = [("bot", SVN_PASSWORD)]
68c['sources'] = [PBChangeSource()]
69c['schedulers'] = []
70c['builders'] = []
71c['status'] = []
72
73repos = (('ecs', TEST_BUNDLE
74          'http://%s:%s@%s/%s' % (SVN_USER, SVN_PASSWORD, SVN_SERVER,
75                                  TEST_PATH),)
76
77for name, path, svnurl in repos:
78    quick = Scheduler(name, None, 60, [name])
79    c['schedulers'].append(quick)
80    test_steps = [s(step.SVN,  mode="update", baseURL= svnserver + path,
81                    svnurl=svnurl),
82                  s(step.Test, command=["make", "test"])]
83    test_f = factory.BuildFactory(test_steps)
84    pauline = {'name': name, 'slavename': 'bot',
85                'builddir': name, 'factory': test_f}
86    c['builders'].append(pauline)
87
88names = [name for name, path, svnurl in repos]
89
90c['status'].append(mail.MailNotifier(builders=names,
91                   fromaddr=SOURCE_MAIL,
92                   extraRecipients=[TARGET_MAIL],
93                   mode='failing',
94                   sendToInterestedUsers=True))
95
96
97c['status'].append(html.Waterfall(http_port=wport))
98c['slavePortnum'] = port
99c['projectName'] = "ecs"
100c['projectURL'] = ""
101c['buildbotURL'] = "http://%s:%d/" % (SVN_FRONT_NAME, wport)
Note: See TracBrowser for help on using the browser.