Skip to content

Commit

Permalink
Remove the Git repository synchronization functionality
Browse files Browse the repository at this point in the history
This functionality has accumulated significant technical debt:

* Most importantly, it does not use the current authorization system,
  rendering it accessible only for admin users.

* It doesn't follow the regular API conventions, and is not visible in the API
  schema. This necessitates special code in the SDK.

* The initialization code in `base.py` is not safe when multiple instances of
  the server start at the same time (each instance may end up generating its
  own key).

The team has decided that the cost of fixing these issues outweighs the benefit
of the functionality, so remove it.
  • Loading branch information
SpecLad committed Sep 26, 2023
1 parent b7ff296 commit 7b38987
Show file tree
Hide file tree
Showing 47 changed files with 43 additions and 1,730 deletions.
16 changes: 0 additions & 16 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -339,22 +339,6 @@
"env": {},
"console": "internalConsole"
},
{
"name": "server: git",
"type": "python",
"request": "launch",
"justMyCode": false,
"stopOnEntry": false,
"python": "${command:python.interpreterPath}",
"program": "${workspaceRoot}/manage.py",
"args": [
"update_git_states"
],
"django": true,
"cwd": "${workspaceFolder}",
"env": {},
"console": "internalConsole"
},
{
"name": "server: RQ - cleaning",
"type": "python",
Expand Down
11 changes: 1 addition & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,6 @@ RUN apt-get update && \
bzip2 \
ca-certificates \
curl \
git \
git-lfs \
libgeos-c1v5 \
libgl1 \
libgomp1 \
Expand All @@ -126,7 +124,6 @@ RUN apt-get update && \
python3 \
python3-distutils \
python3-venv \
ssh \
supervisor \
tzdata \
&& ln -fs /usr/share/zoneinfo/${TZ} /etc/localtime && \
Expand All @@ -140,12 +137,7 @@ COPY --from=build-smokescreen /tmp/smokescreen /usr/local/bin/smokescreen
# Add a non-root user
ENV USER=${USER}
ENV HOME /home/${USER}
RUN adduser --shell /bin/bash --disabled-password --gecos "" ${USER} && \
if [ -z ${socks_proxy} ]; then \
echo export "GIT_SSH_COMMAND=\"ssh -o StrictHostKeyChecking=no -o ConnectTimeout=30\"" >> ${HOME}/.bashrc; \
else \
echo export "GIT_SSH_COMMAND=\"ssh -o StrictHostKeyChecking=no -o ConnectTimeout=30 -o ProxyCommand='nc -X 5 -x ${socks_proxy} %h %p'\"" >> ${HOME}/.bashrc; \
fi
RUN adduser --shell /bin/bash --disabled-password --gecos "" ${USER}

ARG CLAM_AV="no"
RUN if [ "$CLAM_AV" = "yes" ]; then \
Expand Down Expand Up @@ -184,7 +176,6 @@ RUN if [ "${CVAT_DEBUG_ENABLED}" = 'yes' ]; then \
COPY cvat/nginx.conf /etc/nginx/nginx.conf
COPY --chown=${USER} components /tmp/components
COPY --chown=${USER} supervisord/ ${HOME}/supervisord
COPY --chown=${USER} ssh ${HOME}/.ssh
COPY --chown=${USER} wait-for-it.sh manage.py backend_entrypoint.sh ${HOME}/
COPY --chown=${USER} utils/ ${HOME}/utils
COPY --chown=${USER} cvat/ ${HOME}/cvat
Expand Down
4 changes: 0 additions & 4 deletions cvat-cli/src/cvat_cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ def tasks_create(
annotation_path: str = "",
annotation_format: str = "CVAT XML 1.1",
status_check_period: int = 2,
dataset_repository_url: str = "",
lfs: bool = False,
**kwargs,
) -> None:
"""
Expand All @@ -68,8 +66,6 @@ def tasks_create(
annotation_path=annotation_path,
annotation_format=annotation_format,
status_check_period=status_check_period,
dataset_repository_url=dataset_repository_url,
use_lfs=lfs,
pbar=DeferredTqdmProgressReporter(),
)
print("Created task id", task.id)
Expand Down
17 changes: 0 additions & 17 deletions cvat-cli/src/cvat_cli/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,17 +193,6 @@ def make_cmdline_parser() -> argparse.ArgumentParser:
"""
),
)
task_create_parser.add_argument(
"--dataset_repository_url",
default="",
type=str,
help=textwrap.dedent(
"""\
git repository to store annotations e.g.
https://github.com/user/repos [annotation/<anno_file_name.zip>]
"""
),
)
task_create_parser.add_argument(
"--frame_step",
default=None,
Expand Down Expand Up @@ -232,12 +221,6 @@ def make_cmdline_parser() -> argparse.ArgumentParser:
type=parse_label_arg,
help="string or file containing JSON labels specification",
)
task_create_parser.add_argument(
"--lfs",
default=False,
action="store_true",
help="using lfs for dataset repository (default: %(default)s)",
)
task_create_parser.add_argument(
"--project_id", default=None, type=int, help="project ID if project exists"
)
Expand Down
10 changes: 0 additions & 10 deletions cvat-sdk/cvat_sdk/core/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,16 +322,6 @@ class CVAT_API_V2:
def __init__(self, host: str):
self.host = host.rstrip("/")
self.base = self.host + "/api/"
self.git = self.host + "/git/repository/"

