DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Mercurial (d38398e5144e)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
Task Definition YAML Templates

A few kinds of tasks are described using templated YAML files.  These files
allow some limited forms of inheritance and template substitution as well as
the usual YAML features, as described below.

Please do not use these features in new kinds.  If you are tempted to use
variable substitution over a YAML file to define tasks, please instead
implement a new kind-specific transform to accopmlish your goal.  For example,
if the current push-id must be included as an argument in
``task.payload.command``, write a transform function that makes that assignment
while building a job description, rather than parameterizing that value in the
input to the transforms.


One YAML file can "inherit" from another by including a top-level ``$inherits``
key.  That key specifies the parent file in ``from``, and optionally a
collection of variables in ``variables``.  For example:

.. code-block:: yaml

      from: 'tasks/builds/base_linux32.yml'
        build_name: 'linux32'
        build_type: 'dbg'

Inheritance proceeds as follows: First, the child document has its template
substitutions performed and is parsed as YAML.  Then, the parent document is
parsed, with substitutions specified by ``variables`` added to the template
substitutions.  Finally, the child document is merged with the parent.

To merge two JSON objects (dictionaries), each value is merged individually.
Lists are merged by concatenating the lists from the parent and child
documents.  Atomic values (strings, numbers, etc.) are merged by preferring the
child document's value.


Each document is expanded using the PyStache template engine before it is
parsed as YAML.  The parameters for this expansion are specific to the task

Simple value substitution looks like ``{{variable}}``.  Function calls look
like ``{{#function}}argument{{/function}}``.