SpecialistOff.NET / Вопросы / Статьи / Фрагменты кода / Резюме / Метки / Помощь / Файлы
НазадМетки: buildbot
The config file is, fundamentally, just a piece of Python code which defines a dictionary named BuildmasterConfig
, with a number of keys that are treated specially. You don’t need to know Python to do the basic configuration, though; you can just copy the sample file’s syntax. If you are comfortable writing Python code, however, you can use all the power of a full programming language to build more complicated configurations.
The BuildmasterConfig
name is the only one which matters: all other names defined during the execution of the file are discarded. When parsing the config file, the Buildmaster generally compares the old configuration with the new one and performs the minimum set of actions necessary to bring Buildbot up to date: Builder
s which are not changed are left untouched, and Builder
s which are modified get to keep their old event history.
The beginning of the master.cfg
file typically starts with something like:
BuildmasterConfig = c = {}
Therefore a config key like change_source
will usually appear in master.cfg
as c['change_source']
.
See Buildmaster Configuration Index for a full list of BuildMasterConfig
keys.
The master configuration file is interpreted as Python, allowing the full flexibility of the language. For the configurations described in this section, a detailed knowledge of Python is not required, but the basic syntax is easily described.
Python comments start with a hash character #
, tuples are defined with (parenthesis, pairs)
, and lists (arrays) are defined with [square, brackets]
. Tuples and lists are mostly interchangeable. Dictionaries (data structures which map keys to values) are defined with curly braces: {'key1': value1, 'key2': value2}
. Function calls (and object instantiations) can use named parameters, like steps.ShellCommand(command=["trial", "hello"])
.
The config file starts with a series of import
statements, which make various kinds of Step
s and Status
targets available for later use. The main BuildmasterConfig
dictionary is created, and then it is populated with a variety of keys, described section-by-section in the subsequent chapters.