logdetective 0.11.2__py3-none-any.whl → 1.0.1__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.
- logdetective/server/gitlab.py +35 -9
- logdetective/server/models.py +2 -0
- {logdetective-0.11.2.dist-info → logdetective-1.0.1.dist-info}/METADATA +1 -1
- {logdetective-0.11.2.dist-info → logdetective-1.0.1.dist-info}/RECORD +7 -7
- {logdetective-0.11.2.dist-info → logdetective-1.0.1.dist-info}/LICENSE +0 -0
- {logdetective-0.11.2.dist-info → logdetective-1.0.1.dist-info}/WHEEL +0 -0
- {logdetective-0.11.2.dist-info → logdetective-1.0.1.dist-info}/entry_points.txt +0 -0
logdetective/server/gitlab.py
CHANGED
|
@@ -93,7 +93,7 @@ async def process_gitlab_job_event(
|
|
|
93
93
|
preprocessed_log.close()
|
|
94
94
|
|
|
95
95
|
# check if this project is on the opt-in list for posting comments.
|
|
96
|
-
if project.name
|
|
96
|
+
if not is_eligible_package(project.name):
|
|
97
97
|
LOG.info("Not publishing comment for unrecognized package %s", project.name)
|
|
98
98
|
return
|
|
99
99
|
|
|
@@ -111,6 +111,31 @@ async def process_gitlab_job_event(
|
|
|
111
111
|
return staged_response
|
|
112
112
|
|
|
113
113
|
|
|
114
|
+
def is_eligible_package(project_name: str):
|
|
115
|
+
"""Check whether the provided package name is eligible for posting
|
|
116
|
+
comments to the merge request"""
|
|
117
|
+
|
|
118
|
+
# First check the allow-list. If it's not allowed, we deny.
|
|
119
|
+
allowed = False
|
|
120
|
+
for pattern in SERVER_CONFIG.general.packages:
|
|
121
|
+
LOG.debug("include %s", pattern)
|
|
122
|
+
if re.search(pattern, project_name):
|
|
123
|
+
allowed = True
|
|
124
|
+
break
|
|
125
|
+
if not allowed:
|
|
126
|
+
# The project did not match any of the permitted regular expressions
|
|
127
|
+
return False
|
|
128
|
+
|
|
129
|
+
# Next, check the deny-list. If it was allowed before, but denied here, we deny.
|
|
130
|
+
for pattern in SERVER_CONFIG.general.excluded_packages:
|
|
131
|
+
LOG.debug("exclude %s", pattern)
|
|
132
|
+
if re.search(pattern, project_name):
|
|
133
|
+
return False
|
|
134
|
+
|
|
135
|
+
# It was allowed and not denied, so return True to indicate it is eligible
|
|
136
|
+
return True
|
|
137
|
+
|
|
138
|
+
|
|
114
139
|
class LogsTooLargeError(RuntimeError):
|
|
115
140
|
"""The log archive exceeds the configured maximum size"""
|
|
116
141
|
|
|
@@ -174,16 +199,17 @@ async def retrieve_and_preprocess_koji_logs(
|
|
|
174
199
|
with artifacts_zip.open(zipinfo.filename) as task_failed_log:
|
|
175
200
|
contents = task_failed_log.read().decode("utf-8")
|
|
176
201
|
match = FAILURE_LOG_REGEX.search(contents)
|
|
177
|
-
if
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
202
|
+
if match:
|
|
203
|
+
failure_log_name = match.group(1)
|
|
204
|
+
failed_arches[architecture] = PurePath(path.parent, failure_log_name)
|
|
205
|
+
else:
|
|
206
|
+
LOG.info(
|
|
182
207
|
"task_failed.log does not indicate which log contains the failure."
|
|
183
208
|
)
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
209
|
+
# The best thing we can do at this point is return the
|
|
210
|
+
# task_failed.log, since it will probably contain the most
|
|
211
|
+
# relevant information
|
|
212
|
+
failed_arches[architecture] = path
|
|
187
213
|
|
|
188
214
|
if not failed_arches:
|
|
189
215
|
# No failed task found in the sub-tasks.
|
logdetective/server/models.py
CHANGED
|
@@ -254,6 +254,7 @@ class GeneralConfig(BaseModel):
|
|
|
254
254
|
"""General config options for Log Detective"""
|
|
255
255
|
|
|
256
256
|
packages: List[str] = None
|
|
257
|
+
excluded_packages: List[str] = None
|
|
257
258
|
devmode: bool = False
|
|
258
259
|
sentry_dsn: HttpUrl | None = None
|
|
259
260
|
|
|
@@ -263,6 +264,7 @@ class GeneralConfig(BaseModel):
|
|
|
263
264
|
return
|
|
264
265
|
|
|
265
266
|
self.packages = data.get("packages", [])
|
|
267
|
+
self.excluded_packages = data.get("excluded_packages", [])
|
|
266
268
|
self.devmode = data.get("devmode", False)
|
|
267
269
|
self.sentry_dsn = data.get("sentry_dsn")
|
|
268
270
|
|
|
@@ -15,17 +15,17 @@ logdetective/server/database/models/__init__.py,sha256=xy2hkygyw6_87zPKkG20i7g7_
|
|
|
15
15
|
logdetective/server/database/models/merge_request_jobs.py,sha256=hw88wV1-3x7i53sX7ZotKClc6OsH1njPpbRSZofnqr4,18670
|
|
16
16
|
logdetective/server/database/models/metrics.py,sha256=yl9fS4IPVFWDeFvPAxO6zOVu6oLF319ApvVLAgnD5yU,13928
|
|
17
17
|
logdetective/server/emoji.py,sha256=g9GtMChwznD8g1xonsh-I_3xqRn6LBeg3sjPJWcI0Yg,3333
|
|
18
|
-
logdetective/server/gitlab.py,sha256=
|
|
18
|
+
logdetective/server/gitlab.py,sha256=1Qz62I8xIjwdk7vPhGTTPFkeWVrany8-GV5hfK6weNI,16233
|
|
19
19
|
logdetective/server/llm.py,sha256=JtSCZj8SLnoyTCUdhA0TwcsMZfmHFFru2bJ9txI3GuU,8727
|
|
20
20
|
logdetective/server/metric.py,sha256=B3ew_qSmtEMj6xl-FoOtS4F_bkplp-shhtfHF1cG_Io,4010
|
|
21
|
-
logdetective/server/models.py,sha256=
|
|
21
|
+
logdetective/server/models.py,sha256=mUBGzc0w6l-v1Q9lwDEcISn6SlFrrwbF3ypSmjNXbbs,11355
|
|
22
22
|
logdetective/server/plot.py,sha256=eZs4r9gua-nW3yymSMIz1leL9mb4QKlh6FJZSeOfZ5M,14872
|
|
23
23
|
logdetective/server/server.py,sha256=9shFgRkWcJVM2L7HHoQBMCfKuJamh2L4tC96duFPEOA,18127
|
|
24
24
|
logdetective/server/templates/gitlab_full_comment.md.j2,sha256=DQZ2WVFedpuXI6znbHIW4wpF9BmFS8FaUkowh8AnGhE,1627
|
|
25
25
|
logdetective/server/templates/gitlab_short_comment.md.j2,sha256=fzScpayv2vpRLczP_0O0YxtA8rsKvR6gSv4ntNdWb98,1443
|
|
26
26
|
logdetective/utils.py,sha256=hdExAC8FtDIxvdgIq-Ro6LVM-JZ-k_UofaMzaDAHvzM,6088
|
|
27
|
-
logdetective-0.
|
|
28
|
-
logdetective-0.
|
|
29
|
-
logdetective-0.
|
|
30
|
-
logdetective-0.
|
|
31
|
-
logdetective-0.
|
|
27
|
+
logdetective-1.0.1.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
|
28
|
+
logdetective-1.0.1.dist-info/METADATA,sha256=dkso00EVQfwxoBekYT6KW48WvFdFqlBjTPw9U5S0wCg,17136
|
|
29
|
+
logdetective-1.0.1.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
30
|
+
logdetective-1.0.1.dist-info/entry_points.txt,sha256=3K_vXja6PmcA8sNdUi63WdImeiNhVZcEGPTaoJmltfA,63
|
|
31
|
+
logdetective-1.0.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|