foxops 2.4.0__tar.gz → 2.5.1__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.4.0 → foxops-2.5.1}/PKG-INFO +1 -1
- {foxops-2.4.0 → foxops-2.5.1}/pyproject.toml +1 -1
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/engine/__main__.py +2 -0
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/external/git.py +3 -2
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/hosters/gitlab.py +17 -4
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/hosters/local.py +16 -4
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/hosters/types.py +8 -1
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/models/incarnation.py +1 -0
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/services/change.py +5 -0
- {foxops-2.4.0 → foxops-2.5.1}/LICENSE +0 -0
- {foxops-2.4.0 → foxops-2.5.1}/README.md +0 -0
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/__init__.py +0 -0
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/__main__.py +0 -0
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/database/__init__.py +0 -0
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/database/engine.py +0 -0
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/database/repositories/__init__.py +0 -0
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/database/repositories/change/__init__.py +0 -0
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/database/repositories/change/errors.py +0 -0
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/database/repositories/change/model.py +0 -0
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/database/repositories/change/repository.py +0 -0
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/database/repositories/incarnation/__init__.py +0 -0
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/database/repositories/incarnation/errors.py +0 -0
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/database/repositories/incarnation/model.py +0 -0
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/database/repositories/incarnation/repository.py +0 -0
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/database/schema.py +0 -0
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/dependencies.py +0 -0
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/engine/__init__.py +0 -0
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/engine/custom_filters.py +0 -0
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/engine/errors.py +0 -0
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/engine/initialization.py +0 -0
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/engine/models/__init__.py +0 -0
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/engine/models/incarnation_state.py +0 -0
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/engine/models/template_config.py +0 -0
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/engine/patching/__init__.py +0 -0
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/engine/patching/git_diff_patch.py +0 -0
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/engine/rendering.py +0 -0
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/engine/update.py +0 -0
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/error_handlers.py +0 -0
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/errors.py +0 -0
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/external/__init__.py +0 -0
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/hosters/__init__.py +0 -0
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/logger.py +0 -0
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/middlewares.py +0 -0
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/models/__init__.py +0 -0
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/models/change.py +0 -0
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/models/errors.py +0 -0
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/openapi.py +0 -0
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/routers/__init__.py +0 -0
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/routers/auth.py +0 -0
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/routers/changes.py +0 -0
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/routers/incarnations.py +0 -0
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/routers/not_found.py +0 -0
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/routers/version.py +0 -0
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/services/__init__.py +0 -0
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/services/incarnation.py +0 -0
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/settings.py +0 -0
- {foxops-2.4.0 → foxops-2.5.1}/src/foxops/utils.py +0 -0
|
@@ -139,6 +139,7 @@ def cmd_initialize(
|
|
|
139
139
|
)
|
|
140
140
|
except Exception as exc:
|
|
141
141
|
logger.exception(f"initialization failed: {exc}")
|
|
142
|
+
raise typer.Exit(1)
|
|
142
143
|
else:
|
|
143
144
|
logger.info("successfully initialized incarnation")
|
|
144
145
|
finally:
|
|
@@ -261,6 +262,7 @@ def cmd_update(
|
|
|
261
262
|
logger.info("successfully updated incarnation")
|
|
262
263
|
except Exception as exc:
|
|
263
264
|
logger.exception(f"update failed: {exc}")
|
|
265
|
+
raise typer.Exit(1)
|
|
264
266
|
|
|
265
267
|
|
|
266
268
|
@app.callback()
|
|
@@ -193,9 +193,10 @@ class GitRepository:
|
|
|
193
193
|
|
|
194
194
|
return (await proc.stdout.read()).strip().decode()
|
|
195
195
|
|
|
196
|
-
async def merge(self, branch: str, ff_only: bool = False):
|
|
196
|
+
async def merge(self, branch: str, ff_only: bool = False, merge_message: str | None = None):
|
|
197
197
|
ff_only_args = ["--ff-only"] if ff_only else []
|
|
198
|
-
|
|
198
|
+
merge_message_args = ["-m", merge_message] if merge_message is not None else []
|
|
199
|
+
await self._run("merge", *ff_only_args, *merge_message_args, branch)
|
|
199
200
|
|
|
200
201
|
async def push(self, tags: bool = False) -> str:
|
|
201
202
|
if self.push_delay_seconds > 0:
|
|
@@ -7,7 +7,7 @@ from http import HTTPStatus
|
|
|
7
7
|
from pathlib import Path
|
|
8
8
|
from ssl import SSLZeroReturnError
|
|
9
9
|
from tempfile import mkdtemp
|
|
10
|
-
from typing import AsyncIterator, TypedDict
|
|
10
|
+
from typing import Any, AsyncIterator, TypedDict
|
|
11
11
|
from urllib.parse import quote_plus
|
|
12
12
|
|
|
13
13
|
import httpx
|
|
@@ -116,6 +116,7 @@ class GitlabHoster(Hoster):
|
|
|
116
116
|
source_branch: str,
|
|
117
117
|
title: str,
|
|
118
118
|
description: str,
|
|
119
|
+
incarnation_sub_directory: str,
|
|
119
120
|
with_automerge=False,
|
|
120
121
|
) -> tuple[GitSha, MergeRequestId]:
|
|
121
122
|
response = await self.client.get(
|
|
@@ -173,7 +174,13 @@ class GitlabHoster(Hoster):
|
|
|
173
174
|
|
|
174
175
|
if with_automerge:
|
|
175
176
|
logger.info(f"Triggering automerge for the new Merge Request {merge_request['web_url']}")
|
|
176
|
-
|
|
177
|
+
|
|
178
|
+
merge_message = f"Merge branch '{source_branch}' into '{target_branch}'"
|
|
179
|
+
|
|
180
|
+
if incarnation_sub_directory != ".":
|
|
181
|
+
merge_message = f"[{incarnation_sub_directory}]: {merge_message}"
|
|
182
|
+
|
|
183
|
+
merge_request = await self._automerge_merge_request(merge_request, merge_message)
|
|
177
184
|
|
|
178
185
|
return merge_request["sha"], str(merge_request["iid"])
|
|
179
186
|
|
|
@@ -272,7 +279,7 @@ class GitlabHoster(Hoster):
|
|
|
272
279
|
}
|
|
273
280
|
|
|
274
281
|
async def _automerge_merge_request(
|
|
275
|
-
self, merge_request: MergeRequest, timeout: timedelta | None = None
|
|
282
|
+
self, merge_request: MergeRequest, merge_commit_message: str, timeout: timedelta | None = None
|
|
276
283
|
) -> MergeRequest:
|
|
277
284
|
"""Automerge the given Merge Request.
|
|
278
285
|
|
|
@@ -292,7 +299,13 @@ class GitlabHoster(Hoster):
|
|
|
292
299
|
response.raise_for_status()
|
|
293
300
|
merge_request: MergeRequest = response.json()
|
|
294
301
|
has_pipeline = bool(merge_request["head_pipeline"])
|
|
295
|
-
data
|
|
302
|
+
data: dict[str, Any] = {
|
|
303
|
+
"merge_commit_message": merge_commit_message,
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
if has_pipeline:
|
|
307
|
+
data["merge_when_pipeline_succeeds"] = True
|
|
308
|
+
|
|
296
309
|
response = await self.client.put(
|
|
297
310
|
f"/projects/{merge_request['project_id']}/merge_requests/{merge_request['iid']}/merge",
|
|
298
311
|
json=data,
|
|
@@ -106,7 +106,14 @@ class LocalHoster(Hoster):
|
|
|
106
106
|
return commit_id, incarnation_state
|
|
107
107
|
|
|
108
108
|
async def merge_request(
|
|
109
|
-
self,
|
|
109
|
+
self,
|
|
110
|
+
*,
|
|
111
|
+
incarnation_repository: str,
|
|
112
|
+
source_branch: str,
|
|
113
|
+
title: str,
|
|
114
|
+
description: str,
|
|
115
|
+
incarnation_sub_directory: str,
|
|
116
|
+
with_automerge=False,
|
|
110
117
|
) -> tuple[GitSha, MergeRequestId]:
|
|
111
118
|
mr_manager = self._mr_manager(incarnation_repository)
|
|
112
119
|
|
|
@@ -117,7 +124,12 @@ class LocalHoster(Hoster):
|
|
|
117
124
|
mr_id = mr_manager.add(title, description, source_branch)
|
|
118
125
|
|
|
119
126
|
if with_automerge:
|
|
120
|
-
|
|
127
|
+
merge_message = f"Merge branch '{source_branch}' into 'main'"
|
|
128
|
+
|
|
129
|
+
if incarnation_sub_directory != ".":
|
|
130
|
+
merge_message = f"[{incarnation_sub_directory}]: {merge_message}"
|
|
131
|
+
|
|
132
|
+
await self.merge_merge_request(incarnation_repository, str(mr_id), merge_message)
|
|
121
133
|
|
|
122
134
|
return commit_id, str(mr_id)
|
|
123
135
|
|
|
@@ -128,12 +140,12 @@ class LocalHoster(Hoster):
|
|
|
128
140
|
mr = self.get_merge_request(incarnation_repository, merge_request_id)
|
|
129
141
|
self._mr_manager(incarnation_repository).update_status(mr.id, MergeRequestStatus.CLOSED)
|
|
130
142
|
|
|
131
|
-
async def merge_merge_request(self, incarnation_repository: str, merge_request_id: str):
|
|
143
|
+
async def merge_merge_request(self, incarnation_repository: str, merge_request_id: str, merge_message: str) -> None:
|
|
132
144
|
mr = self.get_merge_request(incarnation_repository, merge_request_id)
|
|
133
145
|
|
|
134
146
|
async with self.cloned_repository(incarnation_repository) as repo:
|
|
135
147
|
await repo.fetch(mr.source_branch)
|
|
136
|
-
await repo.merge(f"origin/{mr.source_branch}", ff_only=False)
|
|
148
|
+
await repo.merge(f"origin/{mr.source_branch}", ff_only=False, merge_message=merge_message)
|
|
137
149
|
await repo.push()
|
|
138
150
|
|
|
139
151
|
self._mr_manager(incarnation_repository).update_status(mr.id, MergeRequestStatus.MERGED)
|
|
@@ -39,7 +39,14 @@ class Hoster(Protocol):
|
|
|
39
39
|
...
|
|
40
40
|
|
|
41
41
|
async def merge_request(
|
|
42
|
-
self,
|
|
42
|
+
self,
|
|
43
|
+
*,
|
|
44
|
+
incarnation_repository: str,
|
|
45
|
+
source_branch: str,
|
|
46
|
+
title: str,
|
|
47
|
+
description: str,
|
|
48
|
+
incarnation_sub_directory: str,
|
|
49
|
+
with_automerge=False
|
|
43
50
|
) -> tuple[GitSha, MergeRequestId]:
|
|
44
51
|
...
|
|
45
52
|
|
|
@@ -35,6 +35,7 @@ class IncarnationBasic(BaseModel):
|
|
|
35
35
|
class IncarnationWithDetails(IncarnationBasic):
|
|
36
36
|
status: ReconciliationStatus = Field(description="DEPRECATED. Use the 'merge_request_status' field instead.")
|
|
37
37
|
merge_request_status: MergeRequestStatus | None
|
|
38
|
+
revision: int | None
|
|
38
39
|
|
|
39
40
|
template_repository: str | None
|
|
40
41
|
template_repository_version: str | None
|
|
@@ -93,6 +93,7 @@ class _PreparedChangeEnvironment:
|
|
|
93
93
|
incarnation_repository: GitRepository
|
|
94
94
|
incarnation_repository_identifier: str
|
|
95
95
|
incarnation_repository_default_branch: str
|
|
96
|
+
incarnation_target_directory: str
|
|
96
97
|
|
|
97
98
|
to_version_hash: str
|
|
98
99
|
to_version: str
|
|
@@ -272,6 +273,7 @@ class ChangeService:
|
|
|
272
273
|
source_branch=reset_branch_name,
|
|
273
274
|
title=title,
|
|
274
275
|
description=description,
|
|
276
|
+
incarnation_sub_directory=incarnation.target_directory,
|
|
275
277
|
with_automerge=False,
|
|
276
278
|
)
|
|
277
279
|
|
|
@@ -374,6 +376,7 @@ class ChangeService:
|
|
|
374
376
|
source_branch=env.branch_name,
|
|
375
377
|
title=title,
|
|
376
378
|
description=description,
|
|
379
|
+
incarnation_sub_directory=env.incarnation_target_directory,
|
|
377
380
|
with_automerge=automerge,
|
|
378
381
|
)
|
|
379
382
|
|
|
@@ -575,6 +578,7 @@ class ChangeService:
|
|
|
575
578
|
merge_request_url=merge_request_url,
|
|
576
579
|
merge_request_status=merge_request_status,
|
|
577
580
|
status=status,
|
|
581
|
+
revision=change.revision,
|
|
578
582
|
template_repository=incarnation.template_repository,
|
|
579
583
|
template_repository_version=change.requested_version,
|
|
580
584
|
template_repository_version_hash=change.requested_version_hash,
|
|
@@ -684,6 +688,7 @@ class ChangeService:
|
|
|
684
688
|
|
|
685
689
|
yield _PreparedChangeEnvironment(
|
|
686
690
|
incarnation_repository=local_incarnation_repository,
|
|
691
|
+
incarnation_target_directory=incarnation.target_directory,
|
|
687
692
|
incarnation_repository_identifier=incarnation.incarnation_repository,
|
|
688
693
|
incarnation_repository_default_branch=incarnation_repo_metadata["default_branch"],
|
|
689
694
|
to_version_hash=await local_template_repository.head(),
|
|
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
|