Skip to content

Commit 5ebce8d

Browse files
🐛 fix version control doesn't populate projects_to_products table (#6357)
1 parent d5d06ee commit 5ebce8d

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

services/web/server/src/simcore_service_webserver/meta_modeling/_iterations.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from pydantic.fields import Field
2222
from pydantic.types import PositiveInt
2323

24+
from .._constants import RQ_PRODUCT_KEY
2425
from ..projects.models import ProjectDict
2526
from ..utils import compute_sha1_on_small_dataset, now_str
2627
from ..version_control.errors import UserUndefinedError
@@ -209,6 +210,7 @@ async def get_or_create_runnable_projects(
209210

210211
vc_repo = VersionControlForMetaModeling.create_from_request(request)
211212
assert vc_repo.user_id # nosec
213+
product_name = request[RQ_PRODUCT_KEY]
212214

213215
try:
214216
project: ProjectDict = await vc_repo.get_project(str(project_uuid))
@@ -303,6 +305,7 @@ async def get_or_create_runnable_projects(
303305
branch_name=branch_name,
304306
tag_name=tag_name,
305307
tag_message=json_dumps(parameters),
308+
product_name=product_name,
306309
)
307310

308311
workcopy_project_id = await vc_repo.get_workcopy_project_id(repo_id, commit_id)

services/web/server/src/simcore_service_webserver/meta_modeling/_version_control.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
from typing import cast
88

99
from aiopg.sa.result import RowProxy
10+
from models_library.products import ProductName
1011
from models_library.projects import ProjectIDStr
1112
from models_library.utils.fastapi_encoders import jsonable_encoder
13+
from simcore_postgres_database.models.projects_to_products import projects_to_products
1214

1315
from ..projects.models import ProjectDict
1416
from ..version_control.db import VersionControlRepository
@@ -92,6 +94,7 @@ async def create_workcopy_and_branch_from_commit(
9294
branch_name: str,
9395
tag_name: str,
9496
tag_message: str,
97+
product_name: ProductName,
9598
) -> CommitID:
9699
"""Creates a new branch with an explicit working copy 'project' on 'start_commit_id'"""
97100
IS_INTERNAL_OPERATION = True
@@ -143,6 +146,12 @@ async def create_workcopy_and_branch_from_commit(
143146
# creates runnable version in project
144147
await self.ProjectsOrm(conn).insert(**project)
145148

149+
await conn.execute(
150+
projects_to_products.insert().values(
151+
project_uuid=project["uuid"], product_name=product_name
152+
)
153+
)
154+
146155
# create branch and set head to last commit_id
147156
branch = await self.BranchesOrm(conn).insert(
148157
returning_cols="id head_commit_id",

services/web/server/tests/unit/with_dbs/03/meta_modeling/test_meta_modeling_iterations.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,6 @@ async def context_with_logged_user(client: TestClient, logged_user: UserInfoDict
6868
await conn.execute(projects.delete())
6969

7070

71-
@pytest.mark.skip(
72-
"Test failing because `create_workcopy_and_branch_from_commit` is not inserting to projects_to_products table"
73-
)
7471
@pytest.mark.acceptance_test()
7572
async def test_iterators_workflow(
7673
client: TestClient,

0 commit comments

Comments
 (0)