schema: required keywords not enforced for spack in config.yaml#252
schema: required keywords not enforced for spack in config.yaml#252bcumming merged 6 commits intoeth-cscs:mainfrom
spack in config.yaml#252Conversation
|
From CI it seems that this makes fail schemas |
fb92224 to
7ebae34
Compare
|
This currently depends on #254. If that proposal gets accepted, this can go on. |
4d57a56 to
74a7fc2
Compare
bcumming
left a comment
There was a problem hiding this comment.
This is a nice little fix and clean up.
I have one possible nit about not setting a default commit: null value for a git repository type.
| "required": ["packages"], | ||
| "properties": { | ||
| "packages": { | ||
| "$ref": "#/$defs/git-repo", |
There was a problem hiding this comment.
Unfortunately, I had to revert it. But I agree, it is quite nice. I'm going to explore how to change the validator in order to deal correctly with defaults also in presence of $ref, but in a following PR.
| "type": "string" | ||
| }, | ||
| "commit": { | ||
| "type": "string" |
There was a problem hiding this comment.
provide a default value for commit?
Stackinator expects this field to be set, and has logic to ignore it if it is None/null.
There was a problem hiding this comment.
@bcumming was it your intention to have both repo and commit mandatory for both spack and spack:packages?
do you mean that you don't want commit to be required? it's perfectly fine. I had two ways to fix with this PR, and looking at the misplaced required I inferred that you wanted it to be required (see in #245 https://github.com/eth-cscs/stackinator/pull/245/files#diff-2bdfe86113f7b73f4dd5fef35aaa8a54fe83e02e02bf212360979e4c23cada84).
Just to be clear, I think that:
- if
commitis required, we can skip the default value - if
commitis not required, we should put a default (and check it in tests)
There was a problem hiding this comment.
I think commit should not be required.
We should provide a default that is null (i.e. empty).
This might seem odd, but the code in stackinator expects the field to be set, and gracefully handles the case where the value is "null".
There was a problem hiding this comment.
It took a bit of time because I encountered a problem with defaults with $ref. Since it is unrelated and it requires some time, I opted for reverting that change and go for duplication, at least for now. It makes even more clear what is going on in this PR.
On the test side, I just added a couple of "in-place" test-cases for spack:commit and spack:packages:commit defaults. Minimal changes to the rest of test recipes, just to make them pass validation.
custom validator for defaults needs an upgrade for $ref. leave it for another separate PR
|
@bcumming @simonpintarelli @msimberg Just to highlight the decision: both Before this PR, just the latter was required and enforced, while the former was in principle required but it was not enforced (together with other properties), due to the misplaced |
PR #245 added to the
configschema some requirements aboutspackandspack:packages.Unfortunately these new changes were just partially enforced, because the schema is not valid due to the
requiredentry forspackbeing nested inproperties.@bcumming was it your intention to have both
repoandcommitmandatory for bothspackandspack:packages?