diff --git a/Standards/scs-0003-v1-sovereign-cloud-standards-yaml.md b/Standards/scs-0003-v1-sovereign-cloud-standards-yaml.md index 43d8219ed..c94d6304e 100644 --- a/Standards/scs-0003-v1-sovereign-cloud-standards-yaml.md +++ b/Standards/scs-0003-v1-sovereign-cloud-standards-yaml.md @@ -137,8 +137,13 @@ Every list of standards consists of several standards that – altogether – de | `name` | String | Full name of the particular standard | _Flavor naming_ | | `url` | String | Valid URL to the latest raw version of the particular standard | _[Flavor naming](https://raw.githubusercontent.com/SovereignCloudStack/standards/main/Standards/scs-0100-v2-flavor-naming.md)_ | | `condition` | String | State of the particular standard, currently either `mandatory` or `optional`, default is `mandatory` | _mandatory_ | +| `parameters` | Map | Maps parameter names to parameter values | | | `checks` | Array | List of all checks that must pass; each entry being a check descriptor | | +The parameters specified here will be added to the variable assignment for all check tools that belong to this standard, so they will be substituted in the same way. +The advantage is that these parameters may show up in the automatically generated documentation, whereas the check tools themselves probably won't. +See the "Standard images" standard in the larger basic example below for a possible use case. + ### Check descriptor The following fields are valid for every check descriptor: @@ -194,7 +199,7 @@ versions: id: flavor-name-check lifetime: day - name: Image metadata - url: https://raw.githubusercontent.com/SovereignCloudStack/Docs/main/Standards/SCS-0004-v1-image-metadata.md + url: https://raw.githubusercontent.com/SovereignCloudStack/standards/main/Standards/scs-0102-v1-image-metadata.md condition: mandatory checks: - executable: image-md-check.py @@ -205,6 +210,14 @@ versions: condition: optional id: image-md-check-2 lifetime: day + - name: Standard images + url: https://raw.githubusercontent.com/SovereignCloudStack/standards/main/Standards/scs-0104-v1-standard-images.md + parameters: + image_spec: https://raw.githubusercontent.com/SovereignCloudStack/standards/main/Tests/iaas/scs-0104-v1-images.yaml + checks: + - executable: ./iaas/standard-images/images-openstack.py + args: -c {os_cloud} -d {image_spec} + id: standard-images-check - version: v4 # This is the upcoming version with a given target date. No further changes should be done to this set of standards stabilized_at: 2022-04-01 standards: diff --git a/Tests/iaas/standard-images/images-openstack.py b/Tests/iaas/standard-images/images-openstack.py index 22182fe80..1bfbdff5c 100755 --- a/Tests/iaas/standard-images/images-openstack.py +++ b/Tests/iaas/standard-images/images-openstack.py @@ -87,6 +87,15 @@ def main(argv): logger.critical("You need to have OS_CLOUD set or pass --os-cloud=CLOUD.") return 1 + # we only support local files; but we allow specifying the following URLs for the sake of + # better documentation + prefix = next(p for p in ( + 'https://raw.githubusercontent.com/SovereignCloudStack/standards/main/Tests/', + 'https://github.com/SovereignCloudStack/standards/blob/main/Tests/', + '', # sentinel (do not remove!) + ) if yaml_path.startswith(p)) + if prefix: + yaml_path = yaml_path[len(prefix):] try: with open(yaml_path, "rb") as fileobj: image_data = yaml.safe_load(fileobj) diff --git a/Tests/scs-compatible-iaas.yaml b/Tests/scs-compatible-iaas.yaml index b40929a41..e721a8139 100644 --- a/Tests/scs-compatible-iaas.yaml +++ b/Tests/scs-compatible-iaas.yaml @@ -37,9 +37,11 @@ versions: id: standard-flavors-check - name: Standard images url: https://raw.githubusercontent.com/SovereignCloudStack/standards/main/Standards/scs-0104-v1-standard-images.md + parameters: + image_spec: https://raw.githubusercontent.com/SovereignCloudStack/standards/main/Tests/iaas/scs-0104-v1-images.yaml checks: - executable: ./iaas/standard-images/images-openstack.py - args: -c {os_cloud} -d ./iaas/scs-0104-v1-images.yaml + args: -c {os_cloud} -d {image_spec} id: standard-images-check - version: v3 stabilized_at: 2023-06-15 diff --git a/Tests/scs-compliance-check.py b/Tests/scs-compliance-check.py index aa7ecd667..6d2ec118d 100755 --- a/Tests/scs-compliance-check.py +++ b/Tests/scs-compliance-check.py @@ -35,7 +35,7 @@ KEYWORDS = { 'spec': ('uuid', 'name', 'url', 'versions', 'prerequisite', 'variables'), 'version': ('version', 'standards', 'stabilized_at', 'deprecated_at'), - 'standard': ('checks', 'url', 'name', 'condition'), + 'standard': ('checks', 'url', 'name', 'condition', 'parameters'), 'check': ('executable', 'env', 'args', 'condition', 'lifetime', 'id', 'section'), } @@ -309,8 +309,11 @@ def main(argv): if config.sections and section not in config.sections: print(f"skipping check '{id_}': not in selected sections") continue - args = check.get('args', '').format(**config.assignment) - env = {key: value.format(**config.assignment) for key, value in check.get('env', {}).items()} + assignment = config.assignment + if "parameters" in standard: + assignment = {**assignment, **standard['parameters']} + args = check.get('args', '').format(**assignment) + env = {key: value.format(**assignment) for key, value in check.get('env', {}).items()} env_str = " ".join(f"{key}={value}" for key, value in env.items()) memo_key = f"{env_str} {check['executable']} {args}".strip() invokation = memo.get(memo_key)