diff --git a/conda-store-server/conda_store_server/_internal/action/__init__.py b/conda-store-server/conda_store_server/_internal/action/__init__.py index cc85ed974..151a4b1b5 100644 --- a/conda-store-server/conda_store_server/_internal/action/__init__.py +++ b/conda-store-server/conda_store_server/_internal/action/__init__.py @@ -12,9 +12,6 @@ from conda_store_server._internal.action.download_packages import ( # noqa action_fetch_and_extract_conda_packages, ) -from conda_store_server._internal.action.generate_conda_docker import ( # noqa - action_generate_conda_docker, -) from conda_store_server._internal.action.generate_conda_export import ( # noqa action_generate_conda_export, ) diff --git a/conda-store-server/conda_store_server/_internal/action/generate_conda_docker.py b/conda-store-server/conda_store_server/_internal/action/generate_conda_docker.py deleted file mode 100644 index 1cf8b423f..000000000 --- a/conda-store-server/conda_store_server/_internal/action/generate_conda_docker.py +++ /dev/null @@ -1,50 +0,0 @@ -# Copyright (c) conda-store development team. All rights reserved. -# Use of this source code is governed by a BSD-style -# license that can be found in the LICENSE file. - -import pathlib - -from conda_store_server._internal import action - - -@action.action -def action_generate_conda_docker( - context, - conda_prefix: pathlib.Path, - default_docker_image: str, - container_registry, - output_image_name: str, - output_image_tag: str, -): - raise RuntimeError( - "Generating Docker images is currently not supported, see " - "https://github.com/conda-incubator/conda-store/issues/666" - ) - - # Import is inside the function because conda_docker is only available on - # Linux - from conda_docker.conda import ( - build_docker_environment_image, - conda_info, - fetch_precs, - find_user_conda, - precs_from_environment_prefix, - ) - - user_conda = find_user_conda() - info = conda_info(user_conda) - download_dir = info["pkgs_dirs"][0] - precs = precs_from_environment_prefix(str(conda_prefix), download_dir, user_conda) - records = fetch_precs(download_dir, precs) - base_image = container_registry.pull_image(default_docker_image) - image = build_docker_environment_image( - base_image=base_image, - output_image=f"{output_image_name}:{output_image_tag}", - records=records, - default_prefix=info["env_vars"]["CONDA_ROOT"], - download_dir=download_dir, - user_conda=user_conda, - channels_remap=info.get("channels_remap", []), - layering_strategy="single", - ) - return image diff --git a/conda-store-server/conda_store_server/_internal/schema.py b/conda-store-server/conda_store_server/_internal/schema.py index da3d5bcca..ed04523bf 100644 --- a/conda-store-server/conda_store_server/_internal/schema.py +++ b/conda-store-server/conda_store_server/_internal/schema.py @@ -8,7 +8,7 @@ import os import re import sys -from typing import Annotated, Any, Callable, Dict, List, Optional, TypeAlias, Union +from typing import Annotated, Any, Dict, List, Optional, TypeAlias, Union from conda_lock.lockfile.v1.models import Lockfile from pydantic import ( @@ -346,25 +346,11 @@ class Settings(BaseModel): BuildArtifactType.YAML, BuildArtifactType.CONDA_PACK, BuildArtifactType.CONSTRUCTOR_INSTALLER, - *( - [ - BuildArtifactType.DOCKER_MANIFEST, - BuildArtifactType.CONTAINER_REGISTRY, - ] - if sys.platform == "linux" - else [] - ), ], description="artifacts to build in conda-store. By default all of the artifacts", metadata={"global": False}, ) - default_docker_base_image: Union[str, Callable] = Field( - "registry-1.docker.io/library/debian:sid-slim", - description="default base image used for the Dockerized environments. Make sure to have a proper glibc within image (highly discourage alpine/musl based images). Can also be callable function which takes the `orm.Build` object as input which has access to all attributes about the build such as install packages, requested packages, name, namespace, etc", - metadata={"global": False}, - ) - PipArg = Annotated[str, AfterValidator(lambda v: check_pip(v))] diff --git a/conda-store-server/conda_store_server/_internal/server/views/api.py b/conda-store-server/conda_store_server/_internal/server/views/api.py index 32a0fe559..fe95c9a39 100644 --- a/conda-store-server/conda_store_server/_internal/server/views/api.py +++ b/conda-store-server/conda_store_server/_internal/server/views/api.py @@ -9,7 +9,7 @@ import yaml from celery.result import AsyncResult from fastapi import APIRouter, Body, Depends, HTTPException, Query, Request -from fastapi.responses import PlainTextResponse, RedirectResponse +from fastapi.responses import JSONResponse, PlainTextResponse, RedirectResponse from conda_store_server import __version__, api, app from conda_store_server._internal import orm, schema, utils @@ -1059,7 +1059,6 @@ async def api_put_build_cancel( [ f"build-{build_id}-conda-env-export", f"build-{build_id}-conda-pack", - f"build-{build_id}-docker", f"build-{build_id}-constructor-installer", f"build-{build_id}-environment", ], @@ -1341,7 +1340,7 @@ async def api_get_build_archive( return RedirectResponse(conda_store.storage.get_url(build.conda_pack_key)) -@router_api.get("/build/{build_id}/docker/") +@router_api.get("/build/{build_id}/docker/", deprecated=True) async def api_get_build_docker_image_url( build_id: int, request: Request, @@ -1349,6 +1348,7 @@ async def api_get_build_docker_image_url( server=Depends(dependencies.get_server), auth=Depends(dependencies.get_auth), ): + response_headers = {"Deprecation": "True"} with conda_store.get_db() as db: build = api.get_build(db, build_id) auth.authorize_request( @@ -1360,12 +1360,15 @@ async def api_get_build_docker_image_url( if build.has_docker_manifest: url = f"{server.registry_external_url}/{build.environment.namespace.name}/{build.environment.name}:{build.build_key}" - return PlainTextResponse(url) + return PlainTextResponse(url, headers=response_headers) else: - raise HTTPException( - status_code=400, - detail=f"Build {build_id} doesn't have a docker manifest", + content = { + "status": "error", + "message": f"Build {build_id} doesn't have a docker manifest", + } + return JSONResponse( + status_code=400, content=content, headers=response_headers ) diff --git a/conda-store-server/conda_store_server/_internal/worker/build.py b/conda-store-server/conda_store_server/_internal/worker/build.py index 50d4be82a..54061669d 100644 --- a/conda-store-server/conda_store_server/_internal/worker/build.py +++ b/conda-store-server/conda_store_server/_internal/worker/build.py @@ -421,55 +421,11 @@ def build_conda_docker(db: Session, conda_store, build: orm.Build): import warnings warnings.warn( - "Generating Docker images is currently not supported, see " - "https://github.com/conda-incubator/conda-store/issues/666" + "Generating Docker images is not supported and will be removed " + "in a future release" ) return - conda_prefix = build.build_path(conda_store) - settings = conda_store.get_settings( - db=db, - namespace=build.environment.namespace.name, - environment_name=build.environment.name, - ) - - try: - with utils.timer( - conda_store.log, - f"packaging docker image of conda environment={conda_prefix}", - ): - context = action.action_generate_conda_docker( - conda_prefix=conda_prefix, - default_docker_image=utils.callable_or_value( - settings.default_docker_base_image, None - ), - container_registry=conda_store.container_registry, - output_image_name=build.specification.name, - output_image_tag=build.build_key, - ) - append_to_logs( - db, - conda_store, - build, - "::group::action_generate_conda_docker\n" - + context.stdout.getvalue() - + "\n::endgroup::\n", - ) - - image = context.result - - if schema.BuildArtifactType.DOCKER_MANIFEST in settings.build_artifacts: - conda_store.container_registry.store_image( - db, conda_store, build, image - ) - - if schema.BuildArtifactType.CONTAINER_REGISTRY in settings.build_artifacts: - conda_store.container_registry.push_image(db, build, image) - except Exception as e: - conda_store.log.exception(e) - append_to_logs(db, conda_store, build, traceback.format_exc()) - raise e - def build_constructor_installer(db: Session, conda_store, build: orm.Build): conda_prefix = build.build_path(conda_store) diff --git a/conda-store-server/conda_store_server/_internal/worker/tasks.py b/conda-store-server/conda_store_server/_internal/worker/tasks.py index e1005e8f8..456365ebc 100644 --- a/conda-store-server/conda_store_server/_internal/worker/tasks.py +++ b/conda-store-server/conda_store_server/_internal/worker/tasks.py @@ -20,7 +20,6 @@ from conda_store_server._internal.worker.app import CondaStoreWorker from conda_store_server._internal.worker.build import ( build_cleanup, - build_conda_docker, build_conda_env_export, build_conda_environment, build_conda_pack, @@ -241,14 +240,6 @@ def task_build_conda_pack(self, build_id): build_conda_pack(db, conda_store, build) -@shared_task(base=WorkerTask, name="task_build_conda_docker", bind=True) -def task_build_conda_docker(self, build_id): - conda_store = self.worker.conda_store - with conda_store.session_factory() as db: - build = api.get_build(db, build_id) - build_conda_docker(db, conda_store, build) - - @shared_task(base=WorkerTask, name="task_build_constructor_installer", bind=True) def task_build_constructor_installer(self, build_id): conda_store = self.worker.conda_store diff --git a/conda-store-server/conda_store_server/api.py b/conda-store-server/conda_store_server/api.py index e086d5c3c..e3855a338 100644 --- a/conda-store-server/conda_store_server/api.py +++ b/conda-store-server/conda_store_server/api.py @@ -349,10 +349,6 @@ def list_environments( query = query.filter(orm.Build.status == status) if artifact: - # DOCKER_BLOB can return multiple results - # use DOCKER_MANIFEST instead - if artifact == schema.BuildArtifactType.DOCKER_BLOB: - artifact = schema.BuildArtifactType.DOCKER_MANIFEST query = query.join(orm.Build.build_artifacts).filter( orm.BuildArtifact.artifact_type == artifact ) @@ -511,10 +507,6 @@ def list_builds( query = query.filter(orm.Build.deleted_on == null()) if artifact: - # DOCKER_BLOB can return multiple results - # use DOCKER_MANIFEST instead - if artifact == schema.BuildArtifactType.DOCKER_BLOB: - artifact = schema.BuildArtifactType.DOCKER_MANIFEST query = query.join(orm.Build.build_artifacts).filter( orm.BuildArtifact.artifact_type == artifact ) diff --git a/conda-store-server/conda_store_server/app.py b/conda-store-server/conda_store_server/app.py index 226f913ea..ac454a2ab 100644 --- a/conda-store-server/conda_store_server/app.py +++ b/conda-store-server/conda_store_server/app.py @@ -20,7 +20,6 @@ TraitError, Type, Unicode, - Union, default, validate, ) @@ -265,14 +264,6 @@ def _check_redis(self, proposal): schema.BuildArtifactType.YAML, schema.BuildArtifactType.CONDA_PACK, schema.BuildArtifactType.CONSTRUCTOR_INSTALLER, - *( - [ - schema.BuildArtifactType.DOCKER_MANIFEST, - schema.BuildArtifactType.CONTAINER_REGISTRY, - ] - if sys.platform == "linux" - else [] - ), ], help="artifacts to build in conda-store. By default all of the artifacts", config=True, @@ -345,19 +336,6 @@ def _default_celery_results_backend(self): allow_none=True, ) - default_docker_base_image = Union( - [Unicode(), Callable()], - help="default base image used for the Dockerized environments. Make sure to have a proper glibc within image (highly discourage alpine/musl based images). Can also be callable function which takes the `orm.Build` object as input which has access to all attributes about the build such as install packages, requested packages, name, namespace, etc", - config=True, - ) - - @default("default_docker_base_image") - def _default_docker_base_image(self): - def _docker_base_image(build: orm.Build): - return "registry-1.docker.io/library/debian:sid-slim" - - return _docker_base_image - validate_specification = Callable( conda_store_validate_specification, help="callable function taking conda_store, namespace, and specification as input arguments to apply for validating and modifying a given specification. If there are validation issues with the environment ValueError with message should be raised. If changed you may need to call the default function to preseve many of the trait effects e.g. `c.CondaStore.default_channels` etc", @@ -496,7 +474,6 @@ def ensure_settings(self, db: Session): pypi_required_packages=self.pypi_required_packages, pypi_included_packages=self.pypi_included_packages, build_artifacts=self.build_artifacts, - # default_docker_base_image=self.default_docker_base_image, ) api.set_kvstore_key_values(db, "setting", settings.model_dump(), update=False) @@ -726,16 +703,6 @@ def create_build(self, db: Session, environment_id: int, specification_sha256: s ) ) - if ( - schema.BuildArtifactType.DOCKER_MANIFEST in settings.build_artifacts - or schema.BuildArtifactType.CONTAINER_REGISTRY in settings.build_artifacts - ): - artifact_tasks.append( - tasks.task_build_conda_docker.subtask( - args=(build.id,), task_id=f"build-{build.id}-docker", immutable=True - ) - ) - if schema.BuildArtifactType.CONSTRUCTOR_INSTALLER in settings.build_artifacts: artifact_tasks.append( tasks.task_build_constructor_installer.subtask( diff --git a/conda-store-server/tests/_internal/action/test_actions.py b/conda-store-server/tests/_internal/action/test_actions.py index d6e4a594c..5f435d258 100644 --- a/conda-store-server/tests/_internal/action/test_actions.py +++ b/conda-store-server/tests/_internal/action/test_actions.py @@ -20,7 +20,7 @@ from traitlets import TraitError from conda_store_server import BuildKey, api -from conda_store_server._internal import action, conda_utils, orm, schema, server, utils +from conda_store_server._internal import action, conda_utils, orm, schema, server from conda_store_server._internal.action import ( generate_constructor_installer, generate_lockfile, @@ -314,25 +314,6 @@ def test_generate_conda_pack(tmp_path, conda_prefix): assert output_filename.exists() -@pytest.mark.xfail( - reason=( - "Generating Docker images is currently not supported, see " - "https://github.com/conda-incubator/conda-store/issues/666" - ) -) -@pytest.mark.long_running_test -def test_generate_conda_docker(conda_store, conda_prefix): - action.action_generate_conda_docker( - conda_prefix=conda_prefix, - default_docker_image=utils.callable_or_value( - conda_store.default_docker_base_image, None - ), - container_registry=conda_store.container_registry, - output_image_name="test", - output_image_tag="tag", - ) - - def test_remove_not_conda_prefix(tmp_path): fake_conda_prefix = tmp_path / "test" fake_conda_prefix.mkdir() diff --git a/conda-store-server/tests/_internal/server/views/test_api.py b/conda-store-server/tests/_internal/server/views/test_api.py index 5348d414c..73695aec3 100644 --- a/conda-store-server/tests/_internal/server/views/test_api.py +++ b/conda-store-server/tests/_internal/server/views/test_api.py @@ -943,7 +943,6 @@ def test_get_settings_auth(testclient, authenticate, route): "pypi_required_packages", "pypi_included_packages", "build_artifacts", - "default_docker_base_image", } <= r.data.keys() diff --git a/conda-store-server/tests/conftest.py b/conda-store-server/tests/conftest.py index b4048ceb6..f7871e7ae 100644 --- a/conda-store-server/tests/conftest.py +++ b/conda-store-server/tests/conftest.py @@ -382,5 +382,3 @@ def _create_build_artifacts(db: Session, conda_store, build: orm.Build): content_type="application/gzip", artifact_type=schema.BuildArtifactType.CONDA_PACK, ) - - # have not included docker at the moment diff --git a/conda-store-server/tests/test_app.py b/conda-store-server/tests/test_app.py index 04b617a8d..ef1a19613 100644 --- a/conda-store-server/tests/test_app.py +++ b/conda-store-server/tests/test_app.py @@ -2,7 +2,6 @@ # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. -import sys import pytest from celery.result import AsyncResult @@ -67,7 +66,6 @@ def test_conda_store_register_environment_workflow( # wait for task to complete # build: environment, export, archive - # docker is expected to fail will be fixed soon task = AsyncResult(f"build-{build.id}-environment") task.wait(timeout=60) @@ -78,10 +76,6 @@ def test_conda_store_register_environment_workflow( task = AsyncResult(f"build-{build.id}-conda-pack") task.wait(timeout=60) - if sys.platform == "linux": - task = AsyncResult(f"build-{build.id}-docker") - task.wait(timeout=2 * 60) - task = AsyncResult(f"build-{build.id}-constructor-installer") task.wait(timeout=5 * 60) diff --git a/docusaurus-docs/conda-store/explanations/artifacts.md b/docusaurus-docs/conda-store/explanations/artifacts.md index 988655357..39a52901a 100644 --- a/docusaurus-docs/conda-store/explanations/artifacts.md +++ b/docusaurus-docs/conda-store/explanations/artifacts.md @@ -66,16 +66,9 @@ To install the tarball, follow the [instructions for the target machine in the c ## Docker images :::warning -Docker image creation is currently only supported on Linux. - -The docker image generation and registry features are experimental, -and the following instructions are not thoroughly tested. -If you face any difficulties, open an issue on the GitHub repository. +Docker image creation is currently not supported. ::: -conda-store acts as a docker registry. -It leverages [Conda Docker][conda-docker], which builds docker images without Docker, allowing for advanced caching, reduced image sizes, and does not require elevated privileges. - ### Authentication The `conda-store` docker registry requires authentication. diff --git a/docusaurus-docs/conda-store/references/architecture.md b/docusaurus-docs/conda-store/references/architecture.md index ee0aa7c78..e952c5b57 100644 --- a/docusaurus-docs/conda-store/references/architecture.md +++ b/docusaurus-docs/conda-store/references/architecture.md @@ -31,7 +31,6 @@ the following responsibilities: - build Conda environments from Conda `environment.yaml` specifications - build Conda pack archives -- build Conda docker images - remove Conda builds - modify symlinks to point current environment to given build - generally any tasks that can take an unbounded amount of time @@ -64,7 +63,7 @@ the server: Both the worker and server need a connection to a SQLAchemy compatible database, Redis, and S3 compatible object storage. The S3 server is -used to store all build artifacts for example logs, docker layers, and +used to store all build artifacts for example logs, and the [Conda-Pack](https://conda.github.io/conda-pack/) tarball. The PostgreSQL database is used for storing all states on environments and builds along with powering the conda-store web server UI, REST API, diff --git a/docusaurus-docs/conda-store/references/configuration-options.md b/docusaurus-docs/conda-store/references/configuration-options.md index 1c82c1dc4..9e14e6715 100644 --- a/docusaurus-docs/conda-store/references/configuration-options.md +++ b/docusaurus-docs/conda-store/references/configuration-options.md @@ -167,8 +167,7 @@ to build. By default it is all the artifacts that conda-store is capable of building. These are the [lockfile](https://github.com/conda-incubator/conda-lock), [YAML](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#create-env-file-manually), -[Conda-Pack](https://conda.github.io/conda-pack/), and -[Docker](https://github.com/conda-incubator/conda-docker). Currently +[Conda-Pack](https://conda.github.io/conda-pack/). Currently the `lockfile` one is ignored since it is always created upon build. `CondaStore.build_artifacts_kept_on_deletion` is a list of artifacts @@ -211,17 +210,6 @@ setting is useful if you want to protect environments from modification from certain users and groups. Note: this configuration option is not supported on Windows. -`CondaStore.default_docker_base_image` default base image used for the -Dockerized environments. Make sure to have a proper glibc within image -(highly discourage alpine/musl based images). Can also be callable -function which takes the `orm.Build` object as input which has access -to all attributes about the build such as installed packages, requested -packages, name, namespace, etc. This package at a minimum should have -the [following packages -installed](https://docs.anaconda.com/anaconda/install/linux/). Often -times for non-graphic and non-gpu environments glibc is enough. Hence -the default docker image `library/debian:sid-slim`. - `CondaStore.serialize_builds` DEPRECATED no longer has any effect `CondaStore.post_update_environment_build_hook` is an optional configurable to diff --git a/docusaurus-docs/src/pages/index.js b/docusaurus-docs/src/pages/index.js index 99bd24f08..e1d3bae76 100644 --- a/docusaurus-docs/src/pages/index.js +++ b/docusaurus-docs/src/pages/index.js @@ -75,7 +75,7 @@ const FeatureList = [ description: ( <> Share fully-reproducible environments with auto-generated artifacts like - lockfiles, YAML files, docker images, and tarballs. + lockfiles, YAML files, and tarballs. ), },