buildbot的master.cfg 文件分析

来源:互联网 发布:济南打车软件 编辑:程序博客网 时间:2024/06/01 10:22
尽量保持和buildbot create-master master 时所创建的内容一致,分析关键点
更多详尽的请阅读官网的手册 http://buildbot.net/repos/release/docs/buildbot.html
jimi@debian:~/buildbot/master$ cat master.cfg

# -*- python -*-
# ex: set syntax=python:                                  #设置Vi的高亮方式

c = BuildmasterConfig = {}

from buildbot.buildslave import BuildSlave
c['slaves'] = [BuildSlave("bot1name", "bot1passwd")]      #创建slave所需的名字和密码

# to limit to two concurrent builds on a slave, use
# c['slaves'] = [BuildSlave("bot1name", "bot1passwd", max_builds=2)] #限制当前slave的在线个数

c['slavePortnum'] = 9989                #slave与master通信的端口号,可以改变

####### CHANGESOURCES

# the 'change_source' setting tells the buildmaster how it should find out
# about source code changes. Any class which implements IChangeSource can be
# put here: there are several in buildbot/changes/*.py to choose from.

#监控源码改变的方式
#from buildbot.changes.pb import PBChangeSource #注释掉
#c['change_source'] = PBChangeSource()                 #注释掉
#我采用SVN的方式
#svnpoller.py 脚本会检测svn服务器上源码的改变
from buildbot.changes.svnpoller import SVNPoller  
c['change_source'] = SVNPoller("svn://192.168.1.100/svn/pro", #工程地址
                    svnuser='', svnpasswd='',   #用户和密码,当时设置为空
                    pollinterval=5)                      #每各5秒查询一次,默认10分钟

####### SCHEDULERS
from buildbot.scheduler import Scheduler
c['schedulers'] = []
c['schedulers'].append(Scheduler(name="all", branch=None,
                                 treeStableTimer=5, #表示在进行代码构建之前,代码保持不变的必要时间。实际上就是代码上传的缓冲时间,过了这个时间,客户端才进行代码构建。
                                 builderNames=["buildbot-full"]))     #网页中显示的名字
####### BUILDERS

#cvsroot = ":pserver:anonymous@cvs.sourceforge.net:/cvsroot/buildbot" #注释掉
#cvsmodule = "buildbot" #注释掉

from buildbot.process import factory
from buildbot.steps.source import SVN
from buildbot.steps.shell import Compile
from buildbot.steps.python_twisted import Trial
#f1 = factory.BuildFactory() #注释掉
#f1.addStep(CVS(cvsroot=cvsroot, cvsmodule=cvsmodule, login="", mode="copy")) #注释掉
#f1.addStep(Compile(command=["python", "./setup.py", "build"])) #注释掉
#f1.addStep(Trial(testpath=".")) #注释掉

f1 = factory.BuildFactory()
f1.addStep(SVN(mode='update', baseURL='svn://192.168.1.100/svn/pro', #工程地址
    defaultBranch=''))       # ?
f1.addStep(Compile(command=["make"]))
#如何想执行的命令都在addStep添加,但命令要存在于slave的path中

b1 = {'name': "buildbot-full", #网页中显示的名字
      'slavename': "bot1name", #slave的名字,没有忘记吧
      'builddir': "full",                   #在master/slave都要生成的目录名字
      'factory': f1,
      }

c['builders'] = [b1]


####### STATUS TARGETS
c['status'] = []
# 结果提交方式,
from buildbot.status import html
c['status'].append(html.WebStatus(http_port=8010))

####### PROJECT IDENTITY
c['projectName'] = "Buildbot"         #工程名字
c['projectURL'] = "http://buildbot.sourceforge.net/" #工程主页

c['buildbotURL'] = "http://localhost:8010/"   #浏览结果的网址


参考
http://blog.chinaunix.net/u2/68938/showart_1076484.html
http://buildbot.net/repos/release/docs/buildbot.html
原创粉丝点击