argus-alm 0.12.9__py3-none-any.whl → 0.13.0__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.
- argus/client/base.py +1 -1
- argus/client/driver_matrix_tests/cli.py +2 -2
- argus/client/driver_matrix_tests/client.py +1 -1
- argus/client/generic/cli.py +2 -2
- argus/client/generic_result.py +3 -2
- argus/client/sct/client.py +3 -3
- argus/client/sirenada/client.py +1 -1
- {argus_alm-0.12.9.dist-info → argus_alm-0.13.0.dist-info}/METADATA +2 -4
- argus_alm-0.13.0.dist-info/RECORD +20 -0
- argus/backend/.gitkeep +0 -0
- argus/backend/cli.py +0 -41
- argus/backend/controller/__init__.py +0 -0
- argus/backend/controller/admin.py +0 -20
- argus/backend/controller/admin_api.py +0 -354
- argus/backend/controller/api.py +0 -529
- argus/backend/controller/auth.py +0 -67
- argus/backend/controller/client_api.py +0 -108
- argus/backend/controller/main.py +0 -274
- argus/backend/controller/notification_api.py +0 -72
- argus/backend/controller/notifications.py +0 -13
- argus/backend/controller/team.py +0 -126
- argus/backend/controller/team_ui.py +0 -18
- argus/backend/controller/testrun_api.py +0 -482
- argus/backend/controller/view_api.py +0 -162
- argus/backend/db.py +0 -100
- argus/backend/error_handlers.py +0 -21
- argus/backend/events/event_processors.py +0 -34
- argus/backend/models/__init__.py +0 -0
- argus/backend/models/result.py +0 -138
- argus/backend/models/web.py +0 -389
- argus/backend/plugins/__init__.py +0 -0
- argus/backend/plugins/core.py +0 -225
- argus/backend/plugins/driver_matrix_tests/controller.py +0 -63
- argus/backend/plugins/driver_matrix_tests/model.py +0 -421
- argus/backend/plugins/driver_matrix_tests/plugin.py +0 -22
- argus/backend/plugins/driver_matrix_tests/raw_types.py +0 -62
- argus/backend/plugins/driver_matrix_tests/service.py +0 -60
- argus/backend/plugins/driver_matrix_tests/udt.py +0 -42
- argus/backend/plugins/generic/model.py +0 -79
- argus/backend/plugins/generic/plugin.py +0 -16
- argus/backend/plugins/generic/types.py +0 -13
- argus/backend/plugins/loader.py +0 -40
- argus/backend/plugins/sct/controller.py +0 -185
- argus/backend/plugins/sct/plugin.py +0 -38
- argus/backend/plugins/sct/resource_setup.py +0 -178
- argus/backend/plugins/sct/service.py +0 -491
- argus/backend/plugins/sct/testrun.py +0 -272
- argus/backend/plugins/sct/udt.py +0 -101
- argus/backend/plugins/sirenada/model.py +0 -113
- argus/backend/plugins/sirenada/plugin.py +0 -17
- argus/backend/service/admin.py +0 -27
- argus/backend/service/argus_service.py +0 -688
- argus/backend/service/build_system_monitor.py +0 -188
- argus/backend/service/client_service.py +0 -122
- argus/backend/service/event_service.py +0 -18
- argus/backend/service/jenkins_service.py +0 -240
- argus/backend/service/notification_manager.py +0 -150
- argus/backend/service/release_manager.py +0 -230
- argus/backend/service/results_service.py +0 -317
- argus/backend/service/stats.py +0 -540
- argus/backend/service/team_manager_service.py +0 -83
- argus/backend/service/testrun.py +0 -559
- argus/backend/service/user.py +0 -307
- argus/backend/service/views.py +0 -258
- argus/backend/template_filters.py +0 -27
- argus/backend/tests/__init__.py +0 -0
- argus/backend/tests/argus_web.test.yaml +0 -39
- argus/backend/tests/conftest.py +0 -44
- argus/backend/tests/results_service/__init__.py +0 -0
- argus/backend/tests/results_service/test_best_results.py +0 -70
- argus/backend/util/common.py +0 -65
- argus/backend/util/config.py +0 -38
- argus/backend/util/encoders.py +0 -41
- argus/backend/util/logsetup.py +0 -81
- argus/backend/util/module_loaders.py +0 -30
- argus/backend/util/send_email.py +0 -91
- argus/client/generic_result_old.py +0 -143
- argus/db/.gitkeep +0 -0
- argus/db/argus_json.py +0 -14
- argus/db/cloud_types.py +0 -125
- argus/db/config.py +0 -135
- argus/db/db_types.py +0 -139
- argus/db/interface.py +0 -370
- argus/db/testrun.py +0 -740
- argus/db/utils.py +0 -15
- argus_alm-0.12.9.dist-info/RECORD +0 -96
- /argus/{backend → common}/__init__.py +0 -0
- /argus/{backend/util → common}/enums.py +0 -0
- /argus/{backend/plugins/sct/types.py → common/sct_types.py} +0 -0
- /argus/{backend/plugins/sirenada/types.py → common/sirenada_types.py} +0 -0
- {argus_alm-0.12.9.dist-info → argus_alm-0.13.0.dist-info}/LICENSE +0 -0
- {argus_alm-0.12.9.dist-info → argus_alm-0.13.0.dist-info}/WHEEL +0 -0
- {argus_alm-0.12.9.dist-info → argus_alm-0.13.0.dist-info}/entry_points.txt +0 -0
|
@@ -1,482 +0,0 @@
|
|
|
1
|
-
import logging
|
|
2
|
-
from uuid import UUID
|
|
3
|
-
from flask import (
|
|
4
|
-
Blueprint,
|
|
5
|
-
request
|
|
6
|
-
)
|
|
7
|
-
|
|
8
|
-
from argus.backend.error_handlers import handle_api_exception
|
|
9
|
-
from argus.backend.models.web import ArgusTest
|
|
10
|
-
from argus.backend.service.jenkins_service import JenkinsService
|
|
11
|
-
from argus.backend.service.results_service import ResultsService
|
|
12
|
-
from argus.backend.service.testrun import TestRunService
|
|
13
|
-
from argus.backend.service.user import api_login_required
|
|
14
|
-
from argus.backend.util.common import get_payload
|
|
15
|
-
from argus.backend.util.enums import TestInvestigationStatus, TestStatus
|
|
16
|
-
|
|
17
|
-
bp = Blueprint('testrun_api', __name__, 'testrun')
|
|
18
|
-
bp.register_error_handler(Exception, handle_api_exception)
|
|
19
|
-
LOGGER = logging.getLogger(__name__)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
@bp.route("/test/<string:test_id>/runs")
|
|
23
|
-
@api_login_required
|
|
24
|
-
def get_runs_for_test(test_id: str):
|
|
25
|
-
limit = request.args.get("limit")
|
|
26
|
-
if not limit:
|
|
27
|
-
limit = 10
|
|
28
|
-
else:
|
|
29
|
-
limit = int(limit)
|
|
30
|
-
additional_runs = [UUID(run) for run in request.args.getlist('additionalRuns[]')]
|
|
31
|
-
service = TestRunService()
|
|
32
|
-
|
|
33
|
-
runs = service.get_runs_by_test_id(test_id=UUID(test_id), additional_runs=additional_runs, limit=limit)
|
|
34
|
-
|
|
35
|
-
return {
|
|
36
|
-
"status": "ok",
|
|
37
|
-
"response": runs
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
@bp.route("/run/<string:run_type>/<string:run_id>")
|
|
42
|
-
@api_login_required
|
|
43
|
-
def get_testrun(run_type: str, run_id: str):
|
|
44
|
-
run_id = UUID(run_id)
|
|
45
|
-
service = TestRunService()
|
|
46
|
-
test_run = service.get_run(run_type=run_type, run_id=run_id)
|
|
47
|
-
|
|
48
|
-
return {
|
|
49
|
-
"status": "ok",
|
|
50
|
-
"response": test_run
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
@bp.route("/run/<string:run_id>/activity")
|
|
55
|
-
@api_login_required
|
|
56
|
-
def test_run_activity(run_id: str):
|
|
57
|
-
run_id = UUID(run_id)
|
|
58
|
-
service = TestRunService()
|
|
59
|
-
activity = service.get_run_events(run_id=run_id)
|
|
60
|
-
|
|
61
|
-
return {
|
|
62
|
-
"status": "ok",
|
|
63
|
-
"response": activity
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
@bp.route("/run/<string:test_id>/<string:run_id>/fetch_results", methods=["GET"])
|
|
69
|
-
@api_login_required
|
|
70
|
-
def fetch_results(test_id: str, run_id: str):
|
|
71
|
-
tables = ResultsService().get_run_results(test_id=UUID(test_id), run_id=UUID(run_id))
|
|
72
|
-
return {
|
|
73
|
-
"status": "ok",
|
|
74
|
-
"tables": tables
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
@bp.route("/test/<string:test_id>/run/<string:run_id>/status/set", methods=["POST"])
|
|
79
|
-
@api_login_required
|
|
80
|
-
def set_testrun_status(test_id: str, run_id: str):
|
|
81
|
-
payload = get_payload(client_request=request)
|
|
82
|
-
new_status = payload.get("status")
|
|
83
|
-
if not new_status:
|
|
84
|
-
raise Exception("Status not specified in the request")
|
|
85
|
-
service = TestRunService()
|
|
86
|
-
result = service.change_run_status(
|
|
87
|
-
test_id=UUID(test_id),
|
|
88
|
-
run_id=UUID(run_id),
|
|
89
|
-
new_status=TestStatus(new_status)
|
|
90
|
-
)
|
|
91
|
-
|
|
92
|
-
return {
|
|
93
|
-
"status": "ok",
|
|
94
|
-
"response": result
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
@bp.route("/test/<string:test_id>/run/<string:run_id>/investigation_status/set", methods=["POST"])
|
|
99
|
-
@api_login_required
|
|
100
|
-
def set_testrun_investigation_status(test_id: str, run_id: str):
|
|
101
|
-
payload = get_payload(client_request=request)
|
|
102
|
-
new_status = payload.get("investigation_status")
|
|
103
|
-
if not new_status:
|
|
104
|
-
raise Exception("Status not specified in the request")
|
|
105
|
-
service = TestRunService()
|
|
106
|
-
result = service.change_run_investigation_status(
|
|
107
|
-
test_id=UUID(test_id),
|
|
108
|
-
run_id=UUID(run_id),
|
|
109
|
-
new_status=TestInvestigationStatus(new_status),
|
|
110
|
-
)
|
|
111
|
-
|
|
112
|
-
return {
|
|
113
|
-
"status": "ok",
|
|
114
|
-
"response": result
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
@bp.route("/test/<string:test_id>/run/<string:run_id>/assignee/set", methods=["POST"])
|
|
119
|
-
@api_login_required
|
|
120
|
-
def set_testrun_assignee(test_id: str, run_id: str):
|
|
121
|
-
payload = get_payload(client_request=request)
|
|
122
|
-
assignee = payload.get("assignee")
|
|
123
|
-
if not assignee:
|
|
124
|
-
raise Exception("Assignee not specified in the request")
|
|
125
|
-
service = TestRunService()
|
|
126
|
-
result = service.change_run_assignee(
|
|
127
|
-
test_id=UUID(test_id),
|
|
128
|
-
run_id=UUID(run_id),
|
|
129
|
-
new_assignee=UUID(assignee) if assignee != TestRunService.ASSIGNEE_PLACEHOLDER else None,
|
|
130
|
-
)
|
|
131
|
-
|
|
132
|
-
return {
|
|
133
|
-
"status": "ok",
|
|
134
|
-
"response": result
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
@bp.route("/test/<string:test_id>/run/<string:run_id>/issues/submit", methods=["POST"])
|
|
139
|
-
@api_login_required
|
|
140
|
-
def issues_submit(test_id: str, run_id: str):
|
|
141
|
-
payload = get_payload(client_request=request)
|
|
142
|
-
service = TestRunService()
|
|
143
|
-
submit_result = service.submit_github_issue(
|
|
144
|
-
issue_url=payload["issue_url"],
|
|
145
|
-
test_id=UUID(test_id),
|
|
146
|
-
run_id=UUID(run_id)
|
|
147
|
-
)
|
|
148
|
-
|
|
149
|
-
return {
|
|
150
|
-
"status": "ok",
|
|
151
|
-
"response": submit_result
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
@bp.route("/issues/get", methods=["GET"])
|
|
156
|
-
@api_login_required
|
|
157
|
-
def issues_get():
|
|
158
|
-
filter_key = request.args.get("filterKey")
|
|
159
|
-
if not filter_key:
|
|
160
|
-
raise Exception("Filter key not provided in the request")
|
|
161
|
-
key_value = request.args.get("id")
|
|
162
|
-
if not key_value:
|
|
163
|
-
raise Exception("Id wasn't provided in the request")
|
|
164
|
-
key_value = UUID(key_value)
|
|
165
|
-
aggregate_by_issue = request.args.get("aggregateByIssue")
|
|
166
|
-
aggregate_by_issue = bool(int(aggregate_by_issue)) if aggregate_by_issue else False
|
|
167
|
-
service = TestRunService()
|
|
168
|
-
issues = service.get_github_issues(
|
|
169
|
-
filter_key=filter_key,
|
|
170
|
-
filter_id=key_value,
|
|
171
|
-
aggregate_by_issue=aggregate_by_issue
|
|
172
|
-
)
|
|
173
|
-
|
|
174
|
-
return {
|
|
175
|
-
"status": "ok",
|
|
176
|
-
"response": issues
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
@bp.route("/issues/delete", methods=["POST"])
|
|
181
|
-
@api_login_required
|
|
182
|
-
def issues_delete():
|
|
183
|
-
payload = get_payload(client_request=request)
|
|
184
|
-
service = TestRunService()
|
|
185
|
-
result = service.delete_github_issue(issue_id=payload["issue_id"])
|
|
186
|
-
|
|
187
|
-
return {
|
|
188
|
-
"status": "ok",
|
|
189
|
-
"response": result
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
@bp.route("/run/<string:run_id>/comments", methods=["GET"])
|
|
194
|
-
@api_login_required
|
|
195
|
-
def get_testrun_comments(run_id: str):
|
|
196
|
-
service = TestRunService()
|
|
197
|
-
comments = service.get_run_comments(
|
|
198
|
-
run_id=UUID(run_id)
|
|
199
|
-
)
|
|
200
|
-
|
|
201
|
-
return {
|
|
202
|
-
"status": "ok",
|
|
203
|
-
"response": comments
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
@bp.route("/comment/<string:comment_id>/get", methods=["GET"])
|
|
208
|
-
@api_login_required
|
|
209
|
-
def get_single_comment(comment_id: str):
|
|
210
|
-
service = TestRunService()
|
|
211
|
-
comment = service.get_run_comment(
|
|
212
|
-
comment_id=UUID(comment_id)
|
|
213
|
-
)
|
|
214
|
-
|
|
215
|
-
return {
|
|
216
|
-
"status": "ok",
|
|
217
|
-
"response": comment
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
@bp.route("/test/<string:test_id>/run/<string:run_id>/comments/submit", methods=["POST"])
|
|
222
|
-
@api_login_required
|
|
223
|
-
def submit_testrun_comment(test_id: str, run_id: str):
|
|
224
|
-
payload = get_payload(request)
|
|
225
|
-
service = TestRunService()
|
|
226
|
-
result = service.post_run_comment(
|
|
227
|
-
test_id=UUID(test_id),
|
|
228
|
-
run_id=UUID(run_id),
|
|
229
|
-
message=payload["message"],
|
|
230
|
-
reactions=payload["reactions"],
|
|
231
|
-
mentions=payload["mentions"],
|
|
232
|
-
)
|
|
233
|
-
|
|
234
|
-
return {
|
|
235
|
-
"status": "ok",
|
|
236
|
-
"response": result
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
@bp.route("/test/<string:test_id>/run/<string:run_id>/comment/<string:comment_id>/update", methods=["POST"])
|
|
241
|
-
@api_login_required
|
|
242
|
-
def test_run_update_comment(test_id: str, run_id: str, comment_id: str):
|
|
243
|
-
payload = get_payload(request)
|
|
244
|
-
service = TestRunService()
|
|
245
|
-
result = service.update_run_comment(
|
|
246
|
-
test_id=UUID(test_id),
|
|
247
|
-
run_id=UUID(run_id),
|
|
248
|
-
comment_id=UUID(comment_id),
|
|
249
|
-
message=payload["message"],
|
|
250
|
-
reactions=payload["reactions"],
|
|
251
|
-
mentions=payload["mentions"],
|
|
252
|
-
)
|
|
253
|
-
|
|
254
|
-
return {
|
|
255
|
-
"status": "ok",
|
|
256
|
-
"response": result
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
@bp.route("/test/<string:test_id>/run/<string:run_id>/comment/<string:comment_id>/delete", methods=["POST"])
|
|
261
|
-
@api_login_required
|
|
262
|
-
def test_run_delete_comment(test_id: str, run_id: str, comment_id: str):
|
|
263
|
-
service = TestRunService()
|
|
264
|
-
result = service.delete_run_comment(
|
|
265
|
-
test_id=UUID(test_id),
|
|
266
|
-
run_id=UUID(run_id),
|
|
267
|
-
comment_id=UUID(comment_id),
|
|
268
|
-
)
|
|
269
|
-
|
|
270
|
-
return {
|
|
271
|
-
"status": "ok",
|
|
272
|
-
"response": result
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
@bp.route("/terminate_stuck_runs", methods=["POST"])
|
|
277
|
-
@api_login_required
|
|
278
|
-
def sct_terminate_stuck_runs():
|
|
279
|
-
result = TestRunService().terminate_stuck_runs()
|
|
280
|
-
return {
|
|
281
|
-
"status": "ok",
|
|
282
|
-
"response": {
|
|
283
|
-
"total": result
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
@bp.route("/ignore_jobs", methods=["POST"])
|
|
289
|
-
@api_login_required
|
|
290
|
-
def ignore_jobs():
|
|
291
|
-
payload = get_payload(request)
|
|
292
|
-
service = TestRunService()
|
|
293
|
-
|
|
294
|
-
result = service.ignore_jobs(test_id=payload["testId"], reason=payload["reason"])
|
|
295
|
-
|
|
296
|
-
return {
|
|
297
|
-
"status": "ok",
|
|
298
|
-
"response": {
|
|
299
|
-
"affectedJobs": result
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
@bp.route("/get_runs_by_test_id_run_id", methods=["POST"])
|
|
305
|
-
@api_login_required
|
|
306
|
-
def get_runs_by_test_id_run_id():
|
|
307
|
-
payload: list[tuple[UUID, UUID]] = get_payload(request)
|
|
308
|
-
service = TestRunService()
|
|
309
|
-
|
|
310
|
-
result = service.resolve_run_build_id_and_number_multiple(payload)
|
|
311
|
-
|
|
312
|
-
return {
|
|
313
|
-
"status": "ok",
|
|
314
|
-
"response": {
|
|
315
|
-
"runs": result
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
@bp.route("/jenkins/params", methods=["POST"])
|
|
321
|
-
@api_login_required
|
|
322
|
-
def get_jenkins_job_params():
|
|
323
|
-
|
|
324
|
-
payload = get_payload(request)
|
|
325
|
-
service = JenkinsService()
|
|
326
|
-
|
|
327
|
-
result = service.retrieve_job_parameters(build_id=payload["buildId"], build_number=payload["buildNumber"])
|
|
328
|
-
|
|
329
|
-
return {
|
|
330
|
-
"status": "ok",
|
|
331
|
-
"response": {
|
|
332
|
-
"parameters": result
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
@bp.route("/jenkins/build", methods=["POST"])
|
|
338
|
-
@api_login_required
|
|
339
|
-
def build_jenkins_job():
|
|
340
|
-
|
|
341
|
-
payload = get_payload(request)
|
|
342
|
-
service = JenkinsService()
|
|
343
|
-
|
|
344
|
-
result = service.build_job(build_id=payload["buildId"], params=payload["parameters"])
|
|
345
|
-
|
|
346
|
-
return {
|
|
347
|
-
"status": "ok",
|
|
348
|
-
"response": {
|
|
349
|
-
"queueItem": result
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
@bp.route("/jenkins/queue_info")
|
|
355
|
-
@api_login_required
|
|
356
|
-
def get_queue_info():
|
|
357
|
-
queue_item = request.args.get("queueItem")
|
|
358
|
-
if not queue_item:
|
|
359
|
-
raise Exception("No queueItem provided")
|
|
360
|
-
service = JenkinsService()
|
|
361
|
-
result = service.get_queue_info(int(queue_item))
|
|
362
|
-
|
|
363
|
-
return {
|
|
364
|
-
"status": "ok",
|
|
365
|
-
"response": {
|
|
366
|
-
"queueItem": result
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
@bp.route("/jenkins/clone/targets")
|
|
372
|
-
@api_login_required
|
|
373
|
-
def get_clone_targets():
|
|
374
|
-
test_id = request.args.get("testId")
|
|
375
|
-
if not test_id:
|
|
376
|
-
raise Exception("No testId provided")
|
|
377
|
-
service = JenkinsService()
|
|
378
|
-
result = service.get_releases_for_clone(test_id)
|
|
379
|
-
|
|
380
|
-
return {
|
|
381
|
-
"status": "ok",
|
|
382
|
-
"response": {
|
|
383
|
-
"targets": result
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
@bp.route("/jenkins/clone/groups")
|
|
389
|
-
@api_login_required
|
|
390
|
-
def get_groups_for_target():
|
|
391
|
-
target_id = request.args.get("targetId")
|
|
392
|
-
if not target_id:
|
|
393
|
-
raise Exception("No targetId provided")
|
|
394
|
-
service = JenkinsService()
|
|
395
|
-
result = service.get_groups_for_release(target_id)
|
|
396
|
-
|
|
397
|
-
return {
|
|
398
|
-
"status": "ok",
|
|
399
|
-
"response": {
|
|
400
|
-
"groups": result
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
@bp.route("/jenkins/clone/create", methods=["POST"])
|
|
406
|
-
@api_login_required
|
|
407
|
-
def clone_jenkins_job():
|
|
408
|
-
|
|
409
|
-
payload = get_payload(request)
|
|
410
|
-
service = JenkinsService()
|
|
411
|
-
|
|
412
|
-
result = service.clone_job(
|
|
413
|
-
current_test_id=payload["currentTestId"],
|
|
414
|
-
new_name=payload["newName"],
|
|
415
|
-
target=payload["target"],
|
|
416
|
-
group=payload["group"],
|
|
417
|
-
advanced_settings=payload["advancedSettings"],
|
|
418
|
-
)
|
|
419
|
-
|
|
420
|
-
return {
|
|
421
|
-
"status": "ok",
|
|
422
|
-
"response": result
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
@bp.route("/jenkins/clone/build", methods=["POST"])
|
|
427
|
-
@api_login_required
|
|
428
|
-
def clone_build_jenkins_job():
|
|
429
|
-
|
|
430
|
-
payload = get_payload(request)
|
|
431
|
-
service = JenkinsService()
|
|
432
|
-
|
|
433
|
-
result = service.clone_build_job(build_id=payload["buildId"], params=payload["parameters"])
|
|
434
|
-
|
|
435
|
-
return {
|
|
436
|
-
"status": "ok",
|
|
437
|
-
"response": result
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
@bp.route("/jenkins/clone/settings")
|
|
442
|
-
@api_login_required
|
|
443
|
-
def get_clone_job_advanced_settings():
|
|
444
|
-
build_id = request.args.get("buildId")
|
|
445
|
-
if not build_id:
|
|
446
|
-
raise Exception("No testId provided")
|
|
447
|
-
service = JenkinsService()
|
|
448
|
-
result = service.get_advanced_settings(build_id)
|
|
449
|
-
|
|
450
|
-
return {
|
|
451
|
-
"status": "ok",
|
|
452
|
-
"response": result
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
@bp.route("/jenkins/clone/settings/change", methods=["POST"])
|
|
457
|
-
@api_login_required
|
|
458
|
-
def set_job_settings():
|
|
459
|
-
payload = get_payload(request)
|
|
460
|
-
service = JenkinsService()
|
|
461
|
-
test = ArgusTest.get(build_system_id=payload["buildId"])
|
|
462
|
-
result = service.adjust_job_settings(build_id=test.build_system_id, plugin_name=test.plugin_name, settings=payload["settings"])
|
|
463
|
-
|
|
464
|
-
return {
|
|
465
|
-
"status": "ok",
|
|
466
|
-
"response": result
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
@bp.route("/jenkins/clone/settings/validate", methods=["POST"])
|
|
471
|
-
@api_login_required
|
|
472
|
-
def clone_validate_new_settings():
|
|
473
|
-
|
|
474
|
-
payload = get_payload(request)
|
|
475
|
-
service = JenkinsService()
|
|
476
|
-
|
|
477
|
-
result = service.verify_job_settings(build_id=payload["buildId"], new_settings=payload["newSettings"])
|
|
478
|
-
|
|
479
|
-
return {
|
|
480
|
-
"status": "ok",
|
|
481
|
-
"response": result
|
|
482
|
-
}
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
import logging
|
|
2
|
-
from uuid import UUID
|
|
3
|
-
from flask import (
|
|
4
|
-
Blueprint,
|
|
5
|
-
jsonify,
|
|
6
|
-
request,
|
|
7
|
-
)
|
|
8
|
-
from argus.backend.error_handlers import handle_api_exception
|
|
9
|
-
from argus.backend.models.web import User
|
|
10
|
-
from argus.backend.service.stats import ViewStatsCollector
|
|
11
|
-
from argus.backend.service.user import api_login_required
|
|
12
|
-
from argus.backend.service.views import UserViewService
|
|
13
|
-
from argus.backend.util.common import get_payload
|
|
14
|
-
|
|
15
|
-
bp = Blueprint('view_api', __name__, url_prefix='/views')
|
|
16
|
-
LOGGER = logging.getLogger(__name__)
|
|
17
|
-
bp.register_error_handler(Exception, handle_api_exception)
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
class ViewApiException(Exception):
|
|
21
|
-
pass
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
@bp.route("/", methods=["GET"])
|
|
25
|
-
@api_login_required
|
|
26
|
-
def index():
|
|
27
|
-
return {
|
|
28
|
-
"status": "ok",
|
|
29
|
-
"response": {
|
|
30
|
-
"version": "v1",
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
@bp.route("/create", methods=["POST"])
|
|
36
|
-
@api_login_required
|
|
37
|
-
def create_view():
|
|
38
|
-
payload = get_payload(request)
|
|
39
|
-
service = UserViewService()
|
|
40
|
-
view = service.create_view(
|
|
41
|
-
name=payload["name"],
|
|
42
|
-
items=payload["items"],
|
|
43
|
-
widget_settings=payload["settings"],
|
|
44
|
-
description=payload.get("description"),
|
|
45
|
-
display_name=payload.get("displayName")
|
|
46
|
-
)
|
|
47
|
-
return {
|
|
48
|
-
"status": "ok",
|
|
49
|
-
"response": view
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
@bp.route("/get", methods=["GET"])
|
|
54
|
-
@api_login_required
|
|
55
|
-
def get_view():
|
|
56
|
-
view_id = request.args.get("viewId")
|
|
57
|
-
if not view_id:
|
|
58
|
-
raise ViewApiException("No viewId provided.")
|
|
59
|
-
service = UserViewService()
|
|
60
|
-
view = service.get_view(UUID(view_id))
|
|
61
|
-
return {
|
|
62
|
-
"status": "ok",
|
|
63
|
-
"response": view
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
@bp.route("/all", methods=["GET"])
|
|
68
|
-
@api_login_required
|
|
69
|
-
def get_all_views():
|
|
70
|
-
user_id = request.args.get("userId")
|
|
71
|
-
if user_id:
|
|
72
|
-
user = User.get(id=user_id)
|
|
73
|
-
else:
|
|
74
|
-
user = None
|
|
75
|
-
service = UserViewService()
|
|
76
|
-
views = service.get_all_views(user)
|
|
77
|
-
return {
|
|
78
|
-
"status": "ok",
|
|
79
|
-
"response": views
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
@bp.route("/update", methods=["POST"])
|
|
84
|
-
@api_login_required
|
|
85
|
-
def update_view():
|
|
86
|
-
payload = get_payload(request)
|
|
87
|
-
service = UserViewService()
|
|
88
|
-
res = service.update_view(view_id=payload["viewId"], update_data=payload["updateData"])
|
|
89
|
-
return {
|
|
90
|
-
"status": "ok",
|
|
91
|
-
"response": res
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
@bp.route("/delete", methods=["POST"])
|
|
96
|
-
@api_login_required
|
|
97
|
-
def delete_view():
|
|
98
|
-
payload = get_payload(request)
|
|
99
|
-
service = UserViewService()
|
|
100
|
-
res = service.delete_view(payload["viewId"])
|
|
101
|
-
return {
|
|
102
|
-
"status": "ok",
|
|
103
|
-
"response": res
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
@bp.route("/search", methods=["GET"])
|
|
108
|
-
@api_login_required
|
|
109
|
-
def search_tests():
|
|
110
|
-
query = request.args.get("query")
|
|
111
|
-
service = UserViewService()
|
|
112
|
-
if query:
|
|
113
|
-
res = service.test_lookup(query)
|
|
114
|
-
else:
|
|
115
|
-
res = []
|
|
116
|
-
return {
|
|
117
|
-
"status": "ok",
|
|
118
|
-
"response": {
|
|
119
|
-
"hits": res,
|
|
120
|
-
"total": len(res)
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
@bp.route("/stats", methods=["GET"])
|
|
125
|
-
@api_login_required
|
|
126
|
-
def view_stats():
|
|
127
|
-
view_id = request.args.get("viewId")
|
|
128
|
-
if not view_id:
|
|
129
|
-
raise ViewApiException("No view id provided.")
|
|
130
|
-
limited = bool(int(request.args.get("limited", 0)))
|
|
131
|
-
version = request.args.get("productVersion", None)
|
|
132
|
-
include_no_version = bool(int(request.args.get("includeNoVersion", True)))
|
|
133
|
-
force = bool(int(request.args.get("force", 0)))
|
|
134
|
-
collector = ViewStatsCollector(view_id=view_id, filter=version)
|
|
135
|
-
stats = collector.collect(limited=limited, force=force, include_no_version=include_no_version)
|
|
136
|
-
|
|
137
|
-
res = jsonify({
|
|
138
|
-
"status": "ok",
|
|
139
|
-
"response": stats
|
|
140
|
-
})
|
|
141
|
-
res.cache_control.max_age = 300
|
|
142
|
-
return res
|
|
143
|
-
|
|
144
|
-
@bp.route("/<string:view_id>/versions", methods=["GET"])
|
|
145
|
-
@api_login_required
|
|
146
|
-
def view_versions(view_id: str):
|
|
147
|
-
service = UserViewService()
|
|
148
|
-
res = service.get_versions_for_view(view_id)
|
|
149
|
-
return {
|
|
150
|
-
"status": "ok",
|
|
151
|
-
"response": res
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
@bp.route("/<string:view_id>/resolve", methods=["GET"])
|
|
155
|
-
@api_login_required
|
|
156
|
-
def view_resolve(view_id: str):
|
|
157
|
-
service = UserViewService()
|
|
158
|
-
res = service.resolve_view_for_edit(view_id)
|
|
159
|
-
return {
|
|
160
|
-
"status": "ok",
|
|
161
|
-
"response": res
|
|
162
|
-
}
|