Skip to content

Commit f9e8ca8

Browse files
authored
Spack v1 Migration: Reserved Definitions Schema Update (#60)
* Copy over 1-0-7 as 2-0-0 * Remove spack.specs requirements, add required _name, _version definitions * Update changelog * Update required condition on object rather than array * Update $id
1 parent 8c12845 commit f9e8ca8

2 files changed

Lines changed: 188 additions & 0 deletions

File tree

Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
{
2+
"$id": "https://raw.githubusercontent.com/ACCESS-NRI/schema/main/au.org.access-nri/model/spack/environment/deployment/2-0-0.json",
3+
"$schema": "http://json-schema.org/draft-07/schema#",
4+
"title": "Restricted spack environment file schema for ACCESS-NRI continuous deployment",
5+
"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.",
6+
"type": "object",
7+
"additionalProperties": false,
8+
"properties": {
9+
"spack": {
10+
"type": "object",
11+
"default": {},
12+
"additionalProperties": true,
13+
"properties": {
14+
"packages": {
15+
"type": "object",
16+
"default": {},
17+
"additionalProperties": true,
18+
"properties": {
19+
"gcc-runtime": {
20+
"type": "object",
21+
"default": {},
22+
"additionalProperties": true,
23+
"properties": {
24+
"require": {
25+
"type": "array",
26+
"minItems": 1,
27+
"additionalItems": true,
28+
"items": {
29+
"oneOf": [
30+
{
31+
"type": "object"
32+
},
33+
{
34+
"type": "string"
35+
}
36+
]
37+
}
38+
}
39+
}
40+
}
41+
},
42+
"patternProperties": {
43+
"(?!^(all|gcc-runtime)$)(^\\w[\\w-]*)": {
44+
"type": "object",
45+
"default": {},
46+
"additionalProperties": true,
47+
"properties": {
48+
"require": {
49+
"type": "array",
50+
"minItems": 1,
51+
"additionalItems": true,
52+
"items": [
53+
{
54+
"type": "string",
55+
"pattern": "^@[A-Za-z0-9.\\-_=\/]+$"
56+
},
57+
{
58+
"oneOf": [
59+
{
60+
"type": "object"
61+
},
62+
{
63+
"type": "string"
64+
}
65+
]
66+
}
67+
]
68+
}
69+
}
70+
}
71+
}
72+
},
73+
"specs": {
74+
"type": "array",
75+
"default": [],
76+
"minItems": 1,
77+
"items": {
78+
"type": "string"
79+
}
80+
},
81+
"definitions": {
82+
"type": "array",
83+
"default": [],
84+
"items": {
85+
"type": "object",
86+
"required": ["_name", "_version"],
87+
"properties": {
88+
"_name": {
89+
"type": "array",
90+
"minItems": 1,
91+
"maxItems": 1,
92+
"items": {
93+
"type": "string"
94+
}
95+
},
96+
"_version": {
97+
"type": "array",
98+
"minItems": 1,
99+
"maxItems": 1,
100+
"items": {
101+
"type": "string"
102+
}
103+
},
104+
"ROOT_PACKAGE": {
105+
"type": "array",
106+
"minItems": 1,
107+
"maxItems": 1,
108+
"items": {
109+
"type": "string"
110+
}
111+
},
112+
"ROOT_SPEC": {
113+
"type": "array",
114+
"items": {
115+
"type":"object",
116+
"properties": {
117+
"matrix": {
118+
"type": "array",
119+
"items": {
120+
"type": "array",
121+
"items": {
122+
"type": "string"
123+
}
124+
}
125+
},
126+
"exclude": {
127+
"type": "array",
128+
"items": {
129+
"type": "string"
130+
}
131+
}
132+
}
133+
}
134+
}
135+
}
136+
}
137+
}
138+
}
139+
}
140+
},
141+
"if": {
142+
"properties": {
143+
"spack": {
144+
"type": "object",
145+
"properties": {
146+
"specs": {
147+
"type": "array",
148+
"contains": {
149+
"const": "$ROOT_SPEC"
150+
}
151+
}
152+
}
153+
}
154+
}
155+
},
156+
"then": {
157+
"properties": {
158+
"spack": {
159+
"type": "object",
160+
"properties": {
161+
"definitions": {
162+
"allOf": [
163+
{
164+
"type": "array",
165+
"contains": {
166+
"type": "object",
167+
"required": ["ROOT_SPEC"]
168+
}
169+
},
170+
{
171+
"type": "array",
172+
"contains": {
173+
"type": "object",
174+
"required": ["ROOT_PACKAGE"]
175+
}
176+
}
177+
]
178+
}
179+
}
180+
}
181+
}
182+
}
183+
}

au.org.access-nri/model/spack/environment/deployment/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# `spack.yaml` Schema Changelog
22

3+
## 2-0-0
4+
5+
* Require reserved definitions for `spack.definitions[]._name` and `spack.definitions[]._version`
6+
* Relax requirements on `spack.specs` entirely
7+
38
## 1-0-7
49

510
* 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.

0 commit comments

Comments
 (0)