foxops 2.3.1__tar.gz → 2.3.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {foxops-2.3.1 → foxops-2.3.3}/PKG-INFO +1 -1
- {foxops-2.3.1 → foxops-2.3.3}/pyproject.toml +1 -1
- {foxops-2.3.1 → foxops-2.3.3}/src/foxops/engine/initialization.py +1 -1
- {foxops-2.3.1 → foxops-2.3.3}/src/foxops/routers/changes.py +19 -14
- {foxops-2.3.1 → foxops-2.3.3}/src/foxops/services/change.py +8 -5
- {foxops-2.3.1 → foxops-2.3.3}/LICENSE +0 -0
- {foxops-2.3.1 → foxops-2.3.3}/README.md +0 -0
- {foxops-2.3.1 → foxops-2.3.3}/src/foxops/__init__.py +0 -0
- {foxops-2.3.1 → foxops-2.3.3}/src/foxops/__main__.py +0 -0
- {foxops-2.3.1 → foxops-2.3.3}/src/foxops/database/__init__.py +0 -0
- {foxops-2.3.1 → foxops-2.3.3}/src/foxops/database/engine.py +0 -0
- {foxops-2.3.1 → foxops-2.3.3}/src/foxops/database/repositories/__init__.py +0 -0
- {foxops-2.3.1 → foxops-2.3.3}/src/foxops/database/repositories/change.py +0 -0
- {foxops-2.3.1 → foxops-2.3.3}/src/foxops/database/repositories/incarnation/__init__.py +0 -0
- {foxops-2.3.1 → foxops-2.3.3}/src/foxops/database/repositories/incarnation/errors.py +0 -0
- {foxops-2.3.1 → foxops-2.3.3}/src/foxops/database/repositories/incarnation/model.py +0 -0
- {foxops-2.3.1 → foxops-2.3.3}/src/foxops/database/repositories/incarnation/repository.py +0 -0
- {foxops-2.3.1 → foxops-2.3.3}/src/foxops/database/schema.py +0 -0
- {foxops-2.3.1 → foxops-2.3.3}/src/foxops/dependencies.py +0 -0
- {foxops-2.3.1 → foxops-2.3.3}/src/foxops/engine/__init__.py +0 -0
- {foxops-2.3.1 → foxops-2.3.3}/src/foxops/engine/__main__.py +0 -0
- {foxops-2.3.1 → foxops-2.3.3}/src/foxops/engine/custom_filters.py +0 -0
- {foxops-2.3.1 → foxops-2.3.3}/src/foxops/engine/errors.py +0 -0
- {foxops-2.3.1 → foxops-2.3.3}/src/foxops/engine/models/__init__.py +0 -0
- {foxops-2.3.1 → foxops-2.3.3}/src/foxops/engine/models/incarnation_state.py +0 -0
- {foxops-2.3.1 → foxops-2.3.3}/src/foxops/engine/models/template_config.py +0 -0
- {foxops-2.3.1 → foxops-2.3.3}/src/foxops/engine/patching/__init__.py +0 -0
- {foxops-2.3.1 → foxops-2.3.3}/src/foxops/engine/patching/git_diff_patch.py +0 -0
- {foxops-2.3.1 → foxops-2.3.3}/src/foxops/engine/rendering.py +0 -0
- {foxops-2.3.1 → foxops-2.3.3}/src/foxops/engine/update.py +0 -0
- {foxops-2.3.1 → foxops-2.3.3}/src/foxops/error_handlers.py +0 -0
- {foxops-2.3.1 → foxops-2.3.3}/src/foxops/errors.py +0 -0
- {foxops-2.3.1 → foxops-2.3.3}/src/foxops/external/__init__.py +0 -0
- {foxops-2.3.1 → foxops-2.3.3}/src/foxops/external/git.py +0 -0
- {foxops-2.3.1 → foxops-2.3.3}/src/foxops/hosters/__init__.py +0 -0
- {foxops-2.3.1 → foxops-2.3.3}/src/foxops/hosters/gitlab.py +0 -0
- {foxops-2.3.1 → foxops-2.3.3}/src/foxops/hosters/local.py +0 -0
- {foxops-2.3.1 → foxops-2.3.3}/src/foxops/hosters/types.py +0 -0
- {foxops-2.3.1 → foxops-2.3.3}/src/foxops/logger.py +0 -0
- {foxops-2.3.1 → foxops-2.3.3}/src/foxops/middlewares.py +0 -0
- {foxops-2.3.1 → foxops-2.3.3}/src/foxops/models/__init__.py +0 -0
- {foxops-2.3.1 → foxops-2.3.3}/src/foxops/models/change.py +0 -0
- {foxops-2.3.1 → foxops-2.3.3}/src/foxops/models/errors.py +0 -0
- {foxops-2.3.1 → foxops-2.3.3}/src/foxops/models/incarnation.py +0 -0
- {foxops-2.3.1 → foxops-2.3.3}/src/foxops/openapi.py +0 -0
- {foxops-2.3.1 → foxops-2.3.3}/src/foxops/routers/__init__.py +0 -0
- {foxops-2.3.1 → foxops-2.3.3}/src/foxops/routers/auth.py +0 -0
- {foxops-2.3.1 → foxops-2.3.3}/src/foxops/routers/incarnations.py +0 -0
- {foxops-2.3.1 → foxops-2.3.3}/src/foxops/routers/not_found.py +0 -0
- {foxops-2.3.1 → foxops-2.3.3}/src/foxops/routers/version.py +0 -0
- {foxops-2.3.1 → foxops-2.3.3}/src/foxops/services/__init__.py +0 -0
- {foxops-2.3.1 → foxops-2.3.3}/src/foxops/services/incarnation.py +0 -0
- {foxops-2.3.1 → foxops-2.3.3}/src/foxops/settings.py +0 -0
- {foxops-2.3.1 → foxops-2.3.3}/src/foxops/utils.py +0 -0
|
@@ -62,7 +62,7 @@ async def initialize_incarnation(
|
|
|
62
62
|
template_repository=template_repository,
|
|
63
63
|
template_repository_version=template_repository_version,
|
|
64
64
|
template_repository_version_hash=template_repository_version_hash,
|
|
65
|
-
template_data=
|
|
65
|
+
template_data=template_data,
|
|
66
66
|
template_data_full=full_template_data,
|
|
67
67
|
)
|
|
68
68
|
incarnation_state.save(incarnation_root_dir / ".fengine.yaml")
|
|
@@ -16,25 +16,30 @@ from foxops.services.change import CannotRepairChangeException, ChangeService
|
|
|
16
16
|
router = APIRouter()
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
async def
|
|
19
|
+
async def get_change_id(
|
|
20
20
|
incarnation_id: Annotated[int, Path()],
|
|
21
21
|
revision: Annotated[int, Path(description="Change revision within the given incarnation")],
|
|
22
22
|
change_service: Annotated[ChangeService, Depends(get_change_service)],
|
|
23
|
-
) ->
|
|
23
|
+
) -> int:
|
|
24
24
|
try:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
match (change_type := await change_service.get_change_type(change_id)):
|
|
28
|
-
case DatabaseChangeType.MERGE_REQUEST:
|
|
29
|
-
return await change_service.get_change_with_merge_request(change_id)
|
|
30
|
-
case DatabaseChangeType.DIRECT:
|
|
31
|
-
return await change_service.get_change(change_id)
|
|
32
|
-
case _:
|
|
33
|
-
raise NotImplementedError(f"Unknown change type {change_type}")
|
|
25
|
+
return await change_service.get_change_id_by_revision(incarnation_id, revision)
|
|
34
26
|
except ChangeNotFoundError:
|
|
35
27
|
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="Change not found")
|
|
36
28
|
|
|
37
29
|
|
|
30
|
+
async def get_change(
|
|
31
|
+
change_id: Annotated[int, Depends(get_change_id)],
|
|
32
|
+
change_service: Annotated[ChangeService, Depends(get_change_service)],
|
|
33
|
+
) -> Change | ChangeWithMergeRequest:
|
|
34
|
+
match (change_type := await change_service.get_change_type(change_id)):
|
|
35
|
+
case DatabaseChangeType.MERGE_REQUEST:
|
|
36
|
+
return await change_service.get_change_with_merge_request(change_id)
|
|
37
|
+
case DatabaseChangeType.DIRECT:
|
|
38
|
+
return await change_service.get_change(change_id)
|
|
39
|
+
case _:
|
|
40
|
+
raise NotImplementedError(f"Unknown change type {change_type}")
|
|
41
|
+
|
|
42
|
+
|
|
38
43
|
class CreateChangeType(enum.Enum):
|
|
39
44
|
DIRECT = "direct"
|
|
40
45
|
MERGE_REQUEST_MANUAL = "merge_request_manual"
|
|
@@ -142,10 +147,10 @@ async def get_change_details(
|
|
|
142
147
|
},
|
|
143
148
|
)
|
|
144
149
|
async def fix_incomplete_change(
|
|
145
|
-
|
|
146
|
-
change_service: ChangeService
|
|
150
|
+
change_id: Annotated[int, Depends(get_change_id)],
|
|
151
|
+
change_service: Annotated[ChangeService, Depends(get_change_service)],
|
|
147
152
|
):
|
|
148
153
|
try:
|
|
149
|
-
await change_service.update_incomplete_change(
|
|
154
|
+
await change_service.update_incomplete_change(change_id)
|
|
150
155
|
except CannotRepairChangeException as e:
|
|
151
156
|
raise HTTPException(status_code=status.HTTP_422_UNPROCESSABLE_ENTITY, detail=str(e))
|
|
@@ -188,7 +188,7 @@ class ChangeService:
|
|
|
188
188
|
commit_sha=commit_sha,
|
|
189
189
|
requested_version_hash=incarnation_state.template_repository_version_hash,
|
|
190
190
|
requested_version=template_repository_version,
|
|
191
|
-
requested_data=json.dumps(template_data),
|
|
191
|
+
requested_data=json.dumps(incarnation_state.template_data),
|
|
192
192
|
template_data_full=json.dumps(incarnation_state.template_data_full),
|
|
193
193
|
)
|
|
194
194
|
|
|
@@ -449,7 +449,7 @@ class ChangeService:
|
|
|
449
449
|
if not change.commit_pushed:
|
|
450
450
|
raise IncompleteChange(
|
|
451
451
|
"the given change is in an incomplete state (commit_pushed=False). "
|
|
452
|
-
"Try
|
|
452
|
+
f"Try 'POST /api/incarnations/{change.incarnation_id}/changes/{change.revision}/fix'"
|
|
453
453
|
)
|
|
454
454
|
|
|
455
455
|
return Change(
|
|
@@ -472,8 +472,11 @@ class ChangeService:
|
|
|
472
472
|
|
|
473
473
|
if change_in_db.type != ChangeType.MERGE_REQUEST:
|
|
474
474
|
raise ValueError(f"Change {change_id} is not a merge request change.")
|
|
475
|
-
|
|
476
|
-
|
|
475
|
+
if change_in_db.merge_request_id is None or change_in_db.merge_request_branch_name is None:
|
|
476
|
+
raise IncompleteChange(
|
|
477
|
+
"the given change is in an incomplete state (MR ID/Branch = null). "
|
|
478
|
+
f"Try 'POST /api/incarnations/{change_in_db.incarnation_id}/changes/{change_in_db.revision}/fix'"
|
|
479
|
+
)
|
|
477
480
|
|
|
478
481
|
status = await self._hoster.get_merge_request_status(
|
|
479
482
|
incarnation_repository=incarnation_in_db.incarnation_repository,
|
|
@@ -679,7 +682,7 @@ class ChangeService:
|
|
|
679
682
|
if last_exception:
|
|
680
683
|
self._log.error("last exception", last_exception=last_exception)
|
|
681
684
|
await self._change_repository.delete_change(change_id)
|
|
682
|
-
raise ChangeFailed("Failed to push commit to incarnation repository. Retries exceeded.")
|
|
685
|
+
raise ChangeFailed("Failed to push commit to incarnation repository. Retries exceeded.") from last_exception
|
|
683
686
|
|
|
684
687
|
|
|
685
688
|
def _construct_merge_request_conflict_description(
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|