Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
validate: Check configuration against JSON Schema
runtime-spec publishes a JSON Schema covering the configuration format (and other JSON related to runtime-spec) [1]. Reduce duplication of effort by validating configurations against that schema. For example this gives us lots allowed value/type checking: $ cat config.json { "ociVersion": "1.0.0-rc6", "process": { "cwd": "/", "args": [ "sh" ], "user": { "uid": 1, "gid": 1 }, "rlimits": [{}] }, "root": { "path": "rootfs" } } $ ./oci-runtime-tool validate 3 Errors detected: process.rlimits.0.type: Does not match pattern '^RLIMIT_[A-Z]+$' 'POSIXRlimit.Type' should not be empty. rlimit type "" is invalid without us having to duplicate all the work that the runtime-spec folks have already done for us. Only validating the JSON Schema is not sufficient, because --host-specific (e.g. you're running on a Linux box) and cross-property constraits (e.g. must create a new UTS namespace if you set hostname) are difficult/impossible to express in JSON Schema. [1]: https://github.com/opencontainers/runtime-spec/tree/v1.0.0-rc2/schema Signed-off-by: W. Trevor King <wking@tremily.us>
- Loading branch information