From 8b96e10ecc6052c53e5296a56947b9072693acff Mon Sep 17 00:00:00 2001 From: Greg Becker Date: Thu, 5 Nov 2020 09:59:44 -0800 Subject: Remove hardcoded version numbers from container logic (#19716) Previously, we hardcoded a list of Spack versions which could be used by the containerize command. This PR removes that list. It's a maintenance burden when cutting a release, and prevents older versions of Spack from creating containers to be used by newer versions. --- lib/spack/docs/developer_guide.rst | 14 ---------- lib/spack/spack/container/images.json | 48 +++----------------------------- lib/spack/spack/container/images.py | 3 +- lib/spack/spack/schema/container.py | 8 +----- lib/spack/spack/test/container/images.py | 8 ------ 5 files changed, 7 insertions(+), 74 deletions(-) (limited to 'lib') diff --git a/lib/spack/docs/developer_guide.rst b/lib/spack/docs/developer_guide.rst index 1341a196b4..7fd4d1ec6e 100644 --- a/lib/spack/docs/developer_guide.rst +++ b/lib/spack/docs/developer_guide.rst @@ -620,13 +620,6 @@ for a major release, the steps to make the release are as follows: #. Bump the version in ``lib/spack/spack/__init__.py``. See `this example from 0.13.0 `_ -#. Update the release version lists in these files to include the new version: - - * ``lib/spack/spack/schema/container.py`` - * ``lib/spack/spack/container/images.json`` - -.. TODO: We should get rid of this step in some future release. - #. Update ``CHANGELOG.md`` with major highlights in bullet form. Use proper markdown formatting, like `this example from 0.15.0 `_. @@ -721,13 +714,6 @@ release: #. Bump the version in ``lib/spack/spack/__init__.py``. See `this example from 0.14.1 `_. -#. Updaate the release version lists in these files to include the new version: - - * ``lib/spack/spack/schema/container.py`` - * ``lib/spack/spack/container/images.json`` - - **TODO**: We should get rid of this step in some future release. - #. Update ``CHANGELOG.md`` with a list of bugfixes. This is typically just a summary of the commits you cherry-picked onto the release branch. See `the changelog from 0.14.1 diff --git a/lib/spack/spack/container/images.json b/lib/spack/spack/container/images.json index b08cbc90a4..efaedc68b8 100644 --- a/lib/spack/spack/container/images.json +++ b/lib/spack/spack/container/images.json @@ -6,17 +6,7 @@ "environment": [], "build": "spack/ubuntu-bionic", "build_tags": { - "develop": "latest", - "0.14": "0.14", - "0.14.0": "0.14.0", - "0.14.1": "0.14.1", - "0.14.2": "0.14.2", - "0.15": "0.15", - "0.15.0": "0.15.0", - "0.15.1": "0.15.1", - "0.15.2": "0.15.2", - "0.15.3": "0.15.3", - "0.15.4": "0.15.4" + "develop": "latest" } }, "ubuntu:16.04": { @@ -26,17 +16,7 @@ "environment": [], "build": "spack/ubuntu-xenial", "build_tags": { - "develop": "latest", - "0.14": "0.14", - "0.14.0": "0.14.0", - "0.14.1": "0.14.1", - "0.14.2": "0.14.2", - "0.15": "0.15", - "0.15.0": "0.15.0", - "0.15.1": "0.15.1", - "0.15.2": "0.15.2", - "0.15.3": "0.15.3", - "0.15.4": "0.15.4" + "develop": "latest" } }, "centos:7": { @@ -46,17 +26,7 @@ "environment": [], "build": "spack/centos7", "build_tags": { - "develop": "latest", - "0.14": "0.14", - "0.14.0": "0.14.0", - "0.14.1": "0.14.1", - "0.14.2": "0.14.2", - "0.15": "0.15", - "0.15.0": "0.15.0", - "0.15.1": "0.15.1", - "0.15.2": "0.15.2", - "0.15.3": "0.15.3", - "0.15.4": "0.15.4" + "develop": "latest" } }, "centos:6": { @@ -66,17 +36,7 @@ "environment": [], "build": "spack/centos6", "build_tags": { - "develop": "latest", - "0.14": "0.14", - "0.14.0": "0.14.0", - "0.14.1": "0.14.1", - "0.14.2": "0.14.2", - "0.15": "0.15", - "0.15.0": "0.15.0", - "0.15.1": "0.15.1", - "0.15.2": "0.15.2", - "0.15.3": "0.15.3", - "0.15.4": "0.15.4" + "develop": "latest" } } } diff --git a/lib/spack/spack/container/images.py b/lib/spack/spack/container/images.py index 421fc24425..f702781d32 100644 --- a/lib/spack/spack/container/images.py +++ b/lib/spack/spack/container/images.py @@ -43,7 +43,8 @@ def build_info(image, spack_version): # Try to check if we have a tag for this Spack version try: - build_tag = image_data['build_tags'][spack_version] + # Translate version from git to docker if necessary + build_tag = image_data['build_tags'].get(spack_version, spack_version) except KeyError: msg = ('the image "{0}" has no tag for Spack version "{1}" ' '[valid versions are {2}]') diff --git a/lib/spack/spack/schema/container.py b/lib/spack/spack/schema/container.py index 83e04788a0..d534afee08 100644 --- a/lib/spack/spack/schema/container.py +++ b/lib/spack/spack/schema/container.py @@ -29,13 +29,7 @@ container_schema = { }, 'spack': { 'type': 'string', - 'enum': [ - 'develop', - '0.14', '0.14.0', '0.14.1', '0.14.2', - '0.15', '0.15.0', '0.15.1', '0.15.2', - '0.15.3', '0.15.4', - ] - } + }, }, 'required': ['image', 'spack'] }, diff --git a/lib/spack/spack/test/container/images.py b/lib/spack/spack/test/container/images.py index 808676c39a..6af69e0c83 100644 --- a/lib/spack/spack/test/container/images.py +++ b/lib/spack/spack/test/container/images.py @@ -18,14 +18,6 @@ def test_build_info(image, spack_version, expected): assert output == expected -@pytest.mark.parametrize('image,spack_version', [ - ('ubuntu:18.04', 'doesnotexist') -]) -def test_build_info_error(image, spack_version): - with pytest.raises(ValueError, match=r"has no tag for"): - spack.container.images.build_info(image, spack_version) - - @pytest.mark.parametrize('image', [ 'ubuntu:18.04' ]) -- cgit v1.2.3-60-g2f50