1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
"""Schema for the 'container' subsection of Spack environments."""
_stages_from_dockerhub = {
"type": "object",
"additionalProperties": False,
"properties": {
"os": {"type": "string"},
"spack": {
"anyOf": [
{"type": "string"},
{
"type": "object",
"additional_properties": False,
"properties": {
"url": {"type": "string"},
"ref": {"type": "string"},
"resolve_sha": {"type": "boolean", "default": False},
"verify": {"type": "boolean", "default": False},
},
},
]
},
},
"required": ["os", "spack"],
}
_custom_stages = {
"type": "object",
"additionalProperties": False,
"properties": {"build": {"type": "string"}, "final": {"type": "string"}},
"required": ["build", "final"],
}
#: List of packages for the schema below
_list_of_packages = {"type": "array", "items": {"type": "string"}}
#: Schema for the container attribute included in Spack environments
container_schema = {
"type": "object",
"additionalProperties": False,
"properties": {
# The recipe formats that are currently supported by the command
"format": {"type": "string", "enum": ["docker", "singularity"]},
# Describes the base image to start from and the version
# of Spack to be used
"images": {"anyOf": [_stages_from_dockerhub, _custom_stages]},
# Whether or not to strip installed binaries
"strip": {"type": "boolean", "default": True},
# Additional system packages that are needed at runtime
"os_packages": {
"type": "object",
"properties": {
"command": {
"type": "string",
"enum": ["apt", "yum", "zypper", "apk", "yum_amazon"],
},
"update": {"type": "boolean"},
"build": _list_of_packages,
"final": _list_of_packages,
},
"additionalProperties": False,
},
# Add labels to the image
"labels": {"type": "object"},
# Use a custom template to render the recipe
"template": {"type": "string", "default": None},
# Reserved for properties that are specific to each format
"singularity": {
"type": "object",
"additionalProperties": False,
"default": {},
"properties": {
"runscript": {"type": "string"},
"startscript": {"type": "string"},
"test": {"type": "string"},
"help": {"type": "string"},
},
},
"docker": {"type": "object", "additionalProperties": False, "default": {}},
"depfile": {"type": "boolean", "default": False},
},
}
properties = {"container": container_schema}
|