def git_create(self, task_id: int) -> str:
return self.git + f"create/{task_id}"

def git_check(self, rq_id: int) -> str:
return self.git + f"check/{rq_id}"

def git_get(self, task_id: int) -> str:
return self.git + f"get/{task_id}"

def make_endpoint_url(
self,
Expand Down
59 changes: 0 additions & 59 deletions cvat-sdk/cvat_sdk/core/git.py

This file was deleted.

12 changes: 0 additions & 12 deletions cvat-sdk/cvat_sdk/core/proxies/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from PIL import Image

from cvat_sdk.api_client import apis, exceptions, models
from cvat_sdk.core import git
from cvat_sdk.core.downloading import Downloader
from cvat_sdk.core.helpers import get_paginated_collection
from cvat_sdk.core.progress import ProgressReporter
Expand Down Expand Up @@ -349,8 +348,6 @@ def create_from_data(
annotation_path: str = "",
annotation_format: str = "CVAT XML 1.1",
status_check_period: int = None,
dataset_repository_url: str = "",
use_lfs: bool = False,
pbar: Optional[ProgressReporter] = None,
) -> Task:
"""
Expand Down Expand Up @@ -381,15 +378,6 @@ def create_from_data(
if annotation_path:
task.import_annotations(annotation_format, annotation_path, pbar=pbar)

if dataset_repository_url:
git.create_git_repo(
self._client,
task_id=task.id,
repo_url=dataset_repository_url,
status_check_period=status_check_period,
use_lfs=use_lfs,
)

task.fetch()

return task
Expand Down
2 changes: 1 addition & 1 deletion cvat-ui/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ module.exports = (env) => {
{
context: (param) =>
param.match(
/\/api\/.*|git\/.*|analytics\/.*|static\/.*|admin(?:\/(.*))?.*|profiler(?:\/(.*))?.*|documentation\/.*|django-rq(?:\/(.*))?/gm,
/\/api\/.*|analytics\/.*|static\/.*|admin(?:\/(.*))?.*|profiler(?:\/(.*))?.*|documentation\/.*|django-rq(?:\/(.*))?/gm,
),
target: env && env.API_URL,
secure: false,
Expand Down
19 changes: 0 additions & 19 deletions cvat/apps/dataset_repo/README.md

This file was deleted.

13 changes: 12 additions & 1 deletion cvat/apps/dataset_repo/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# Copyright (C) 2018-2022 Intel Corporation
# Copyright (C) 2018-2023 Intel Corporation
#
# SPDX-License-Identifier: MIT

"""
This app used to contain functionality for synchronizing CVAT tasks with Git
repositories, which was removed.
The app now only exists to contain migrations, which are needed to ensure that
upgrading from an earlier release deletes the table that this app used for the
GitData model.
If a future release of CVAT squashes migrations, then this app should be deleted.
"""
9 changes: 0 additions & 9 deletions cvat/apps/dataset_repo/apps.py

This file was deleted.

Loading

0 comments on commit 7b38987

Please sign in to comment.