Skip to content

Commit

Permalink
Re-add docker blob build artifact type (#1086)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
soapy1 and pre-commit-ci[bot] authored Feb 11, 2025
1 parent 6868156 commit 58b5129
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
8 changes: 7 additions & 1 deletion conda-store-server/conda_store_server/_internal/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
35 changes: 35 additions & 0 deletions conda-store-server/tests/_internal/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

0 comments on commit 58b5129

Please sign in to comment.