Skip to content

Commit 0c523fa

Browse files
authored
fix(service): fix clone depth not being respected (#3678)
1 parent a7f4a22 commit 0c523fa

File tree

9 files changed

+6
-22
lines changed

9 files changed

+6
-22
lines changed

renku/ui/service/cache/projects.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"""Renku service project cache management."""
1717
from typing import cast
1818

19-
from marshmallow import EXCLUDE
19+
from marshmallow import RAISE
2020

2121
from renku.ui.service.cache.base import BaseCache
2222
from renku.ui.service.cache.models.project import Project
@@ -34,7 +34,7 @@ def make_project(self, user, project_data, persist=True) -> Project:
3434
"""Store user project metadata."""
3535
project_data.update({"user_id": user.user_id})
3636

37-
project_obj: Project = cast(Project, self.project_schema.load(project_data, unknown=EXCLUDE))
37+
project_obj: Project = cast(Project, self.project_schema.load(project_data, unknown=RAISE))
3838

3939
if persist:
4040
project_obj.save()

renku/ui/service/cache/serializers/project.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class ProjectSchema(CreationSchema, AccessSchema, MandatoryUserSchema):
3131

3232
project_id = fields.String(load_default=lambda: uuid.uuid4().hex)
3333

34-
clone_depth = fields.Integer()
34+
clone_depth = fields.Integer(allow_none=True)
3535
git_url = fields.String()
3636

3737
name = fields.String(required=True)

renku/ui/service/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
OPENAPI_VERSION = "3.0.3"
3737
API_VERSION = "v1"
3838

39-
PROJECT_CLONE_NO_DEPTH = -1
39+
PROJECT_CLONE_NO_DEPTH = None
4040
PROJECT_CLONE_DEPTH_DEFAULT = int(os.getenv("PROJECT_CLONE_DEPTH_DEFAULT", 1))
4141
TEMPLATE_CLONE_DEPTH_DEFAULT = int(os.getenv("TEMPLATE_CLONE_DEPTH_DEFAULT", 0))
4242

renku/ui/service/controllers/templates_create_project.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,8 @@ def setup_new_project(self):
9898
"name": self.ctx["project_name"],
9999
"slug": self.ctx["project_name_stripped"],
100100
"description": self.ctx["project_description"],
101-
"fullname": self.ctx["fullname"],
102-
"email": self.ctx["email"],
103101
"owner": self.ctx["project_namespace"],
104-
"token": self.ctx["token"],
105102
"initialized": True,
106-
"image": self.ctx["image"],
107103
}
108104
project = self.cache.make_project(self.user, new_project_data)
109105

renku/ui/service/gateways/repository_cache.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def _clone_project(
142142
"owner": parsed_git_url.owner,
143143
"name": parsed_git_url.name,
144144
"slug": normalize_to_ascii(parsed_git_url.name),
145-
"depth": PROJECT_CLONE_DEPTH_DEFAULT if shallow else None,
145+
"clone_depth": PROJECT_CLONE_DEPTH_DEFAULT if shallow else None,
146146
"branch": branch,
147147
"git_url": git_url,
148148
"user_id": user.user_id,

tests/service/cache/test_cache.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,11 +253,8 @@ def test_service_cache_make_project(svc_client_cache):
253253
project_data = {
254254
"name": "renku-project-template",
255255
"slug": "renku-project-template.git",
256-
"depth": 1,
256+
"clone_depth": 1,
257257
"git_url": "https://github.com/SwissDataScienceCenter/renku-project-template.git",
258-
"email": "[email protected]",
259-
"fullname": "renku the frog",
260-
"token": "None",
261258
"owner": "SwissDataScienceCenter",
262259
}
263260
project = cache.make_project(user, project_data)

tests/service/fixtures/service_projects.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,7 @@ def project_metadata(project) -> Generator[Tuple["RenkuProject", Dict[str, Any]]
3636
"project_id": uuid.uuid4().hex,
3737
"name": name,
3838
"slug": normalize_to_ascii(name),
39-
"fullname": "full project name",
40-
"email": "[email protected]",
4139
"owner": "me",
42-
"token": "awesome token",
4340
"git_url": "https://example.com/a/b.git",
4441
"initialized": True,
4542
"branch": "",

tests/service/jobs/test_jobs.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,7 @@ def test_job_constructor_lock(svc_client_with_user, service_job):
108108
"project_id": uuid.uuid4().hex,
109109
"name": "my-project",
110110
"slug": "my-project",
111-
"fullname": "full project name",
112-
"email": "[email protected]",
113111
"owner": "me",
114-
"token": "awesome token",
115112
"git_url": "[email protected]",
116113
"initialized": True,
117114
}

tests/service/views/test_dataset_views.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,10 +1012,7 @@ def test_cached_import_dataset_job(doi, svc_client_cache, project):
10121012
"project_id": uuid.uuid4().hex,
10131013
"name": name,
10141014
"slug": normalize_to_ascii(name),
1015-
"fullname": "full project name",
1016-
"email": "[email protected]",
10171015
"owner": "me",
1018-
"token": "awesome token",
10191016
"git_url": "https://example.com/a/b.git",
10201017
"initialized": True,
10211018
}

0 commit comments

Comments
 (0)