Package: yamltypes
YamlconfigTools for loading and validating yaml config files.package is shipped with 2 entry points scripts:yamlvalidate: This tool can validate a yaml file against its spec.The spec file can be either automatically found given the filename or given as parameter with--metayaml2rst: This tool automatically creates a rst documentation of the types defined in a directory.YamlConfig moduleA common problem for the complex CI system developer is to separate
its configuration logic from its configuration data.Logic is the configuration of the builder, what does it build,
what are the buildsteps, etcData is the parameter you want to easily change in the day to day
maintainance work. What are the slaves, and their capabilities?
What branches are needed to be tracked? under what conditions? etcYamlConfig helps to resolve this problem by providing tools to create
and describe a set of yaml files that are used as input for your master.cfgOriginally made for buildbot configuration, the spec format it defines can
be used to describe any kind of json compatible data.Each parsed yaml file can be given a.meta.yamlfile that acts as a
schema file describing what is allowed in the file, and potencially how to
present it in an edition UI..meta.yamlfile Formatthe meta yaml file is a yaml file made of nested dicts, describing the type
of data the type checker is waiting for.Root Nodethe meta yaml file must describe theroottype, which will snowball
all the nested type checksroot:type:dictkids:param1:type:intparam2:type:stringwill match:param1:1param2:stringvalueimports NodeThe meta yaml file can use types described in another file. For that, it will import
a list of.types.yamlfiles.A.types.yamlis a yaml file defining a map of named types. ex:foo:type:stringvalues:[bar]can be used in amyconfig.meta.yaml:imports:-foo.type.yamlroot:type:dictkids:foo:type:listoffoosBase typesbase types are:intan integerstringa stringbooleana true/false booleanfloata floating point numberCompound typesA value of compound type is composed of several subtypes values or key/value:dictan associative array that has a defined list of childrens keymapan associative array that has an arbitrary list childrens keyslista list of arbitrary valuesseta list that ensure member unicity (you cannot have several time the same value)Specifying types of valuesFormap,list,set, it is possible to specify what type is expected
as the values. The syntax is:type:<compound_type>of<type>sfor example, following types are validtype:mapofstringstype:listofintstype:listofsetsofintsUser defined typesYou can specify a meta.yaml file defining the map of types, you can reuse inside your
main meta.yaml file. e.g:location:type:stringvalues:[l1,l2,l3,l4,l5,l6]This defines alocationtype, which is a string with 6 possible values.types modifersEach type can be associated with a number of modifiers, that will extend the number
of specification you describe for it:values:a set of possible values that the attribute can takename:the name of the attribute as displayed in the UIdefault:The value the attribute takes if it is not defined explicitlyforbidden:a python expression checking whether this attribute should not be defined in
a particular configurationrequired:a python expression checking whether this attribute must be defined in
a particular configurationmaybenull:a python expression checking whether this attribute must be defined in
a particular configurationMore complex exampleThemeta.yaml:root:type:dictkids:slaves:type:listofdictsname:Build Slaveskids:caps:type:dictname:Capabilitieskids:builder:name:Used by buildertype:setofstringsvalues:[autolint,build]required:truelocation:type:locationrequired:truespeed:type:stringdefault:fastvalues:[fast,slow]slaves:type:setofstringsmatches a yaml file like:slaves:-caps:builder:[build]location:l4slaves:[buildbot1build]-caps:builder:[autolint,build]location:l1speed:fastslaves:[build3build,build4build,build5build]