diff --git a/conda-store-server/conda_store_server/_internal/schema.py b/conda-store-server/conda_store_server/_internal/schema.py index b3d898dcb..026905884 100644 --- a/conda-store-server/conda_store_server/_internal/schema.py +++ b/conda-store-server/conda_store_server/_internal/schema.py @@ -104,7 +104,13 @@ class BuildArtifactType(str, enum.Enum): CONDA_PACK = "CONDA_PACK" DOCKER_MANIFEST = "DOCKER_MANIFEST" CONSTRUCTOR_INSTALLER = "CONSTRUCTOR_INSTALLER" - _ = "CONTAINER_REGISTRY" + + # Deprecated + # Old database may still have docker or container build artifacts. + # So, these enum values must stay in order to remain backwards compatible + # however, no new artifacts of these types should be created. + CONTAINER_REGISTRY = "CONTAINER_REGISTRY" + DOCKER_BLOB = "DOCKER_BLOB" class BuildStatus(enum.Enum): diff --git a/conda-store-server/tests/_internal/test_schema.py b/conda-store-server/tests/_internal/test_schema.py index 92067d3aa..487febf47 100644 --- a/conda-store-server/tests/_internal/test_schema.py +++ b/conda-store-server/tests/_internal/test_schema.py @@ -2,6 +2,8 @@ # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. +import datetime + import pytest from conda_store_server._internal import schema @@ -62,3 +64,36 @@ def test_parse_lockfile_obj(test_lockfile): } specification = schema.LockfileSpecification.model_validate(lockfile_spec) assert specification.model_dump()["lockfile"] == test_lockfile + + +@pytest.mark.parametrize( + ("build"), + [ + { + "id": 1, + "environment_id": 1, + "status": "BUILDING", + "scheduled_on": datetime.datetime.now(), + "size": 123, + }, + { + "id": 2, + "environment_id": 1, + "status": "BUILDING", + "scheduled_on": datetime.datetime.now(), + "size": 123, + "build_artifacts": [ + {"id": 1, "artifact_type": "YAML", "key": "not_a_real_key"}, + {"id": 2, "artifact_type": "DOCKER_BLOB", "key": "not_a_real_key"}, + { + "id": 3, + "artifact_type": "CONTAINER_REGISTRY", + "key": "not_a_real_key", + }, + ], + }, + ], +) +def test_parse_build(build): + output = schema.Build.model_validate(build).model_dump() + assert output is not None