diff options
author | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2015-07-28 15:23:09 +0000 |
---|---|---|
committer | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2015-10-14 14:34:29 +0000 |
commit | b8b8de2b123ff96e6469196934359485bcd06b04 (patch) | |
tree | 2bb774dcaf3db88d6dafb8ab34322b5df4550ce0 /morphlib/schemas | |
parent | 3c59628c80ffe47992bf7347268ca587fc6d368d (diff) | |
download | morph-b8b8de2b123ff96e6469196934359485bcd06b04.tar.gz |
Add support for Baserock definitions version 7
This adds a new 'Defaults' class to represent definitions defaults
The Python 'jsonschema' module is used to validate the contents of the
Defaults file. This module is already included in Baserock 'build' and
'devel' reference systems by way of the 'openstack-common' stratum.
This commit embeds a copy of the JSON-Schema schema for the DEFAULTS
file. I think the canonical location of this schema should be in the
reference definitions.git, for now. In future, the schemas should maybe
have their own repos. Either way, Morph should embed a copy for the time
being so that we are sure the schema matches how Morph expects to parse
the file.
Morph's automated tests are all updated to use definitions version 7.
I removed most of the tests for built-in build systems, because the
built-ins themselves are no longer part of Morph. Only the mechanism for
defining them needs to be tested now.
Change-Id: I65f8f1c967683ef605852bfae5c68518e53f9981
Diffstat (limited to 'morphlib/schemas')
-rw-r--r-- | morphlib/schemas/defaults.json-schema | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/morphlib/schemas/defaults.json-schema b/morphlib/schemas/defaults.json-schema new file mode 100644 index 00000000..2f713425 --- /dev/null +++ b/morphlib/schemas/defaults.json-schema @@ -0,0 +1,66 @@ +$schema: http://json-schema.org/draft-04/schema# +id: http://git.baserock.org/cgi-bin/cgit.cgi/baserock/baserock/definitions.git/tree/schemas/defaults.json-schema + +description: | + This is a JSON-Schema description of the DEFAULTS file specified in the + Baserock definitions format. DEFAULTS is a YAML file that contains global + defaults for a set of Baserock definitions. + + This JSON-Schema file is valid for VERSION 7 of the Baserock definitions + YAML serialisation format. + + The Baserock definitions YAML serialisation format is the recommended way of + representing Baserock definitions on disk. The actual data model is described + separately. See <https://wiki.baserock.org/definitions> for more information. + + This schema is represented as YAML, so that it can be edited more easily. + You may need to convert to JSON if using a JSON-Schema tool that expects + its input to be an actual string containing data serialised as JSON. + +definitions: + command-sequence: + type: array + items: {type: string} + + build-system: + type: object + additionalProperties: false + properties: + build-commands: {$ref: '#/definitions/command-sequence'} + configure-commands: {$ref: '#/definitions/command-sequence'} + install-commands: {$ref: '#/definitions/command-sequence'} + strip-commands: {$ref: '#/definitions/command-sequence'} + + split-rules: + type: array + items: + type: object + + required: [artifact, include] + additionalProperties: false + + properties: + artifact: {type: string} + include: + type: array + items: + type: string + format: regex + +type: object +additionalProperties: false + +properties: + # Predefined build systems. + build-systems: + type: object + patternProperties: + ^.*$: {$ref: '#/definitions/build-system'} + + # Predefined artifact splitting rules. + split-rules: + type: object + additionalProperties: false + properties: + chunk: {$ref: '#/definitions/split-rules'} + stratum: {$ref: '#/definitions/split-rules'} |