Skip to content

Commit

Permalink
Remove the Git repository synchronization functionality (#6904)
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 a special code in the SDK.

* The initialization code in `base.py` is not safe when multiple
instances of
the server starts 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 authored Sep 29, 2023
1 parent 4a487c3 commit d497bb6
Show file tree
Hide file tree
Showing 59 changed files with 55 additions and 2,402 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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Removed

- TDB
- Functionality for synchronizing a task with a Git repository
(<https://github.com/opencv/cvat/pull/6904>)

### Fixed

Expand Down
10 changes: 1 addition & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ RUN apt-get update && \
ca-certificates \
curl \
git \
git-lfs \
libgeos-c1v5 \
libgl1 \
libgomp1 \
Expand All @@ -126,7 +125,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 +138,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 +177,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/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cvat-ui",
"version": "1.56.2",
"version": "1.57.0",
"description": "CVAT single-page application",
"main": "src/index.tsx",
"scripts": {
Expand Down
17 changes: 1 addition & 16 deletions cvat-ui/src/actions/tasks-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,27 +257,12 @@ ThunkAction<Promise<void>, {}, {}, AnyAction> {
taskInstance.serverFiles = data.files.share.concat(data.files.cloudStorage);
taskInstance.remoteFiles = data.files.remote;

if (data.advanced.repository) {
const [gitPlugin] = (await cvat.plugins.list()).filter((plugin: any): boolean => plugin.name === 'Git');

if (gitPlugin) {
gitPlugin.callbacks.onStatusChange = (status: string): void => {
onProgress?.(status);
};
gitPlugin.data.task = taskInstance;
gitPlugin.data.repos = data.advanced.repository;
gitPlugin.data.format = data.advanced.format;
gitPlugin.data.lfs = data.advanced.lfs;
}
}

try {
const savedTask = await taskInstance.save((status: RQStatus, progress: number, message: string): void => {
if (status === RQStatus.UNKNOWN) {
onProgress?.(`${message} ${progress ? `${Math.floor(progress * 100)}%` : ''}`);
} else if ([RQStatus.QUEUED, RQStatus.STARTED].includes(status)) {
const helperMessage = data.advanced.repository ?
'Do not leave the page' : 'You may close the window.';
const helperMessage = 'You may close the window.';
onProgress?.(`${message} ${progress ? `${Math.floor(progress * 100)}%` : ''}. ${helperMessage}`);
} else {
onProgress?.(`${status}: ${message}`);
Expand Down
Loading

0 comments on commit d497bb6

Please sign in to comment.