Advertisement
Guest User

Untitled

a guest
Jun 20th, 2013
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 41.53 KB | None | 0 0
  1.  
  2.  
  3. # ========================================================
  4.  
  5. def start(self):
  6.     cmd = RemoteShellCommand(..)
  7.     self.startCommand(cmd, warnings)
  8.  
  9. # ========================================================
  10.  
  11. def myMethod(self):
  12.     d = ...
  13.     d.addCallback(self._myMethod_2) # BAD!
  14. def _myMethod_2(self, res):         # BAD!
  15.     # ...
  16.  
  17. # ========================================================
  18.  
  19. def getRevInfo(revname):
  20.     results = {}
  21.     finished = dict(rev_parse=False, log=False)
  22.  
  23.     rev_parse_d = utils.getProcessOutput(git, [ 'rev-parse', revname ])
  24.     def parse_rev_parse(res):
  25.         return res.strip()
  26.     rev_parse_d.addCallback(parse_rev_parse)
  27.  
  28.     log_d = utils.getProcessOutput(git, [ 'log', '-1', '--format=%s%n%b', results['rev'] ]))
  29.     def parse_log(res):
  30.         return res.strip()
  31.     log_d.addCallback(parse_log)
  32.  
  33.     d = defer.DeferredList([rev_parse_d, log_d], consumeErrors=1, fireOnFirstErrback=1)
  34.     def handle_results(results):
  35.         return dict(rev=results[0][1], log=results[1][1])
  36.     d.addCallback(handle_results)
  37.     return d
  38.  
  39. # ========================================================
  40.  
  41. def pickNextBuild(builder, requests):
  42.     # ...
  43. c['builders'] = [
  44.     BuilderConfig(name='test', factory=f,
  45.         nextBuild=pickNextBuild,
  46.         slavenames=['slave1', 'slave2', 'slave3', 'slave4']),
  47. ]
  48.  
  49. # ========================================================
  50.  
  51. //depot/branch/mybranch/...             //<p4client>/...
  52. -//depot/branch/mybranch/notthisdir/... //<p4client>/notthisdir/...
  53.  
  54. # ========================================================
  55.  
  56. ..     directoryEnterPattern = "make.*: Entering directory [\"`'](.*)['`\"]"
  57. ..     directoryLeavePattern = "make.*: Leaving directory"
  58.  
  59. # ========================================================
  60.  
  61. from buildbot.steps.slave import SetPropertiesFromEnv
  62. from buildbot.steps.shell import Compile
  63.  
  64. f.addStep(SetPropertiesFromEnv(variables=["SOME_JAVA_LIB_HOME", "JAVAC"]))
  65. f.addStep(Compile(commands=[Interpolate("%(prop:JAVAC)s"), "-cp", Interpolate("%(prop:SOME_JAVA_LIB_HOME)s")))
  66.  
  67. # ========================================================
  68.  
  69. from buildbot.steps.trigger import Trigger
  70. f.addStep(Trigger(schedulerNames=['build-prep'],
  71.                   waitForFinish=True,
  72.                   updateSourceStamp=True,
  73.                   set_properties={ 'quick' : False })
  74.  
  75. # ========================================================
  76.  
  77. # .procmailrc
  78. # routes incoming mail to appropriate mailboxes
  79. PATH=/usr/bin:/usr/local/bin
  80. MAILDIR=$HOME/Mail
  81. LOGFILE=.procmail_log
  82. SHELL=/bin/sh
  83.  
  84. :0
  85. *
  86. new
  87.  
  88. # ========================================================
  89.  
  90. !/usr/bin/procmail
  91.  
  92. # ========================================================
  93.  
  94. cvs checkout CVSROOT
  95.  
  96. # ========================================================
  97.  
  98. SomeModule /cvsroot/CVSROOT/buildbot_cvs_mail.py --cvsroot :ext:example.com:/cvsroot -e buildbot -P SomeModule %@{sVv@}
  99.  
  100. # ========================================================
  101.  
  102. driver://[username:password@]host:port/database[?args]
  103.  
  104. # ========================================================
  105.  
  106. from buildbot.steps.shell import ShellCommand
  107. from buildbot.process.properties import Interpolate
  108. f.addStep(ShellCommand(command=[ 'make', Interpolate('REVISION=%(prop:got_revision:-%(src::revision:-unknown)s)s')
  109.                                  'dist' ]))
  110.  
  111. # ========================================================
  112.  
  113. .. note:
  114.  
  115. # ========================================================
  116.  
  117.  @properties.renderer
  118.  def makeCommand(props):
  119.      command = [ 'make' ]
  120.      cpus = props.getProperty('CPUs')
  121.      if cpus:
  122.          command += [ '-j', str(cpus+1) ]
  123.      else:
  124.          command += [ '-j', '2' ]
  125.      command += [ 'all' ]
  126.      return command
  127. f.addStep(ShellCommand(command=makeCommand))
  128.  
  129. # ========================================================
  130.  
  131. f.addStep(ShellCommand(command=[ 'make' ], descriptionDone=FlattenList([ 'make ', [ 'done' ]]))
  132.  
  133. # ========================================================
  134.  
  135. class DetermineFoo(object):
  136.     implements(IRenderable)
  137.     def getRenderingFor(self, props)
  138.         if props.hasProperty('bar'):
  139.             return props['bar']
  140.         elif props.hasProperty('baz'):
  141.             return props['baz']
  142.         return 'qux'
  143. ShellCommand(command=['echo', DetermineFoo()])
  144.  
  145. # ========================================================
  146.  
  147. class Now(object):
  148.     implements(IRenderable)
  149.     def getRenderingFor(self, props)
  150.         return time.clock()
  151. ShellCommand(command=['make', Interpolate('TIME=%(kw:now)', now=Now())])
  152.  
  153. # ========================================================
  154.  
  155. ChoiceStringParameter(name="forced_tests",
  156.     label = "smoke test campaign to run",
  157.     default = default_tests,
  158.     multiple = True,
  159.     strict = True,
  160.     choices = [ "test_builder1",
  161.                 "test_builder2",
  162.                 "test_builder3" ])
  163. ])
  164.  
  165. # .. and later base the schedulers to trigger off this property:
  166.  
  167. # triggers the tests depending on the property forced_test
  168. builder1.factory.addStep(Trigger(name="Trigger tests",
  169.                                 schedulerNames=Property("forced_tests")))
  170.  
  171. # ========================================================
  172.  
  173. def get_compatible_builds(status, builder):
  174.     if builder == None: # this is the case for force_build_all
  175.         return ["cannot generate build list here"]
  176.     # find all successful builds in builder1 and builder2
  177.     builds = []
  178.     for builder in ["builder1","builder2"]:
  179.         builder_status = status.getBuilder(builder)
  180.         for num in xrange(1,40): # 40 last builds
  181.             b = builder_status.getBuild(-num)
  182.             if not b:
  183.                 continue
  184.             if b.getResults() == FAILURE:
  185.                 continue
  186.             builds.append(builder+"/"+str(b.getNumber()))
  187.     return builds
  188.  
  189.     # ...
  190.  
  191.         properties=[
  192.             InheritBuildParameter(
  193.                 name="inherit",
  194.                 label="promote a build for merge",
  195.                 compatible_builds=get_compatible_builds,
  196.                 required = True),
  197.                 ])
  198.  
  199. # ========================================================
  200.  
  201. from buildbot.process.builder import enforceChosenSlave
  202.  
  203. # schedulers:
  204.     ForceScheduler(
  205.       # ...
  206.       properties=[
  207.         BuildslaveChoiceParameter(),
  208.       ]
  209.     )
  210.  
  211. # builders:
  212.     BuilderConfig(
  213.       # ...
  214.       canStartBuild=enforceChosenSlave,
  215.     )
  216.  
  217. # ========================================================
  218.  
  219. c['status'].append(html.WebStatus(..
  220.                    change_hook_dialects={ 'github' : True }))
  221.  
  222. # ========================================================
  223.  
  224. c['status'].append(html.WebStatus(..
  225.                                   change_hook_auth=('user', 'password')))
  226.  
  227. # ========================================================
  228.  
  229. c['status'].append(html.WebStatus(..
  230.                    change_hook_dialects={ 'bitbucket' : True }))
  231.  
  232. # ========================================================
  233.  
  234. c['status'].append(html.WebStatus(..
  235.                                   change_hook_auth=('user', 'password')))
  236.  
  237. # ========================================================
  238.  
  239. curl http://yourbuildbot/change_hook/poller?poller=https%3A%2F%2Famanda.svn.sourceforge.net%2Fsvnroot%2Famanda%2Famanda
  240.  
  241. # ========================================================
  242.  
  243. from buildbot.status.github import GitHubStatus
  244.  
  245. repoOwner = Interpolate("%(prop:github_repo_owner)s"
  246. repoName = Interpolate("%(prop:github_repo_name)s"
  247. sha = Interpolate("%(src::revision)s")
  248. gs = GitHubStatus(token='githubAPIToken',
  249.                   repoOwner=repoOwner,
  250.                   repoName=repoName)
  251.                   sha=sha,
  252.                   startDescription='Build started.',
  253.                   endDescription='Build done.',
  254.                   )
  255. buildbot_bbtools = BuilderConfig(
  256.     name='builder-name',
  257.     slavenames=['slave1'],
  258.     factory=BuilderFactory(),
  259.     properties={
  260.         "github_repo_owner": "buildbot",
  261.         "github_repo_name": "bbtools",
  262.         },
  263.     )
  264. c['builders'].append(buildbot_bbtools)
  265. c['status'].append(gs)
  266.  
  267. # ========================================================
  268.  
  269. pythons = [ 'python2.4', 'python2.5', 'python2.6', 'python2.7',
  270.             'python3.2', python3.3' ]
  271. pytest_slaves = [ "slave%s" % n for n in range(10) ]
  272. for python in pythons:
  273.    f = BuildFactory()
  274.    f.addStep(SVN(..))
  275.    f.addStep(ShellCommand(command=[ python, 'test.py' ]))
  276.    c['builders'].append(BuilderConfig(
  277.            name="test-%s" % python,
  278.            factory=f,
  279.            slavenames=pytest_slaves))
  280.  
  281. # ========================================================
  282.  
  283. class DynamicBuild(Build):
  284.    # .. override some methods
  285.  
  286. f = factory.BuildFactory()
  287. f.buildClass = DynamicBuild
  288. f.addStep(...)
  289.  
  290. # ========================================================
  291.  
  292. class Frobnify(LoggingBuildStep):
  293.    def __init__(self,
  294.            frob_what="frobee",
  295.            frob_how_many=None,
  296.            frob_how=None,
  297.            **kwargs):
  298.  
  299.        # check
  300.        if frob_how_many is None:
  301.            raise TypeError("Frobnify argument how_many is required")
  302.  
  303.        # override a parent option
  304.        kwargs['parentOpt'] = 'xyz'
  305.  
  306.        # call parent
  307.        LoggingBuildStep.__init__(self, **kwargs)
  308.  
  309.        # set Frobnify attributes
  310.        self.frob_what = frob_what
  311.        self.frob_how_many = how_many
  312.        self.frob_how = frob_how
  313.  
  314. class FastFrobnify(Frobnify):
  315.    def __init__(self,
  316.            speed=5,
  317.            **kwargs)
  318.        Frobnify.__init__(self, **kwargs)
  319.        self.speed = speed
  320.  
  321. # ========================================================
  322.  
  323. class MyBuildStep(ShellCommand):
  324.    logfiles = @{ "nodelog": "_test/node.log" @}
  325.  
  326.    def evaluateCommand(self, cmd):
  327.        nodelog = self.getLog("nodelog")
  328.        if "STARTED" in nodelog.getText():
  329.            return SUCCESS
  330.        else:
  331.            return FAILURE
  332.  
  333. # ========================================================
  334.  
  335. from buildbot.steps.shell import ShellCommand
  336. from buildbot.process.buildstep import LogLineObserver
  337.  
  338. class FNURRRGHCounter(LogLineObserver):
  339.    numTests = 0
  340.    def outLineReceived(self, line):
  341.        if "FNURRRGH!" in line:
  342.            self.numTests += 1
  343.            self.step.setProgress('tests', self.numTests)
  344.  
  345. class Framboozle(ShellCommand):
  346.    command = ["framboozler"]
  347.  
  348.    def __init__(self, **kwargs):
  349.        ShellCommand.__init__(self, **kwargs)   # always upcall!
  350.        counter = FNURRRGHCounter())
  351.        self.addLogObserver('stdio', counter)
  352.        self.progressMetrics += ('tests',)
  353.  
  354. # ========================================================
  355.  
  356. git log buildbot-0.8.5..buildbot-0.8.6
  357.  
  358. # ========================================================
  359.  
  360. git log v0.8.6..v0.8.7
  361.  
  362. # ========================================================
  363.  
  364. git log v0.8.7..v0.8.8
  365.  
  366. # ========================================================
  367.  
  368. git log v0.8.8..master
  369.  
  370. # ========================================================
  371.  
  372. cd
  373. mkdir -p tmp/buildbot
  374. cd tmp/buildbot
  375. virtualenv --no-site-packages sandbox
  376. source sandbox/bin/activate
  377. easy_install sqlalchemy==0.7.10
  378. easy_install buildbot
  379.  
  380. # ========================================================
  381.  
  382. buildbot create-master master
  383. mv master/master.cfg.sample master/master.cfg
  384.  
  385. # ========================================================
  386.  
  387. buildbot start master
  388. tail -f master/twistd.log
  389.  
  390. # ========================================================
  391.  
  392. 2011-12-04 10:04:40-0600 [-] Starting factory <buildbot.status.web.baseweb.RotateLogSite instance at 0x2e36638>
  393. 2011-12-04 10:04:40-0600 [-] Setting up http.log rotating 10 files of 10000000 bytes each
  394. 2011-12-04 10:04:40-0600 [-] WebStatus using (/home/dustin/tmp/buildbot/master/public_html)
  395. 2011-12-04 10:04:40-0600 [-] removing 0 old schedulers, updating 0, and adding 1
  396. 2011-12-04 10:04:40-0600 [-] adding 1 new changesources, removing 0
  397. 2011-12-04 10:04:40-0600 [-] gitpoller: using workdir '/home/dustin/tmp/buildbot/master/gitpoller-workdir'
  398. 2011-12-04 10:04:40-0600 [-] gitpoller: initializing working dir from git://github.com/buildbot/pyflakes.git
  399. 2011-12-04 10:04:40-0600 [-] configuration update complete
  400. 2011-12-04 10:04:41-0600 [-] gitpoller: checking out master
  401. 2011-12-04 10:04:41-0600 [-] gitpoller: finished initializing working dir from git://github.com/buildbot/pyflakes.git at rev 1a4af6ec1dbb724b884ea14f439b272f30439e4d
  402.  
  403. # ========================================================
  404.  
  405. cd
  406. cd tmp/buildbot
  407. source sandbox/bin/activate
  408.  
  409. # ========================================================
  410.  
  411. easy_install buildbot-slave
  412.  
  413. # ========================================================
  414.  
  415. buildslave create-slave slave localhost:9989 example-slave pass
  416.  
  417. # ========================================================
  418.  
  419. cat master/master.cfg
  420.  
  421. # ========================================================
  422.  
  423. buildslave start slave
  424.  
  425. # ========================================================
  426.  
  427. tail -f slave/twistd.log
  428.  
  429. # ========================================================
  430.  
  431. 2009-07-29 20:59:18+0200 [Broker,client] message from master: attached
  432. 2009-07-29 20:59:18+0200 [Broker,client] SlaveBuilder.remote_print(buildbot-full): message from master: attached
  433. 2009-07-29 20:59:18+0200 [Broker,client] sending application-level keepalives every 600 seconds
  434.  
  435. # ========================================================
  436.  
  437. 2011-03-13 18:46:58-0700 [Broker,1,127.0.0.1] slave 'example-slave' attaching from IPv4Address(TCP, '127.0.0.1', 41306)
  438. 2011-03-13 18:46:58-0700 [Broker,1,127.0.0.1] Got slaveinfo from 'example-slave'
  439. 2011-03-13 18:46:58-0700 [Broker,1,127.0.0.1] bot attached
  440. 2011-03-13 18:46:58-0700 [Broker,1,127.0.0.1] Buildslave example-slave attached to runtests
  441.  
  442. # ========================================================
  443.  
  444. $ make clean    # clean remnants of previous builds
  445. ...
  446. $ svn update
  447. ...
  448. $ make all
  449. ...
  450. $ make packages
  451. ...
  452. # optional but included in the example: copy packages to some central machine
  453. $ scp packages/*.rpm packages/*.deb packages/*.tgz someuser@somehost:/repository
  454. ...
  455.  
  456. # ========================================================
  457.  
  458. trunkchanged = SingleBranchScheduler(name = "trunkchanged",
  459.                                     change_filter = filter.ChangeFilter(branch = None),
  460. ...
  461.  
  462. # ========================================================
  463.  
  464. trunkchanged = SingleBranchScheduler(name = "trunkchanged",
  465.                                     change_filter = filter.ChangeFilter(project = "coolproject", branch = None),
  466. ...
  467.  
  468. # ========================================================
  469.  
  470. cd
  471. cd tmp/buildbot
  472. source sandbox/bin/activate
  473. $EDITOR master/master.cfg
  474.  
  475. # ========================================================
  476.  
  477. buildbot reconfig master
  478.  
  479. # ========================================================
  480.  
  481. 2011-12-04 10:11:09-0600 [-] loading configuration from /home/dustin/tmp/buildbot/master/master.cfg
  482. 2011-12-04 10:11:09-0600 [-] configuration update started
  483. 2011-12-04 10:11:09-0600 [-] builder runtests is unchanged
  484. 2011-12-04 10:11:09-0600 [-] removing IStatusReceiver <WebStatus on port tcp:8010 at 0x2aee368>
  485. 2011-12-04 10:11:09-0600 [-] (TCP Port 8010 Closed)
  486. 2011-12-04 10:11:09-0600 [-] Stopping factory <buildbot.status.web.baseweb.RotateLogSite instance at 0x2e36638>
  487. 2011-12-04 10:11:09-0600 [-] adding IStatusReceiver <WebStatus on port tcp:8010 at 0x2c2d950>
  488. 2011-12-04 10:11:09-0600 [-] RotateLogSite starting on 8010
  489. 2011-12-04 10:11:09-0600 [-] Starting factory <buildbot.status.web.baseweb.RotateLogSite instance at 0x2e36e18>
  490. 2011-12-04 10:11:09-0600 [-] Setting up http.log rotating 10 files of 10000000 bytes each
  491. 2011-12-04 10:11:09-0600 [-] WebStatus using (/home/dustin/tmp/buildbot/master/public_html)
  492. 2011-12-04 10:11:09-0600 [-] removing 0 old schedulers, updating 0, and adding 0
  493. 2011-12-04 10:11:09-0600 [-] adding 1 new changesources, removing 1
  494. 2011-12-04 10:11:09-0600 [-] gitpoller: using workdir '/home/dustin/tmp/buildbot/master/gitpoller-workdir'
  495. 2011-12-04 10:11:09-0600 [-] GitPoller repository already exists
  496. 2011-12-04 10:11:09-0600 [-] configuration update complete
  497.  
  498. Reconfiguration appears to have completed successfully.
  499.  
  500. # ========================================================
  501.  
  502. c[title'] = "Pyflakes"
  503. c['titleURL'] = "http://divmod.org/trac/wiki/DivmodPyflakes"
  504.  
  505. # ========================================================
  506.  
  507. buildbot reconfig master
  508.  
  509. # ========================================================
  510.  
  511. 2011-12-04 10:12:28-0600 [-] loading configuration from /home/dustin/tmp/buildbot/master/master.cfg
  512. 2011-12-04 10:12:28-0600 [-] configuration update started
  513. 2011-12-04 10:12:28-0600 [-] error while parsing config file
  514. 2011-12-04 10:12:28-0600 [-] Unhandled Error
  515.         Traceback (most recent call last):
  516.         File "/home/dustin/tmp/buildbot/sandbox/lib/python2.7/site-packages/buildbot-0.8.5-py2.7.egg/buildbot/master.py", line 197, in loadTheConfigFile
  517.             d = self.loadConfig(f)
  518.         File "/home/dustin/tmp/buildbot/sandbox/lib/python2.7/site-packages/buildbot-0.8.5-py2.7.egg/buildbot/master.py", line 579, in loadConfig
  519.             d.addCallback(do_load)
  520.         File "/home/dustin/tmp/buildbot/sandbox/lib/python2.7/site-packages/Twisted-11.1.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py", line 298, in addCallback
  521.             callbackKeywords=kw)
  522.         File "/home/dustin/tmp/buildbot/sandbox/lib/python2.7/site-packages/Twisted-11.1.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py", line 287, in addCallbacks
  523.             self._runCallbacks()
  524.         --- <exception caught here> ---
  525.         File "/home/dustin/tmp/buildbot/sandbox/lib/python2.7/site-packages/Twisted-11.1.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py", line 545, in _runCallbacks
  526.             current.result = callback(current.result, *args, **kw)
  527.         File "/home/dustin/tmp/buildbot/sandbox/lib/python2.7/site-packages/buildbot-0.8.5-py2.7.egg/buildbot/master.py", line 226, in do_load
  528.             exec f in localDict
  529.         exceptions.SyntaxError: EOL while scanning string literal (master.cfg, line 17)
  530.  
  531. Never saw reconfiguration finish.
  532.  
  533. # ========================================================
  534.  
  535. grep -i irc master/twistd.log
  536.  
  537. # ========================================================
  538.  
  539. 2009-08-01 15:35:20+0200 [-] adding IStatusReceiver <buildbot.status.words.IRC instance at 0x300d290>
  540.  
  541. # ========================================================
  542.  
  543. bbtest: commands
  544.  
  545. # ========================================================
  546.  
  547. bbtest: help notify
  548.  
  549. # ========================================================
  550.  
  551. bbtest: notify on started
  552. bbtest: notify on finished
  553. bbtest: notify on failure
  554.  
  555. # ========================================================
  556.  
  557. <@lsblakk> bbtest: notify on started
  558. <bbtest> The following events are being notified: ['started']
  559. <@lsblakk> bbtest: notify on finished
  560. <bbtest> The following events are being notified: ['started', 'finished']
  561. <@lsblakk> bbtest: notify on failure
  562. <bbtest> The following events are being notified: ['started', 'failure', 'finished']
  563.  
  564. # ========================================================
  565.  
  566. < bbtest> build #1 of runtests started, including []
  567. < bbtest> build #1 of runtests is complete: Success [build successful]  Build details are at http://localhost:8010/builders/runtests/builds/1
  568.  
  569. # ========================================================
  570.  
  571. bbtest: force build runtests test build
  572.  
  573. # ========================================================
  574.  
  575. <@lsblakk> bbtest: force build runtests test build
  576. < bbtest> build #2 of runtests started, including []
  577. < bbtest> build forced [ETA 0 seconds]
  578. < bbtest> I'll give a shout when the build finishes
  579. < bbtest> build #2 of runtests is complete: Success [build successful]  Build details are at http://localhost:8010/builders/runtests/builds/2
  580.  
  581. # ========================================================
  582.  
  583. cd
  584. cd tmp/buildbot
  585. source sandbox/bin/activate
  586. easy_install pycrypto
  587. easy_install pyasn1
  588.  
  589. # ========================================================
  590.  
  591. ssh -p1234 admin@127.0.0.1
  592. # enter passwd at prompt
  593.  
  594. # ========================================================
  595.  
  596. exceptions.TypeError: argument 2 must be long, not int
  597.  
  598. # ========================================================
  599.  
  600. pip install pyasn1-0.0.13b
  601.  
  602. # ========================================================
  603.  
  604. git clone git://github.com/buildbot/pyflakes.git pyflakes-git
  605. cd pyflakes-git/pyflakes
  606. $EDITOR checker.py
  607. # change "traceTree = False" on line 185 to "traceTree = True"
  608.  
  609. # ========================================================
  610.  
  611. source ~/tmp/buildbot/sandbox/bin/activate
  612. buildbot try --connect=pb --master=127.0.0.1:5555 --username=sampleuser --passwd=samplepass --vc=git
  613.  
  614. # ========================================================
  615.  
  616. cd
  617. mkdir -p tmp/buildbot
  618. cd tmp/buildbot
  619. virtualenv --no-site-packages sandbox
  620. source sandbox/bin/activate
  621. easy_install sqlalchemy==0.7.10
  622. easy_install buildbot
  623.  
  624. # ========================================================
  625.  
  626. buildbot create-master master
  627. mv master/master.cfg.sample master/master.cfg
  628.  
  629. # ========================================================
  630.  
  631. buildbot start master
  632. tail -f master/twistd.log
  633.  
  634. # ========================================================
  635.  
  636. 2011-12-04 10:04:40-0600 [-] Starting factory <buildbot.status.web.baseweb.RotateLogSite instance at 0x2e36638>
  637. 2011-12-04 10:04:40-0600 [-] Setting up http.log rotating 10 files of 10000000 bytes each
  638. 2011-12-04 10:04:40-0600 [-] WebStatus using (/home/dustin/tmp/buildbot/master/public_html)
  639. 2011-12-04 10:04:40-0600 [-] removing 0 old schedulers, updating 0, and adding 1
  640. 2011-12-04 10:04:40-0600 [-] adding 1 new changesources, removing 0
  641. 2011-12-04 10:04:40-0600 [-] gitpoller: using workdir '/home/dustin/tmp/buildbot/master/gitpoller-workdir'
  642. 2011-12-04 10:04:40-0600 [-] gitpoller: initializing working dir from git://github.com/buildbot/pyflakes.git
  643. 2011-12-04 10:04:40-0600 [-] configuration update complete
  644. 2011-12-04 10:04:41-0600 [-] gitpoller: checking out master
  645. 2011-12-04 10:04:41-0600 [-] gitpoller: finished initializing working dir from git://github.com/buildbot/pyflakes.git at rev 1a4af6ec1dbb724b884ea14f439b272f30439e4d
  646.  
  647. # ========================================================
  648.  
  649. cd
  650. cd tmp/buildbot
  651. source sandbox/bin/activate
  652.  
  653. # ========================================================
  654.  
  655. easy_install buildbot-slave
  656.  
  657. # ========================================================
  658.  
  659. buildslave create-slave slave localhost:9989 example-slave pass
  660.  
  661. # ========================================================
  662.  
  663. cat master/master.cfg
  664.  
  665. # ========================================================
  666.  
  667. buildslave start slave
  668.  
  669. # ========================================================
  670.  
  671. tail -f slave/twistd.log
  672.  
  673. # ========================================================
  674.  
  675. 2009-07-29 20:59:18+0200 [Broker,client] message from master: attached
  676. 2009-07-29 20:59:18+0200 [Broker,client] SlaveBuilder.remote_print(buildbot-full): message from master: attached
  677. 2009-07-29 20:59:18+0200 [Broker,client] sending application-level keepalives every 600 seconds
  678.  
  679. # ========================================================
  680.  
  681. 2011-03-13 18:46:58-0700 [Broker,1,127.0.0.1] slave 'example-slave' attaching from IPv4Address(TCP, '127.0.0.1', 41306)
  682. 2011-03-13 18:46:58-0700 [Broker,1,127.0.0.1] Got slaveinfo from 'example-slave'
  683. 2011-03-13 18:46:58-0700 [Broker,1,127.0.0.1] bot attached
  684. 2011-03-13 18:46:58-0700 [Broker,1,127.0.0.1] Buildslave example-slave attached to runtests
  685.  
  686. # ========================================================
  687.  
  688. cd
  689. cd tmp/buildbot
  690. source sandbox/bin/activate
  691. $EDITOR master/master.cfg
  692.  
  693. # ========================================================
  694.  
  695. buildbot reconfig master
  696.  
  697. # ========================================================
  698.  
  699. 2011-12-04 10:11:09-0600 [-] loading configuration from /home/dustin/tmp/buildbot/master/master.cfg
  700. 2011-12-04 10:11:09-0600 [-] configuration update started
  701. 2011-12-04 10:11:09-0600 [-] builder runtests is unchanged
  702. 2011-12-04 10:11:09-0600 [-] removing IStatusReceiver <WebStatus on port tcp:8010 at 0x2aee368>
  703. 2011-12-04 10:11:09-0600 [-] (TCP Port 8010 Closed)
  704. 2011-12-04 10:11:09-0600 [-] Stopping factory <buildbot.status.web.baseweb.RotateLogSite instance at 0x2e36638>
  705. 2011-12-04 10:11:09-0600 [-] adding IStatusReceiver <WebStatus on port tcp:8010 at 0x2c2d950>
  706. 2011-12-04 10:11:09-0600 [-] RotateLogSite starting on 8010
  707. 2011-12-04 10:11:09-0600 [-] Starting factory <buildbot.status.web.baseweb.RotateLogSite instance at 0x2e36e18>
  708. 2011-12-04 10:11:09-0600 [-] Setting up http.log rotating 10 files of 10000000 bytes each
  709. 2011-12-04 10:11:09-0600 [-] WebStatus using (/home/dustin/tmp/buildbot/master/public_html)
  710. 2011-12-04 10:11:09-0600 [-] removing 0 old schedulers, updating 0, and adding 0
  711. 2011-12-04 10:11:09-0600 [-] adding 1 new changesources, removing 1
  712. 2011-12-04 10:11:09-0600 [-] gitpoller: using workdir '/home/dustin/tmp/buildbot/master/gitpoller-workdir'
  713. 2011-12-04 10:11:09-0600 [-] GitPoller repository already exists
  714. 2011-12-04 10:11:09-0600 [-] configuration update complete
  715.  
  716. Reconfiguration appears to have completed successfully.
  717.  
  718. # ========================================================
  719.  
  720. c[title'] = "Pyflakes"
  721. c['titleURL'] = "http://divmod.org/trac/wiki/DivmodPyflakes"
  722.  
  723. # ========================================================
  724.  
  725. buildbot reconfig master
  726.  
  727. # ========================================================
  728.  
  729. 2011-12-04 10:12:28-0600 [-] loading configuration from /home/dustin/tmp/buildbot/master/master.cfg
  730. 2011-12-04 10:12:28-0600 [-] configuration update started
  731. 2011-12-04 10:12:28-0600 [-] error while parsing config file
  732. 2011-12-04 10:12:28-0600 [-] Unhandled Error
  733.         Traceback (most recent call last):
  734.         File "/home/dustin/tmp/buildbot/sandbox/lib/python2.7/site-packages/buildbot-0.8.5-py2.7.egg/buildbot/master.py", line 197, in loadTheConfigFile
  735.             d = self.loadConfig(f)
  736.         File "/home/dustin/tmp/buildbot/sandbox/lib/python2.7/site-packages/buildbot-0.8.5-py2.7.egg/buildbot/master.py", line 579, in loadConfig
  737.             d.addCallback(do_load)
  738.         File "/home/dustin/tmp/buildbot/sandbox/lib/python2.7/site-packages/Twisted-11.1.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py", line 298, in addCallback
  739.             callbackKeywords=kw)
  740.         File "/home/dustin/tmp/buildbot/sandbox/lib/python2.7/site-packages/Twisted-11.1.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py", line 287, in addCallbacks
  741.             self._runCallbacks()
  742.         --- <exception caught here> ---
  743.         File "/home/dustin/tmp/buildbot/sandbox/lib/python2.7/site-packages/Twisted-11.1.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py", line 545, in _runCallbacks
  744.             current.result = callback(current.result, *args, **kw)
  745.         File "/home/dustin/tmp/buildbot/sandbox/lib/python2.7/site-packages/buildbot-0.8.5-py2.7.egg/buildbot/master.py", line 226, in do_load
  746.             exec f in localDict
  747.         exceptions.SyntaxError: EOL while scanning string literal (master.cfg, line 17)
  748.  
  749. Never saw reconfiguration finish.
  750.  
  751. # ========================================================
  752.  
  753. grep -i irc master/twistd.log
  754.  
  755. # ========================================================
  756.  
  757. 2009-08-01 15:35:20+0200 [-] adding IStatusReceiver <buildbot.status.words.IRC instance at 0x300d290>
  758.  
  759. # ========================================================
  760.  
  761. bbtest: commands
  762.  
  763. # ========================================================
  764.  
  765. bbtest: help notify
  766.  
  767. # ========================================================
  768.  
  769. bbtest: notify on started
  770. bbtest: notify on finished
  771. bbtest: notify on failure
  772.  
  773. # ========================================================
  774.  
  775. <@lsblakk> bbtest: notify on started
  776. <bbtest> The following events are being notified: ['started']
  777. <@lsblakk> bbtest: notify on finished
  778. <bbtest> The following events are being notified: ['started', 'finished']
  779. <@lsblakk> bbtest: notify on failure
  780. <bbtest> The following events are being notified: ['started', 'failure', 'finished']
  781.  
  782. # ========================================================
  783.  
  784. < bbtest> build #1 of runtests started, including []
  785. < bbtest> build #1 of runtests is complete: Success [build successful]  Build details are at http://localhost:8010/builders/runtests/builds/1
  786.  
  787. # ========================================================
  788.  
  789. bbtest: force build runtests test build
  790.  
  791. # ========================================================
  792.  
  793. <@lsblakk> bbtest: force build runtests test build
  794. < bbtest> build #2 of runtests started, including []
  795. < bbtest> build forced [ETA 0 seconds]
  796. < bbtest> I'll give a shout when the build finishes
  797. < bbtest> build #2 of runtests is complete: Success [build successful]  Build details are at http://localhost:8010/builders/runtests/builds/2
  798.  
  799. # ========================================================
  800.  
  801. cd
  802. cd tmp/buildbot
  803. source sandbox/bin/activate
  804. easy_install pycrypto
  805. easy_install pyasn1
  806.  
  807. # ========================================================
  808.  
  809. ssh -p1234 admin@127.0.0.1
  810. # enter passwd at prompt
  811.  
  812. # ========================================================
  813.  
  814. exceptions.TypeError: argument 2 must be long, not int
  815.  
  816. # ========================================================
  817.  
  818. pip install pyasn1-0.0.13b
  819.  
  820. # ========================================================
  821.  
  822. git clone git://github.com/buildbot/pyflakes.git pyflakes-git
  823. cd pyflakes-git/pyflakes
  824. $EDITOR checker.py
  825. # change "traceTree = False" on line 185 to "traceTree = True"
  826.  
  827. # ========================================================
  828.  
  829. source ~/tmp/buildbot/sandbox/bin/activate
  830. buildbot try --connect=pb --master=127.0.0.1:5555 --username=sampleuser --passwd=samplepass --vc=git
  831.  
  832. # ========================================================
  833.  
  834. $ make clean    # clean remnants of previous builds
  835. ...
  836. $ svn update
  837. ...
  838. $ make all
  839. ...
  840. $ make packages
  841. ...
  842. # optional but included in the example: copy packages to some central machine
  843. $ scp packages/*.rpm packages/*.deb packages/*.tgz someuser@somehost:/repository
  844. ...
  845.  
  846. # ========================================================
  847.  
  848. trunkchanged = SingleBranchScheduler(name = "trunkchanged",
  849.                                     change_filter = filter.ChangeFilter(branch = None),
  850. ...
  851.  
  852. # ========================================================
  853.  
  854. trunkchanged = SingleBranchScheduler(name = "trunkchanged",
  855.                                     change_filter = filter.ChangeFilter(project = "coolproject", branch = None),
  856. ...
  857.  
  858. # ========================================================
  859.  
  860. driver://[username:password@]host:port/database[?args]
  861.  
  862. # ========================================================
  863.  
  864. # .procmailrc
  865. # routes incoming mail to appropriate mailboxes
  866. PATH=/usr/bin:/usr/local/bin
  867. MAILDIR=$HOME/Mail
  868. LOGFILE=.procmail_log
  869. SHELL=/bin/sh
  870.  
  871. :0
  872. *
  873. new
  874.  
  875. # ========================================================
  876.  
  877. !/usr/bin/procmail
  878.  
  879. # ========================================================
  880.  
  881. cvs checkout CVSROOT
  882.  
  883. # ========================================================
  884.  
  885. SomeModule /cvsroot/CVSROOT/buildbot_cvs_mail.py --cvsroot :ext:example.com:/cvsroot -e buildbot -P SomeModule %@{sVv@}
  886.  
  887. # ========================================================
  888.  
  889. ChoiceStringParameter(name="forced_tests",
  890.    label = "smoke test campaign to run",
  891.    default = default_tests,
  892.    multiple = True,
  893.    strict = True,
  894.    choices = [ "test_builder1",
  895.                "test_builder2",
  896.                "test_builder3" ])
  897. ])
  898.  
  899. # .. and later base the schedulers to trigger off this property:
  900.  
  901. # triggers the tests depending on the property forced_test
  902. builder1.factory.addStep(Trigger(name="Trigger tests",
  903.                                schedulerNames=Property("forced_tests")))
  904.  
  905. # ========================================================
  906.  
  907. def get_compatible_builds(status, builder):
  908.    if builder == None: # this is the case for force_build_all
  909.        return ["cannot generate build list here"]
  910.    # find all successful builds in builder1 and builder2
  911.    builds = []
  912.    for builder in ["builder1","builder2"]:
  913.        builder_status = status.getBuilder(builder)
  914.        for num in xrange(1,40): # 40 last builds
  915.            b = builder_status.getBuild(-num)
  916.            if not b:
  917.                continue
  918.            if b.getResults() == FAILURE:
  919.                continue
  920.            builds.append(builder+"/"+str(b.getNumber()))
  921.    return builds
  922.  
  923.    # ...
  924.  
  925.        properties=[
  926.            InheritBuildParameter(
  927.                name="inherit",
  928.                label="promote a build for merge",
  929.                compatible_builds=get_compatible_builds,
  930.                required = True),
  931.                ])
  932.  
  933. # ========================================================
  934.  
  935. from buildbot.process.builder import enforceChosenSlave
  936.  
  937. # schedulers:
  938.    ForceScheduler(
  939.      # ...
  940.      properties=[
  941.        BuildslaveChoiceParameter(),
  942.      ]
  943.    )
  944.  
  945. # builders:
  946.    BuilderConfig(
  947.      # ...
  948.      canStartBuild=enforceChosenSlave,
  949.    )
  950.  
  951. # ========================================================
  952.  
  953. def pickNextBuild(builder, requests):
  954.    # ...
  955. c['builders'] = [
  956.    BuilderConfig(name='test', factory=f,
  957.        nextBuild=pickNextBuild,
  958.        slavenames=['slave1', 'slave2', 'slave3', 'slave4']),
  959. ]
  960.  
  961. # ========================================================
  962.  
  963. from buildbot.steps.shell import ShellCommand
  964. from buildbot.process.properties import Interpolate
  965. f.addStep(ShellCommand(command=[ 'make', Interpolate('REVISION=%(prop:got_revision:-%(src::revision:-unknown)s)s')
  966.                                 'dist' ]))
  967.  
  968. # ========================================================
  969.  
  970. .. note:
  971.  
  972. # ========================================================
  973.  
  974. @properties.renderer
  975. def makeCommand(props):
  976.     command = [ 'make' ]
  977.     cpus = props.getProperty('CPUs')
  978.     if cpus:
  979.         command += [ '-j', str(cpus+1) ]
  980.     else:
  981.         command += [ '-j', '2' ]
  982.     command += [ 'all' ]
  983.     return command
  984. f.addStep(ShellCommand(command=makeCommand))
  985.  
  986. # ========================================================
  987.  
  988. f.addStep(ShellCommand(command=[ 'make' ], descriptionDone=FlattenList([ 'make ', [ 'done' ]]))
  989.  
  990. # ========================================================
  991.  
  992. class DetermineFoo(object):
  993.    implements(IRenderable)
  994.    def getRenderingFor(self, props)
  995.        if props.hasProperty('bar'):
  996.            return props['bar']
  997.        elif props.hasProperty('baz'):
  998.            return props['baz']
  999.        return 'qux'
  1000. ShellCommand(command=['echo', DetermineFoo()])
  1001.  
  1002. # ========================================================
  1003.  
  1004. class Now(object):
  1005.    implements(IRenderable)
  1006.    def getRenderingFor(self, props)
  1007.        return time.clock()
  1008. ShellCommand(command=['make', Interpolate('TIME=%(kw:now)', now=Now())])
  1009.  
  1010. # ========================================================
  1011.  
  1012. //depot/branch/mybranch/...             //<p4client>/...
  1013. -//depot/branch/mybranch/notthisdir/... //<p4client>/notthisdir/...
  1014.  
  1015. # ========================================================
  1016.  
  1017. ..     directoryEnterPattern = "make.*: Entering directory [\"`'](.*)['`\"]"
  1018. ..     directoryLeavePattern = "make.*: Leaving directory"
  1019.  
  1020. # ========================================================
  1021.  
  1022. from buildbot.steps.slave import SetPropertiesFromEnv
  1023. from buildbot.steps.shell import Compile
  1024.  
  1025. f.addStep(SetPropertiesFromEnv(variables=["SOME_JAVA_LIB_HOME", "JAVAC"]))
  1026. f.addStep(Compile(commands=[Interpolate("%(prop:JAVAC)s"), "-cp", Interpolate("%(prop:SOME_JAVA_LIB_HOME)s")))
  1027.  
  1028. # ========================================================
  1029.  
  1030. from buildbot.steps.trigger import Trigger
  1031. f.addStep(Trigger(schedulerNames=['build-prep'],
  1032.                  waitForFinish=True,
  1033.                  updateSourceStamp=True,
  1034.                  set_properties={ 'quick' : False })
  1035.  
  1036. # ========================================================
  1037.  
  1038. c['status'].append(html.WebStatus(..
  1039.                   change_hook_dialects={ 'github' : True }))
  1040.  
  1041. # ========================================================
  1042.  
  1043. c['status'].append(html.WebStatus(..
  1044.                                  change_hook_auth=('user', 'password')))
  1045.  
  1046. # ========================================================
  1047.  
  1048. c['status'].append(html.WebStatus(..
  1049.                   change_hook_dialects={ 'bitbucket' : True }))
  1050.  
  1051. # ========================================================
  1052.  
  1053. c['status'].append(html.WebStatus(..
  1054.                                  change_hook_auth=('user', 'password')))
  1055.  
  1056. # ========================================================
  1057.  
  1058. curl http://yourbuildbot/change_hook/poller?poller=https%3A%2F%2Famanda.svn.sourceforge.net%2Fsvnroot%2Famanda%2Famanda
  1059.  
  1060. # ========================================================
  1061.  
  1062. from buildbot.status.github import GitHubStatus
  1063.  
  1064. repoOwner = Interpolate("%(prop:github_repo_owner)s"
  1065. repoName = Interpolate("%(prop:github_repo_name)s"
  1066. sha = Interpolate("%(src::revision)s")
  1067. gs = GitHubStatus(token='githubAPIToken',
  1068.                  repoOwner=repoOwner,
  1069.                  repoName=repoName)
  1070.                  sha=sha,
  1071.                  startDescription='Build started.',
  1072.                  endDescription='Build done.',
  1073.                  )
  1074. buildbot_bbtools = BuilderConfig(
  1075.    name='builder-name',
  1076.    slavenames=['slave1'],
  1077.    factory=BuilderFactory(),
  1078.    properties={
  1079.        "github_repo_owner": "buildbot",
  1080.        "github_repo_name": "bbtools",
  1081.        },
  1082.    )
  1083. c['builders'].append(buildbot_bbtools)
  1084. c['status'].append(gs)
  1085.  
  1086. # ========================================================
  1087.  
  1088. pythons = [ 'python2.4', 'python2.5', 'python2.6', 'python2.7',
  1089.            'python3.2', python3.3' ]
  1090. pytest_slaves = [ "slave%s" % n for n in range(10) ]
  1091. for python in pythons:
  1092.     f = BuildFactory()
  1093.     f.addStep(SVN(..))
  1094.     f.addStep(ShellCommand(command=[ python, 'test.py' ]))
  1095.     c['builders'].append(BuilderConfig(
  1096.             name="test-%s" % python,
  1097.             factory=f,
  1098.             slavenames=pytest_slaves))
  1099.  
  1100. # ========================================================
  1101.  
  1102. class DynamicBuild(Build):
  1103.     # .. override some methods
  1104.  
  1105. f = factory.BuildFactory()
  1106. f.buildClass = DynamicBuild
  1107. f.addStep(...)
  1108.  
  1109. # ========================================================
  1110.  
  1111. class Frobnify(LoggingBuildStep):
  1112.     def __init__(self,
  1113.             frob_what="frobee",
  1114.             frob_how_many=None,
  1115.             frob_how=None,
  1116.             **kwargs):
  1117.  
  1118.         # check
  1119.         if frob_how_many is None:
  1120.             raise TypeError("Frobnify argument how_many is required")
  1121.  
  1122.         # override a parent option
  1123.         kwargs['parentOpt'] = 'xyz'
  1124.  
  1125.         # call parent
  1126.         LoggingBuildStep.__init__(self, **kwargs)
  1127.  
  1128.         # set Frobnify attributes
  1129.         self.frob_what = frob_what
  1130.         self.frob_how_many = how_many
  1131.         self.frob_how = frob_how
  1132.  
  1133. class FastFrobnify(Frobnify):
  1134.     def __init__(self,
  1135.             speed=5,
  1136.             **kwargs)
  1137.         Frobnify.__init__(self, **kwargs)
  1138.         self.speed = speed
  1139.  
  1140. # ========================================================
  1141.  
  1142. class MyBuildStep(ShellCommand):
  1143.     logfiles = @{ "nodelog": "_test/node.log" @}
  1144.  
  1145.     def evaluateCommand(self, cmd):
  1146.         nodelog = self.getLog("nodelog")
  1147.         if "STARTED" in nodelog.getText():
  1148.             return SUCCESS
  1149.         else:
  1150.             return FAILURE
  1151.  
  1152. # ========================================================
  1153.  
  1154. from buildbot.steps.shell import ShellCommand
  1155. from buildbot.process.buildstep import LogLineObserver
  1156.  
  1157. class FNURRRGHCounter(LogLineObserver):
  1158.     numTests = 0
  1159.     def outLineReceived(self, line):
  1160.         if "FNURRRGH!" in line:
  1161.             self.numTests += 1
  1162.             self.step.setProgress('tests', self.numTests)
  1163.  
  1164. class Framboozle(ShellCommand):
  1165.     command = ["framboozler"]
  1166.  
  1167.     def __init__(self, **kwargs):
  1168.         ShellCommand.__init__(self, **kwargs)   # always upcall!
  1169.         counter = FNURRRGHCounter())
  1170.         self.addLogObserver('stdio', counter)
  1171.         self.progressMetrics += ('tests',)
  1172.  
  1173. # ========================================================
  1174.  
  1175. def myMethod(self):
  1176.     d = ...
  1177.     d.addCallback(self._myMethod_2) # BAD!
  1178. def _myMethod_2(self, res):         # BAD!
  1179.     # ...
  1180.  
  1181. # ========================================================
  1182.  
  1183. def getRevInfo(revname):
  1184.     results = {}
  1185.     finished = dict(rev_parse=False, log=False)
  1186.  
  1187.     rev_parse_d = utils.getProcessOutput(git, [ 'rev-parse', revname ])
  1188.     def parse_rev_parse(res):
  1189.         return res.strip()
  1190.     rev_parse_d.addCallback(parse_rev_parse)
  1191.  
  1192.     log_d = utils.getProcessOutput(git, [ 'log', '-1', '--format=%s%n%b', results['rev'] ]))
  1193.     def parse_log(res):
  1194.         return res.strip()
  1195.     log_d.addCallback(parse_log)
  1196.  
  1197.     d = defer.DeferredList([rev_parse_d, log_d], consumeErrors=1, fireOnFirstErrback=1)
  1198.     def handle_results(results):
  1199.         return dict(rev=results[0][1], log=results[1][1])
  1200.     d.addCallback(handle_results)
  1201.     return d
  1202.  
  1203. # ========================================================
  1204.  
  1205. def start(self):
  1206.     cmd = RemoteShellCommand(..)
  1207.     self.startCommand(cmd, warnings)
  1208.  
  1209. # ========================================================
  1210.  
  1211. git log v0.8.8..master
  1212.  
  1213. # ========================================================
  1214.  
  1215. git log v0.8.7..v0.8.8
  1216.  
  1217. # ========================================================
  1218.  
  1219. git log v0.8.6..v0.8.7
  1220.  
  1221. # ========================================================
  1222.  
  1223. git log buildbot-0.8.5..buildbot-0.8.6/bin/sh: 1: [[: not found
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement