File: programmatic.rst

package info (click to toggle)
buildbot 4.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 21,080 kB
  • sloc: python: 174,183; sh: 1,204; makefile: 332; javascript: 119; xml: 16
file content (22 lines) | stat: -rw-r--r-- 908 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Programmatic Configuration Generation
-------------------------------------

Bearing in mind that ``master.cfg`` is a Python file, large configurations can be shortened
considerably by judicious use of Python loops. For example, the following will generate a builder
for each of a range of supported versions of Python:

.. code-block:: python

    pythons = ['python2.4', 'python2.5', 'python2.6', 'python2.7',
               'python3.2', 'python3.3']
    pytest_workers = ["worker%s" % n for n in range(10)]
    for python in pythons:
        f = util.BuildFactory()
        f.addStep(steps.SVN(...))
        f.addStep(steps.ShellCommand(command=[python, 'test.py']))
        c['builders'].append(util.BuilderConfig(
                name="test-%s" % python,
                factory=f,
                workernames=pytest_workers))

Next step would be the loading of ``pythons`` list from a .yaml/.ini file.