Skip to content

Commit

Permalink
Update schema to support multi-target spack.yaml (#41)
Browse files Browse the repository at this point in the history
* `1-0-3.json`: Update `$id` to be correctly referencing itself

* `1-0-4.json`: Added the requirement for a `root_package` definition if `definitions` is defined

* `1-0-4.json`: Updated constraint to be conditional on `spack.specs[0] == "$ROOT_SPEC"`, updated case

* Update CHANGELOG

* Added $schema key
  • Loading branch information
CodeGat authored Jan 21, 2025
1 parent 053499d commit 060098e
Show file tree
Hide file tree
Showing 3 changed files with 150 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$id": "https://raw.githubusercontent.com/ACCESS-NRI/schema/main/au.org.access-nri/model/spack/environment/deployment/1-0-2.json",
"$id": "https://raw.githubusercontent.com/ACCESS-NRI/schema/main/au.org.access-nri/model/spack/environment/deployment/1-0-3.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.",
Expand Down
142 changes: 142 additions & 0 deletions au.org.access-nri/model/spack/environment/deployment/1-0-4.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
{
"$id": "https://raw.githubusercontent.com/ACCESS-NRI/schema/main/au.org.access-nri/model/spack/environment/deployment/1-0-4.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,
"patternProperties": {
"(?!^all$)(^\\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,
"maxItems": 1,
"items": {
"type": "string",
"pattern": "^.+@git\\.[^ ]+.*$|\\$ROOT_SPEC"
}
},
"definitions": {
"type": "array",
"default": [],
"items": {
"type": "object",
"properties": {
"when": {
"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": {
"properties": {
"specs": {
"contains": {
"const": "$ROOT_SPEC"
}
}
}
}
}
},
"then": {
"properties": {
"spack": {
"properties": {
"definitions": {
"allOf": [
{
"contains": {
"type": "object",
"required": ["ROOT_SPEC"]
}
},
{
"contains": {
"type": "object",
"required": ["ROOT_PACKAGE"]
}
}
]
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# `spack.yaml` Schema Changelog

## 1-0-4

* Updated `spack.definitions` to require definitions for `ROOT_PACKAGE` and `ROOT_SPEC` iff `spack.specs` contains `"$ROOT_SPEC"`.
* Updated `spack.specs` to allow `"$ROOT_SPEC"` in speclist.

This has full interoperability with the earlier schema/data.

## 1-0-3

* Updated `spack.specs` pattern to allow variants following the `@git.VERSION`. This has full interoperability with the earlier schema.
Expand Down

0 comments on commit 060098e

Please sign in to comment.