diff --git a/au.org.access-nri/model/spack/environment/deployment/2-0-0.json b/au.org.access-nri/model/spack/environment/deployment/2-0-0.json new file mode 100644 index 0000000..609f0ce --- /dev/null +++ b/au.org.access-nri/model/spack/environment/deployment/2-0-0.json @@ -0,0 +1,183 @@ +{ + "$id": "https://raw.githubusercontent.com/ACCESS-NRI/schema/main/au.org.access-nri/model/spack/environment/deployment/2-0-0.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Restricted spack environment file schema for ACCESS-NRI continuous deployment", + "description": "This schema was adapted from https://github.com/ACCESS-NRI/spack/blob/releases/v0.21/lib/spack/spack/schema/env.py to specify a restricted form of spack.yaml to design generic deployment infrastructure.", + "type": "object", + "additionalProperties": false, + "properties": { + "spack": { + "type": "object", + "default": {}, + "additionalProperties": true, + "properties": { + "packages": { + "type": "object", + "default": {}, + "additionalProperties": true, + "properties": { + "gcc-runtime": { + "type": "object", + "default": {}, + "additionalProperties": true, + "properties": { + "require": { + "type": "array", + "minItems": 1, + "additionalItems": true, + "items": { + "oneOf": [ + { + "type": "object" + }, + { + "type": "string" + } + ] + } + } + } + } + }, + "patternProperties": { + "(?!^(all|gcc-runtime)$)(^\\w[\\w-]*)": { + "type": "object", + "default": {}, + "additionalProperties": true, + "properties": { + "require": { + "type": "array", + "minItems": 1, + "additionalItems": true, + "items": [ + { + "type": "string", + "pattern": "^@[A-Za-z0-9.\\-_=\/]+$" + }, + { + "oneOf": [ + { + "type": "object" + }, + { + "type": "string" + } + ] + } + ] + } + } + } + } + }, + "specs": { + "type": "array", + "default": [], + "minItems": 1, + "items": { + "type": "string" + } + }, + "definitions": { + "type": "array", + "default": [], + "items": { + "type": "object", + "required": ["_name", "_version"], + "properties": { + "_name": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "string" + } + }, + "_version": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "string" + } + }, + "ROOT_PACKAGE": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "string" + } + }, + "ROOT_SPEC": { + "type": "array", + "items": { + "type":"object", + "properties": { + "matrix": { + "type": "array", + "items": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "exclude": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + } + } + } + } + }, + "if": { + "properties": { + "spack": { + "type": "object", + "properties": { + "specs": { + "type": "array", + "contains": { + "const": "$ROOT_SPEC" + } + } + } + } + } + }, + "then": { + "properties": { + "spack": { + "type": "object", + "properties": { + "definitions": { + "allOf": [ + { + "type": "array", + "contains": { + "type": "object", + "required": ["ROOT_SPEC"] + } + }, + { + "type": "array", + "contains": { + "type": "object", + "required": ["ROOT_PACKAGE"] + } + } + ] + } + } + } + } + } + } diff --git a/au.org.access-nri/model/spack/environment/deployment/CHANGELOG.md b/au.org.access-nri/model/spack/environment/deployment/CHANGELOG.md index 9933074..f992f52 100644 --- a/au.org.access-nri/model/spack/environment/deployment/CHANGELOG.md +++ b/au.org.access-nri/model/spack/environment/deployment/CHANGELOG.md @@ -1,5 +1,10 @@ # `spack.yaml` Schema Changelog +## 2-0-0 + +* Require reserved definitions for `spack.definitions[]._name` and `spack.definitions[]._version` +* Relax requirements on `spack.specs` entirely + ## 1-0-7 * Allow the use of `@latest` in `spack.specs[0]`. This is allowed for Prereleases, but not for Releases. This keeps continuity with local builds which can't use not-yet-existing `@git.TAG`s like Prerelease builds can.