qontract-reconcile 0.10.1rc743__py3-none-any.whl → 0.10.1rc744__py3-none-any.whl
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.
- {qontract_reconcile-0.10.1rc743.dist-info → qontract_reconcile-0.10.1rc744.dist-info}/METADATA +1 -1
- {qontract_reconcile-0.10.1rc743.dist-info → qontract_reconcile-0.10.1rc744.dist-info}/RECORD +6 -6
- reconcile/utils/vcs.py +52 -4
- {qontract_reconcile-0.10.1rc743.dist-info → qontract_reconcile-0.10.1rc744.dist-info}/WHEEL +0 -0
- {qontract_reconcile-0.10.1rc743.dist-info → qontract_reconcile-0.10.1rc744.dist-info}/entry_points.txt +0 -0
- {qontract_reconcile-0.10.1rc743.dist-info → qontract_reconcile-0.10.1rc744.dist-info}/top_level.txt +0 -0
{qontract_reconcile-0.10.1rc743.dist-info → qontract_reconcile-0.10.1rc744.dist-info}/METADATA
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: qontract-reconcile
|
3
|
-
Version: 0.10.
|
3
|
+
Version: 0.10.1rc744
|
4
4
|
Summary: Collection of tools to reconcile services with their desired state as defined in the app-interface DB.
|
5
5
|
Home-page: https://github.com/app-sre/qontract-reconcile
|
6
6
|
Author: Red Hat App-SRE Team
|
{qontract_reconcile-0.10.1rc743.dist-info → qontract_reconcile-0.10.1rc744.dist-info}/RECORD
RENAMED
@@ -663,7 +663,7 @@ reconcile/utils/throughput.py,sha256=iP4UWAe2LVhDo69mPPmgo9nQ7RxHD6_GS8MZe-aSiuM
|
|
663
663
|
reconcile/utils/unleash.py,sha256=1D56CsZfE3ShDtN3IErE1T2eeIwNmxhK-yYbCotJ99E,3601
|
664
664
|
reconcile/utils/vault.py,sha256=S0eHqvZ9N3fya1E8YDaUffEvLk_fdtpzL4rvWn6f828,14991
|
665
665
|
reconcile/utils/vaultsecretref.py,sha256=3Ed2uBy36TzSvL0B-l4FoWQqB2SbBKDKEuUPIO608Bo,931
|
666
|
-
reconcile/utils/vcs.py,sha256=
|
666
|
+
reconcile/utils/vcs.py,sha256=uHFyYSHGpsdtiY76XVquq_5IzJTkkghBwWESeCJIeAw,8416
|
667
667
|
reconcile/utils/acs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
668
668
|
reconcile/utils/acs/base.py,sha256=kjcxLGIMe8oLNFOxZ_bDcClFqGCL7Auwug5is0yNGbw,2555
|
669
669
|
reconcile/utils/acs/notifiers.py,sha256=2n5blP9N1FdGLZuy3do9bpjd8NKg88kmLNNqhAGn8w4,5013
|
@@ -777,8 +777,8 @@ tools/test/test_app_interface_metrics_exporter.py,sha256=SX7qL3D1SIRKFo95FoQztvf
|
|
777
777
|
tools/test/test_qontract_cli.py,sha256=w2l4BHB09k1d-BGJ1jBUNCqDv7zkqYrMHojQXg-21kQ,4155
|
778
778
|
tools/test/test_sd_app_sre_alert_report.py,sha256=v363r9zM7__0kR5K6mvJoGFcM9BvE33fWAayrqkpojA,2116
|
779
779
|
tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
|
780
|
-
qontract_reconcile-0.10.
|
781
|
-
qontract_reconcile-0.10.
|
782
|
-
qontract_reconcile-0.10.
|
783
|
-
qontract_reconcile-0.10.
|
784
|
-
qontract_reconcile-0.10.
|
780
|
+
qontract_reconcile-0.10.1rc744.dist-info/METADATA,sha256=sIbstE_GcpNpldwcIVZDvFWxsYWgttSR6hyw9KGJai4,2382
|
781
|
+
qontract_reconcile-0.10.1rc744.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
782
|
+
qontract_reconcile-0.10.1rc744.dist-info/entry_points.txt,sha256=rIxI5zWtHNlfpDeq1a7pZXAPoqf7HG32KMTN3MeWK_8,429
|
783
|
+
qontract_reconcile-0.10.1rc744.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
|
784
|
+
qontract_reconcile-0.10.1rc744.dist-info/RECORD,,
|
reconcile/utils/vcs.py
CHANGED
@@ -3,6 +3,8 @@ from __future__ import annotations
|
|
3
3
|
import logging
|
4
4
|
import re
|
5
5
|
from collections.abc import Iterable
|
6
|
+
from dataclasses import dataclass
|
7
|
+
from datetime import datetime
|
6
8
|
from enum import Enum
|
7
9
|
from typing import Optional
|
8
10
|
|
@@ -29,6 +31,13 @@ class MRCheckStatus(Enum):
|
|
29
31
|
RUNNING = 3
|
30
32
|
|
31
33
|
|
34
|
+
@dataclass(order=True)
|
35
|
+
class Commit:
|
36
|
+
repo: str
|
37
|
+
sha: str
|
38
|
+
date: datetime
|
39
|
+
|
40
|
+
|
32
41
|
class VCS:
|
33
42
|
"""
|
34
43
|
Abstraction layer for aggregating different Version Control Systems.
|
@@ -46,17 +55,20 @@ class VCS:
|
|
46
55
|
gitlab_instances: Iterable[GitlabInstanceV1],
|
47
56
|
app_interface_repo_url: str,
|
48
57
|
dry_run: bool,
|
49
|
-
allow_deleting_mrs: bool,
|
50
|
-
allow_opening_mrs: bool,
|
58
|
+
allow_deleting_mrs: bool = False,
|
59
|
+
allow_opening_mrs: bool = False,
|
51
60
|
gitlab_instance: Optional[GitLabApi] = None,
|
52
61
|
default_gh_token: Optional[str] = None,
|
53
62
|
app_interface_api: Optional[GitLabApi] = None,
|
63
|
+
github_api_per_repo_url: Optional[dict[str, GithubRepositoryApi]] = None,
|
54
64
|
):
|
55
65
|
self._dry_run = dry_run
|
56
66
|
self._allow_deleting_mrs = allow_deleting_mrs
|
57
67
|
self._allow_opening_mrs = allow_opening_mrs
|
58
68
|
self._secret_reader = secret_reader
|
59
|
-
self._gh_per_repo_url: dict[str, GithubRepositoryApi] =
|
69
|
+
self._gh_per_repo_url: dict[str, GithubRepositoryApi] = (
|
70
|
+
{} if not github_api_per_repo_url else github_api_per_repo_url
|
71
|
+
)
|
60
72
|
self._default_gh_token = (
|
61
73
|
default_gh_token
|
62
74
|
if default_gh_token
|
@@ -151,12 +163,48 @@ class VCS:
|
|
151
163
|
) -> str:
|
152
164
|
if bool(self._is_commit_sha_regex.search(ref)):
|
153
165
|
return ref
|
154
|
-
if "github.com"
|
166
|
+
if repo_url.startswith("https://github.com/"):
|
155
167
|
github = self._init_github(repo_url=repo_url, auth_code=auth_code)
|
156
168
|
return github.get_commit_sha(ref=ref)
|
157
169
|
# assume gitlab by default
|
158
170
|
return self._gitlab_instance.get_commit_sha(ref=ref, repo_url=repo_url)
|
159
171
|
|
172
|
+
def get_commits_between(
|
173
|
+
self,
|
174
|
+
repo_url: str,
|
175
|
+
commit_from: str,
|
176
|
+
commit_to: str,
|
177
|
+
auth_code: Optional[HasSecret],
|
178
|
+
) -> list[Commit]:
|
179
|
+
"""
|
180
|
+
Return a list of commits between two commits.
|
181
|
+
Note, that the commit_to is included in the result list, whereas commit_from is not included.
|
182
|
+
"""
|
183
|
+
if repo_url.startswith("https://github.com/"):
|
184
|
+
github = self._init_github(repo_url=repo_url, auth_code=auth_code)
|
185
|
+
data = github.compare(commit_from=commit_from, commit_to=commit_to)
|
186
|
+
return [
|
187
|
+
Commit(
|
188
|
+
repo=repo_url,
|
189
|
+
sha=gh_commit.sha,
|
190
|
+
date=gh_commit.commit.committer.date,
|
191
|
+
)
|
192
|
+
for gh_commit in data
|
193
|
+
]
|
194
|
+
# assume gitlab by default
|
195
|
+
else:
|
196
|
+
data = self._gitlab_instance.repository_compare(
|
197
|
+
repo_url=repo_url, ref_from=commit_from, ref_to=commit_to
|
198
|
+
)
|
199
|
+
return [
|
200
|
+
Commit(
|
201
|
+
repo=repo_url,
|
202
|
+
sha=gl_commit["id"],
|
203
|
+
date=datetime.fromisoformat(gl_commit["committed_date"]),
|
204
|
+
)
|
205
|
+
for gl_commit in data
|
206
|
+
]
|
207
|
+
|
160
208
|
def close_app_interface_mr(self, mr: ProjectMergeRequest, comment: str) -> None:
|
161
209
|
if not self._allow_deleting_mrs:
|
162
210
|
logging.info("Deleting MRs is disabled. Skipping.")
|
File without changes
|
File without changes
|
{qontract_reconcile-0.10.1rc743.dist-info → qontract_reconcile-0.10.1rc744.dist-info}/top_level.txt
RENAMED
File without changes
|