diff options
-rw-r--r-- | lib/spack/docs/example_files/spack.yaml | 101 | ||||
-rw-r--r-- | lib/spack/spack/schema/cdash.py | 37 | ||||
-rw-r--r-- | lib/spack/spack/schema/gitlab_ci.py | 78 | ||||
-rw-r--r-- | lib/spack/spack/schema/merged.py | 4 |
4 files changed, 220 insertions, 0 deletions
diff --git a/lib/spack/docs/example_files/spack.yaml b/lib/spack/docs/example_files/spack.yaml new file mode 100644 index 0000000000..7af7aebd75 --- /dev/null +++ b/lib/spack/docs/example_files/spack.yaml @@ -0,0 +1,101 @@ +spack: + definitions: + - pkgs: + - readline@7.0 + - compilers: + - '%gcc@5.5.0' + - '%gcc@7.3.0' + - '%clang@6.0.0' + - oses: + - os=ubuntu18.04 + - os=centos7 + + specs: + - matrix: + - [$pkgs] + - [$compilers] + - [$oses] + exclude: + - '%gcc@7.3.0 os=centos7' + + mirrors: + cloud_gitlab: https://mirror.spack.io + + compilers: + # The .gitlab-ci.yml for this project picks a Docker container which is + # based on ubuntu18.04 and which already has some compilers configured. + # Here we just add some of the ones which are defined on a different + # builder image. + - compiler: + operating_system: centos7 + modules: [] + paths: + cc: /not/used + cxx: /not/used + f77: /not/used + fc: /not/used + spec: gcc@5.5.0 + target: x86_64 + - compiler: + operating_system: centos7 + modules: [] + paths: + cc: /not/used + cxx: /not/used + f77: /not/used + fc: /not/used + spec: clang@6.0.0 + target: x86_64 + + + gitlab-ci: + mappings: + - spack-cloud-ubuntu: + match: + # these are specs, if *any* match the spec under consideration, this + # 'mapping' will be used to generate the CI job + - os=ubuntu18.04 + runner-attributes: + # 'tags' and 'image' go directly onto the job, 'variables' will + # be added to what we already necessarily create for the job as + # a part of the CI workflow + tags: + - spack-k8s + image: scottwittenburg/spack_builder_ubuntu_18.04 + - spack-cloud-centos: + match: + # these are specs, if *any* match the spec under consideration, this + # 'mapping' will be used to generate the CI job + - 'os=centos7' + runner-attributes: + tags: + - spack-k8s + image: spack/centos:7 + - summit: + match: + - os=rhel7 + - target=power9 + - platform=secret-sauce + runner-attributes: + tags: + # this is a set of tags + - summit + - '{os}-{target}' + - rhel7 + - centos7 + - x86_64 + variables: + SCHEDULER_ARGS: "arg2 arg2" + + cdash: + build-group: Release Testing + url: https://cdash.spack.io + project: Spack Testing + site: Spack AWS Gitlab Instance + + repos: [] + upstreams: {} + modules: + enable: [] + packages: {} + config: {} diff --git a/lib/spack/spack/schema/cdash.py b/lib/spack/spack/schema/cdash.py new file mode 100644 index 0000000000..f83a5284aa --- /dev/null +++ b/lib/spack/spack/schema/cdash.py @@ -0,0 +1,37 @@ +# Copyright 2013-2019 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 cdash.yaml configuration file. + +.. literalinclude:: ../spack/schema/cdash.py + :lines: 13- +""" + + +#: Properties for inclusion in other schemas +properties = { + 'cdash': { + 'type': 'object', + 'default': {}, + 'additionalProperties': False, + 'required': ['build-group', 'url', 'project', 'site'], + 'patternProperties': { + r'build-group': {'type': 'string'}, + r'url': {'type': 'string'}, + r'project': {'type': 'string'}, + r'site': {'type': 'string'}, + }, + }, +} + + +#: Full schema with metadata +schema = { + '$schema': 'http://json-schema.org/schema#', + 'title': 'Spack cdash configuration file schema', + 'type': 'object', + 'additionalProperties': False, + 'properties': properties, +} diff --git a/lib/spack/spack/schema/gitlab_ci.py b/lib/spack/spack/schema/gitlab_ci.py new file mode 100644 index 0000000000..97a8dcf2e6 --- /dev/null +++ b/lib/spack/spack/schema/gitlab_ci.py @@ -0,0 +1,78 @@ +# Copyright 2013-2019 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 gitlab-ci.yaml configuration file. + +.. literalinclude:: ../spack/schema/gitlab_ci.py + :lines: 13- +""" + + +#: Properties for inclusion in other schemas +properties = { + 'gitlab-ci': { + 'type': 'object', + 'default': {}, + 'additionalProperties': False, + 'required': ['mappings'], + 'patternProperties': { + r'mappings': { + 'type': 'array', + 'default': {}, + 'additionalProperties': False, + 'patternProperties': { + r'[\w\d\-_\.]+': { + 'type': 'object', + 'default': {}, + 'additionalProperties': False, + 'required': ['match', 'runner-attributes'], + 'properties': { + 'match': { + 'type': 'array', + 'default': [], + 'items': { + 'type': 'string', + }, + }, + 'runner-attributes': { + 'type': 'object', + 'default': {}, + 'additionalProperties': True, + 'required': ['tags'], + 'properties': { + 'image': {'type': 'string'}, + 'tags': { + 'type': 'array', + 'default': [], + 'items': {'type': 'string'} + }, + 'variables': { + 'type': 'object', + 'default': {}, + 'patternProperties': { + r'[\w\d\-_\.]+': { + 'type': 'string', + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, +} + + +#: Full schema with metadata +schema = { + '$schema': 'http://json-schema.org/schema#', + 'title': 'Spack gitlab-ci configuration file schema', + 'type': 'object', + 'additionalProperties': False, + 'properties': properties, +} diff --git a/lib/spack/spack/schema/merged.py b/lib/spack/spack/schema/merged.py index 148f6e5417..76f8ffa2d5 100644 --- a/lib/spack/spack/schema/merged.py +++ b/lib/spack/spack/schema/merged.py @@ -10,8 +10,10 @@ """ from llnl.util.lang import union_dicts +import spack.schema.cdash import spack.schema.compilers import spack.schema.config +import spack.schema.gitlab_ci import spack.schema.mirrors import spack.schema.modules import spack.schema.packages @@ -21,8 +23,10 @@ import spack.schema.upstreams #: Properties for inclusion in other schemas properties = union_dicts( + spack.schema.cdash.properties, spack.schema.compilers.properties, spack.schema.config.properties, + spack.schema.gitlab_ci.properties, spack.schema.mirrors.properties, spack.schema.modules.properties, spack.schema.packages.properties, |