Skip to content

Commit 58b5129

Browse files
Re-add docker blob build artifact type (#1086)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 6868156 commit 58b5129

File tree

2 files changed

+42
-1
lines changed

2 files changed

+42
-1
lines changed

conda-store-server/conda_store_server/_internal/schema.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,13 @@ class BuildArtifactType(str, enum.Enum):
104104
CONDA_PACK = "CONDA_PACK"
105105
DOCKER_MANIFEST = "DOCKER_MANIFEST"
106106
CONSTRUCTOR_INSTALLER = "CONSTRUCTOR_INSTALLER"
107-
_ = "CONTAINER_REGISTRY"
107+
108+
# Deprecated
109+
# Old database may still have docker or container build artifacts.
110+
# So, these enum values must stay in order to remain backwards compatible
111+
# however, no new artifacts of these types should be created.
112+
CONTAINER_REGISTRY = "CONTAINER_REGISTRY"
113+
DOCKER_BLOB = "DOCKER_BLOB"
108114

109115

110116
class BuildStatus(enum.Enum):

conda-store-server/tests/_internal/test_schema.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
# Use of this source code is governed by a BSD-style
33
# license that can be found in the LICENSE file.
44

5+
import datetime
6+
57
import pytest
68

79
from conda_store_server._internal import schema
@@ -62,3 +64,36 @@ def test_parse_lockfile_obj(test_lockfile):
6264
}
6365
specification = schema.LockfileSpecification.model_validate(lockfile_spec)
6466
assert specification.model_dump()["lockfile"] == test_lockfile
67+
68+
69+
@pytest.mark.parametrize(
70+
("build"),
71+
[
72+
{
73+
"id": 1,
74+
"environment_id": 1,
75+
"status": "BUILDING",
76+
"scheduled_on": datetime.datetime.now(),
77+
"size": 123,
78+
},
79+
{
80+
"id": 2,
81+
"environment_id": 1,
82+
"status": "BUILDING",
83+
"scheduled_on": datetime.datetime.now(),
84+
"size": 123,
85+
"build_artifacts": [
86+
{"id": 1, "artifact_type": "YAML", "key": "not_a_real_key"},
87+
{"id": 2, "artifact_type": "DOCKER_BLOB", "key": "not_a_real_key"},
88+
{
89+
"id": 3,
90+
"artifact_type": "CONTAINER_REGISTRY",
91+
"key": "not_a_real_key",
92+
},
93+
],
94+
},
95+
],
96+
)
97+
def test_parse_build(build):
98+
output = schema.Build.model_validate(build).model_dump()
99+
assert output is not None

0 commit comments

Comments
 (0)