Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions stackinator/schema/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
"type" : "string",
"default" : "/user-environment"
},
"spack" : {
"type" : "object",
"spack": {
"type": "object",
"additionalProperties": false,
"properties" : {
"required": ["repo", "commit", "packages"],
"required": ["repo", "packages"],
"properties": {
"repo": {
"type": "string"
},
Expand All @@ -27,10 +27,10 @@
],
"default": null
},
"packages" : {
"type" : "object",
"packages": {
"type": "object",
"additionalProperties": false,
"required": ["repo", "commit"],
"required": ["repo"],
"properties" : {
"repo": {
"type": "string"
Expand Down Expand Up @@ -77,7 +77,9 @@
},
"version" : {
"type": "number",
"default": 1
"default": 1,
"minimum": 1,
"maximum": 2
}
}
}
1 change: 1 addition & 0 deletions unittests/data/arbor-uenv/meta/recipe/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ spack:
repo: https://github.com/spack/spack.git
store: /user-environment
description: The Arbor neuroscience simulation package and its dependencies for multicore systems.
version: 2
2 changes: 2 additions & 0 deletions unittests/recipes/base-nvgpu/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ store: /user-environment
spack:
repo: https://github.com/spack/spack.git
commit: 6408b51
packages:
repo: https://github.com/spack/spack-packages.git
mirror:
enable: false
version: 2
2 changes: 2 additions & 0 deletions unittests/recipes/cache/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ store: '/user-environment'
spack:
repo: https://github.com/spack/spack.git
commit: 6408b51
packages:
repo: https://github.com/spack/spack-packages.git
mirror:
key: /scratch/e1000/bcumming/secret/spack-key.gpg
enable: true
Expand Down
2 changes: 2 additions & 0 deletions unittests/recipes/host-recipe/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ description: "An example gcc configuration for CPU-only development"
spack:
commit: releases/v0.23
repo: https://github.com/spack/spack.git
packages:
repo: https://github.com/spack/spack-packages.git
version: 2
2 changes: 2 additions & 0 deletions unittests/recipes/with-repo/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ store: '/user-environment'
spack:
repo: https://github.com/spack/spack.git
commit: v21.0
packages:
repo: https://github.com/spack/spack-packages.git
version: 2
45 changes: 45 additions & 0 deletions unittests/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,60 @@ def test_config_yaml(yaml_path):
schema.ConfigValidator.validate(raw)
assert raw["store"] == "/user-environment"
assert raw["spack"]["commit"] is None
assert raw["spack"]["packages"]["commit"] is None
assert raw["modules"] == True # noqa: E712
assert raw["mirror"] == {"enable": True, "key": None}
assert raw["description"] is None

# no spack:commit
config = dedent("""
version: 2
name: env-without-spack-commit
spack:
repo: https://github.com/spack/spack.git
packages:
repo: https://github.com/spack/spack.git
commit: develop-packages
""")
raw = yaml.load(
config,
Loader=yaml.Loader,
)
schema.ConfigValidator.validate(raw)
assert raw["spack"]["commit"] is None
assert raw["spack"]["packages"]["commit"] is not None
assert raw["modules"] == True # noqa: E712
assert raw["mirror"] == {"enable": True, "key": None}
assert raw["description"] is None

# no spack:packages:commit
config = dedent("""
version: 2
name: env-without-spack-packages-commit
spack:
repo: https://github.com/spack/spack.git
commit: develop
packages:
repo: https://github.com/spack/spack.git
""")
raw = yaml.load(
config,
Loader=yaml.Loader,
)
schema.ConfigValidator.validate(raw)
assert raw["spack"]["commit"] == "develop"
assert raw["spack"]["packages"]["commit"] is None
assert raw["modules"] == True # noqa: E712
assert raw["mirror"] == {"enable": True, "key": None}
assert raw["description"] is None

# full config
with open(yaml_path / "config.full.yaml") as fid:
raw = yaml.load(fid, Loader=yaml.Loader)
schema.ConfigValidator.validate(raw)
assert raw["store"] == "/alternative-point"
assert raw["spack"]["commit"] == "6408b51"
assert raw["spack"]["packages"]["commit"] == "v2025.07.0"
assert raw["modules"] == False # noqa: E712
assert raw["mirror"] == {"enable": True, "key": "/home/bob/veryprivate.key"}
assert raw["description"] == "a really useful environment"
Expand Down
4 changes: 4 additions & 0 deletions unittests/yaml/config.defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ spack:
repo: https://github.com/spack/spack.git
# default: None == no `git checkout` command
#commit: 6408b51
packages:
repo: https://github.com/spack/spack-packages.git
# default: None == no `git checkout` command
#commit: 6408b51
#mirror:
# default None
#key: None
Expand Down
3 changes: 3 additions & 0 deletions unittests/yaml/config.full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ store: /alternative-point
spack:
repo: https://github.com/spack/spack.git
commit: 6408b51
packages:
repo: https://github.com/spack/spack-packages.git
commit: v2025.07.0
mirror:
key: /home/bob/veryprivate.key
enable: True
Expand Down