suite-py 1.41.3__tar.gz → 1.41.5__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.
- {suite_py-1.41.3 → suite_py-1.41.5}/PKG-INFO +2 -4
- {suite_py-1.41.3 → suite_py-1.41.5}/pyproject.toml +2 -4
- {suite_py-1.41.3 → suite_py-1.41.5}/suite_py/__version__.py +1 -1
- {suite_py-1.41.3 → suite_py-1.41.5}/suite_py/cli.py +60 -192
- {suite_py-1.41.3 → suite_py-1.41.5}/suite_py/commands/aggregator.py +3 -5
- {suite_py-1.41.3 → suite_py-1.41.5}/suite_py/commands/ask_review.py +3 -5
- {suite_py-1.41.3 → suite_py-1.41.5}/suite_py/commands/batch_job.py +1 -2
- {suite_py-1.41.3 → suite_py-1.41.5}/suite_py/commands/bump.py +1 -2
- {suite_py-1.41.3 → suite_py-1.41.5}/suite_py/commands/check.py +3 -5
- suite_py-1.41.5/suite_py/commands/context.py +26 -0
- {suite_py-1.41.3 → suite_py-1.41.5}/suite_py/commands/create_branch.py +1 -2
- {suite_py-1.41.3 → suite_py-1.41.5}/suite_py/commands/deploy.py +3 -5
- {suite_py-1.41.3 → suite_py-1.41.5}/suite_py/commands/docker.py +1 -2
- {suite_py-1.41.3 → suite_py-1.41.5}/suite_py/commands/generator.py +1 -2
- {suite_py-1.41.3 → suite_py-1.41.5}/suite_py/commands/id.py +1 -2
- {suite_py-1.41.3 → suite_py-1.41.5}/suite_py/commands/ip.py +1 -2
- suite_py-1.41.5/suite_py/commands/login.py +11 -0
- {suite_py-1.41.3 → suite_py-1.41.5}/suite_py/commands/merge_pr.py +3 -4
- {suite_py-1.41.3 → suite_py-1.41.5}/suite_py/commands/open_pr.py +4 -5
- {suite_py-1.41.3 → suite_py-1.41.5}/suite_py/commands/project_lock.py +3 -5
- {suite_py-1.41.3 → suite_py-1.41.5}/suite_py/commands/release.py +3 -5
- {suite_py-1.41.3 → suite_py-1.41.5}/suite_py/commands/secret.py +1 -2
- {suite_py-1.41.3 → suite_py-1.41.5}/suite_py/commands/set_token.py +1 -2
- {suite_py-1.41.3 → suite_py-1.41.5}/suite_py/commands/status.py +3 -4
- {suite_py-1.41.3 → suite_py-1.41.5}/suite_py/lib/handler/captainhook_handler.py +17 -9
- {suite_py-1.41.3 → suite_py-1.41.5}/suite_py/lib/handler/metrics_handler.py +8 -6
- suite_py-1.41.5/suite_py/lib/handler/okta_handler.py +81 -0
- {suite_py-1.41.3 → suite_py-1.41.5}/suite_py/lib/logger.py +1 -0
- {suite_py-1.41.3 → suite_py-1.41.5}/suite_py/lib/metrics.py +4 -2
- suite_py-1.41.5/suite_py/lib/oauth.py +156 -0
- {suite_py-1.41.3 → suite_py-1.41.5}/suite_py/lib/tokens.py +4 -0
- suite_py-1.41.3/suite_py/commands/login.py +0 -180
- suite_py-1.41.3/suite_py/commands/qa.py +0 -424
- suite_py-1.41.3/suite_py/lib/handler/qainit_handler.py +0 -259
- {suite_py-1.41.3 → suite_py-1.41.5}/LICENSE-APACHE +0 -0
- {suite_py-1.41.3 → suite_py-1.41.5}/LICENSE-MIT +0 -0
- {suite_py-1.41.3 → suite_py-1.41.5}/suite_py/__init__.py +0 -0
- {suite_py-1.41.3 → suite_py-1.41.5}/suite_py/commands/__init__.py +0 -0
- {suite_py-1.41.3 → suite_py-1.41.5}/suite_py/commands/common.py +0 -0
- {suite_py-1.41.3 → suite_py-1.41.5}/suite_py/lib/__init__.py +0 -0
- {suite_py-1.41.3 → suite_py-1.41.5}/suite_py/lib/config.py +0 -0
- {suite_py-1.41.3 → suite_py-1.41.5}/suite_py/lib/handler/__init__.py +0 -0
- {suite_py-1.41.3 → suite_py-1.41.5}/suite_py/lib/handler/aws_handler.py +0 -0
- {suite_py-1.41.3 → suite_py-1.41.5}/suite_py/lib/handler/changelog_handler.py +0 -0
- {suite_py-1.41.3 → suite_py-1.41.5}/suite_py/lib/handler/drone_handler.py +0 -0
- {suite_py-1.41.3 → suite_py-1.41.5}/suite_py/lib/handler/frequent_reviewers_handler.py +0 -0
- {suite_py-1.41.3 → suite_py-1.41.5}/suite_py/lib/handler/git_handler.py +0 -0
- {suite_py-1.41.3 → suite_py-1.41.5}/suite_py/lib/handler/github_handler.py +0 -0
- {suite_py-1.41.3 → suite_py-1.41.5}/suite_py/lib/handler/prompt_utils.py +0 -0
- {suite_py-1.41.3 → suite_py-1.41.5}/suite_py/lib/handler/vault_handler.py +0 -0
- {suite_py-1.41.3 → suite_py-1.41.5}/suite_py/lib/handler/version_handler.py +0 -0
- {suite_py-1.41.3 → suite_py-1.41.5}/suite_py/lib/handler/youtrack_handler.py +0 -0
- {suite_py-1.41.3 → suite_py-1.41.5}/suite_py/lib/requests/__init__.py +0 -0
- {suite_py-1.41.3 → suite_py-1.41.5}/suite_py/lib/requests/auth.py +0 -0
- {suite_py-1.41.3 → suite_py-1.41.5}/suite_py/lib/requests/session.py +0 -0
- {suite_py-1.41.3 → suite_py-1.41.5}/suite_py/lib/symbol.py +0 -0
- {suite_py-1.41.3/suite_py/commands → suite_py-1.41.5/suite_py}/templates/login.html +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: suite-py
|
|
3
|
-
Version: 1.41.
|
|
3
|
+
Version: 1.41.5
|
|
4
4
|
Summary:
|
|
5
5
|
Author: larrywax, EugenioLaghi, michelangelomo
|
|
6
6
|
Author-email: devops@prima.it
|
|
@@ -12,12 +12,10 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.11
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.12
|
|
14
14
|
Requires-Dist: Click (>=7.0)
|
|
15
|
-
Requires-Dist: Flask (==1.1.2)
|
|
16
15
|
Requires-Dist: InquirerPy (>=0.2.0)
|
|
17
16
|
Requires-Dist: Jinja2 (>=2.11,<3.0.0)
|
|
18
17
|
Requires-Dist: PyGithub (>=1.57)
|
|
19
18
|
Requires-Dist: PyYaml (>=5.4)
|
|
20
|
-
Requires-Dist: Werkzeug (==2.0.2)
|
|
21
19
|
Requires-Dist: autoupgrade-prima (>=0.6)
|
|
22
20
|
Requires-Dist: black (>=22.6,<25.0)
|
|
23
21
|
Requires-Dist: boto3 (>=1.17.84)
|
|
@@ -27,7 +25,7 @@ Requires-Dist: cryptography (==42.0.5)
|
|
|
27
25
|
Requires-Dist: halo (>=0.0.28)
|
|
28
26
|
Requires-Dist: inquirer (==3.1.4)
|
|
29
27
|
Requires-Dist: itsdangerous (==2.0.1)
|
|
30
|
-
Requires-Dist: keyring (>=23.9.1,<
|
|
28
|
+
Requires-Dist: keyring (>=23.9.1,<26.0.0)
|
|
31
29
|
Requires-Dist: kubernetes (==29.0.0)
|
|
32
30
|
Requires-Dist: logzero (==1.7.0)
|
|
33
31
|
Requires-Dist: markupsafe (==2.0.1)
|
|
@@ -2,16 +2,14 @@
|
|
|
2
2
|
authors = ["larrywax, EugenioLaghi, michelangelomo <devops@prima.it>"]
|
|
3
3
|
description = ""
|
|
4
4
|
name = "suite-py"
|
|
5
|
-
version = "1.41.
|
|
5
|
+
version = "1.41.5"
|
|
6
6
|
|
|
7
7
|
[tool.poetry.dependencies]
|
|
8
8
|
Click = ">=7.0"
|
|
9
|
-
Flask = "==1.1.2"
|
|
10
9
|
InquirerPy = ">=0.2.0"
|
|
11
10
|
Jinja2 = ">=2.11,<3.0.0"
|
|
12
11
|
PyGithub = ">=1.57"
|
|
13
12
|
PyYaml = ">=5.4"
|
|
14
|
-
Werkzeug = "==2.0.2"
|
|
15
13
|
autoupgrade-prima = ">=0.6"
|
|
16
14
|
black = ">=22.6,<25.0"
|
|
17
15
|
boto3 = ">=1.17.84"
|
|
@@ -20,7 +18,7 @@ colorama = ">=0.4.3"
|
|
|
20
18
|
halo = ">=0.0.28"
|
|
21
19
|
inquirer = "==3.1.4"
|
|
22
20
|
itsdangerous = "==2.0.1"
|
|
23
|
-
keyring = ">=23.9.1,<
|
|
21
|
+
keyring = ">=23.9.1,<26.0.0"
|
|
24
22
|
kubernetes = "==29.0.0"
|
|
25
23
|
logzero = "==1.7.0"
|
|
26
24
|
markupsafe = "==2.0.1"
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
|
2
|
-
__version__ = "1.41.
|
|
2
|
+
__version__ = "1.41.5"
|
|
@@ -4,27 +4,29 @@
|
|
|
4
4
|
# for performance reasons, so turn off the lint warning
|
|
5
5
|
# pylint: disable=import-outside-toplevel
|
|
6
6
|
|
|
7
|
-
from functools import wraps
|
|
8
7
|
import os
|
|
9
8
|
import sys
|
|
9
|
+
from functools import wraps
|
|
10
10
|
from typing import Optional
|
|
11
11
|
|
|
12
12
|
import click
|
|
13
|
-
from click.exceptions import ClickException
|
|
14
13
|
import pkg_resources
|
|
15
14
|
import requests
|
|
16
15
|
from autoupgrade import Package
|
|
16
|
+
from click.exceptions import ClickException
|
|
17
17
|
|
|
18
18
|
from suite_py.__version__ import __version__
|
|
19
|
-
from suite_py.
|
|
20
|
-
from suite_py.lib import metrics
|
|
19
|
+
from suite_py.commands.context import Context
|
|
20
|
+
from suite_py.lib import logger, metrics
|
|
21
21
|
from suite_py.lib.config import Config
|
|
22
22
|
from suite_py.lib.handler import git_handler as git
|
|
23
23
|
from suite_py.lib.handler import prompt_utils
|
|
24
|
+
from suite_py.lib.handler.captainhook_handler import CaptainHook
|
|
25
|
+
from suite_py.lib.handler.okta_handler import Okta
|
|
24
26
|
from suite_py.lib.tokens import Tokens
|
|
25
27
|
|
|
26
|
-
ALLOW_NO_GIT_SUBCOMMAND = ["login", "
|
|
27
|
-
ALLOW_NO_HOME_SUBCOMMAND = ["login", "
|
|
28
|
+
ALLOW_NO_GIT_SUBCOMMAND = ["login", "aggregator"]
|
|
29
|
+
ALLOW_NO_HOME_SUBCOMMAND = ["login", "aggregator"]
|
|
28
30
|
|
|
29
31
|
|
|
30
32
|
def maybe_inject_truststore() -> None:
|
|
@@ -121,7 +123,6 @@ def main(ctx, project, timeout, verbose):
|
|
|
121
123
|
config = Config()
|
|
122
124
|
|
|
123
125
|
logger.setup(verbose)
|
|
124
|
-
metrics.setup(config)
|
|
125
126
|
|
|
126
127
|
logger.debug(f"v{__version__}")
|
|
127
128
|
maybe_inject_truststore()
|
|
@@ -156,20 +157,30 @@ def main(ctx, project, timeout, verbose):
|
|
|
156
157
|
f"Do you want to continue on project {os.path.basename(project)}?"
|
|
157
158
|
):
|
|
158
159
|
return
|
|
159
|
-
|
|
160
|
-
ctx.ensure_object(dict)
|
|
161
|
-
ctx.obj["project"] = os.path.basename(project)
|
|
162
160
|
if timeout:
|
|
163
161
|
config.user["captainhook_timeout"] = timeout
|
|
164
|
-
|
|
165
|
-
|
|
162
|
+
|
|
163
|
+
project = os.path.basename(project)
|
|
164
|
+
tokens = Tokens()
|
|
165
|
+
okta = Okta(config, tokens)
|
|
166
|
+
captainhook = CaptainHook(config, okta, tokens)
|
|
167
|
+
|
|
168
|
+
ctx.obj = Context(
|
|
169
|
+
project=project,
|
|
170
|
+
tokens=tokens,
|
|
171
|
+
okta=okta,
|
|
172
|
+
config=config,
|
|
173
|
+
captainhook=captainhook,
|
|
174
|
+
)
|
|
175
|
+
|
|
176
|
+
ctx.obj.call(metrics.setup)
|
|
166
177
|
|
|
167
178
|
# Skip chdir if not needed
|
|
168
179
|
if (
|
|
169
180
|
ctx.invoked_subcommand not in ALLOW_NO_GIT_SUBCOMMAND
|
|
170
181
|
or ctx.invoked_subcommand not in ALLOW_NO_HOME_SUBCOMMAND
|
|
171
182
|
):
|
|
172
|
-
os.chdir(os.path.join(config.user["projects_home"], ctx.obj
|
|
183
|
+
os.chdir(os.path.join(config.user["projects_home"], ctx.obj.project))
|
|
173
184
|
|
|
174
185
|
|
|
175
186
|
@main.result_callback()
|
|
@@ -188,12 +199,10 @@ def cleanup(_obj, _, **_kwargs):
|
|
|
188
199
|
)
|
|
189
200
|
@click.pass_obj
|
|
190
201
|
@catch_exceptions
|
|
191
|
-
def bump(obj, project: Optional[str] = None, version: Optional[str] = None):
|
|
202
|
+
def bump(obj: Context, project: Optional[str] = None, version: Optional[str] = None):
|
|
192
203
|
from suite_py.commands.bump import Bump
|
|
193
204
|
|
|
194
|
-
Bump(
|
|
195
|
-
project=project, version=version
|
|
196
|
-
)
|
|
205
|
+
obj.call(Bump).run(project=project, version=version)
|
|
197
206
|
|
|
198
207
|
|
|
199
208
|
@main.command(
|
|
@@ -205,7 +214,7 @@ def bump(obj, project: Optional[str] = None, version: Optional[str] = None):
|
|
|
205
214
|
def cli_create_branch(obj, card):
|
|
206
215
|
from suite_py.commands.create_branch import CreateBranch
|
|
207
216
|
|
|
208
|
-
CreateBranch
|
|
217
|
+
obj.call(CreateBranch, card=card).run()
|
|
209
218
|
|
|
210
219
|
|
|
211
220
|
@main.command("lock", help="Lock project on staging or prod")
|
|
@@ -217,7 +226,7 @@ def cli_create_branch(obj, card):
|
|
|
217
226
|
def cli_lock_project(obj, environment):
|
|
218
227
|
from suite_py.commands.project_lock import ProjectLock
|
|
219
228
|
|
|
220
|
-
ProjectLock
|
|
229
|
+
obj.call(ProjectLock, env=environment, action="lock").run()
|
|
221
230
|
|
|
222
231
|
|
|
223
232
|
@main.command("unlock", help="Unlock project on staging or prod")
|
|
@@ -229,9 +238,7 @@ def cli_lock_project(obj, environment):
|
|
|
229
238
|
def cli_unlock_project(obj, environment):
|
|
230
239
|
from suite_py.commands.project_lock import ProjectLock
|
|
231
240
|
|
|
232
|
-
ProjectLock(
|
|
233
|
-
obj["project"], environment, "unlock", obj["config"], obj["tokens"]
|
|
234
|
-
).run()
|
|
241
|
+
obj.call(ProjectLock, env=environment, action="unlock").run()
|
|
235
242
|
|
|
236
243
|
|
|
237
244
|
@main.command("open-pr", help="Open a PR on GitHub")
|
|
@@ -239,8 +246,10 @@ def cli_unlock_project(obj, environment):
|
|
|
239
246
|
@catch_exceptions
|
|
240
247
|
def cli_open_pr(obj):
|
|
241
248
|
from suite_py.commands.open_pr import OpenPR
|
|
249
|
+
from suite_py.commands.ask_review import AskReview
|
|
242
250
|
|
|
243
|
-
|
|
251
|
+
ask_review = obj.call(AskReview)
|
|
252
|
+
obj.call(OpenPR, ask_review=ask_review).run()
|
|
244
253
|
|
|
245
254
|
|
|
246
255
|
@main.command("ask-review", help="Requests a PR review")
|
|
@@ -249,7 +258,7 @@ def cli_open_pr(obj):
|
|
|
249
258
|
def cli_ask_review(obj):
|
|
250
259
|
from suite_py.commands.ask_review import AskReview
|
|
251
260
|
|
|
252
|
-
AskReview
|
|
261
|
+
obj.call(AskReview).run()
|
|
253
262
|
|
|
254
263
|
|
|
255
264
|
@main.command(
|
|
@@ -260,7 +269,7 @@ def cli_ask_review(obj):
|
|
|
260
269
|
def cli_merge_pr(obj):
|
|
261
270
|
from suite_py.commands.merge_pr import MergePR
|
|
262
271
|
|
|
263
|
-
MergePR
|
|
272
|
+
obj.call(MergePR).run()
|
|
264
273
|
|
|
265
274
|
|
|
266
275
|
@main.group("release", help="Manage releases")
|
|
@@ -281,13 +290,7 @@ def release():
|
|
|
281
290
|
def cli_release_create(obj, deploy):
|
|
282
291
|
from suite_py.commands.release import Release
|
|
283
292
|
|
|
284
|
-
Release(
|
|
285
|
-
"create",
|
|
286
|
-
obj["project"],
|
|
287
|
-
obj["config"],
|
|
288
|
-
obj["tokens"],
|
|
289
|
-
flags={"deploy": deploy},
|
|
290
|
-
).run()
|
|
293
|
+
obj.call(Release, action="create", flags={"deploy": deploy}).run()
|
|
291
294
|
|
|
292
295
|
|
|
293
296
|
@release.command("deploy", help="Deploy a github release with Drone CI")
|
|
@@ -296,7 +299,7 @@ def cli_release_create(obj, deploy):
|
|
|
296
299
|
def cli_release_deploy(obj):
|
|
297
300
|
from suite_py.commands.release import Release
|
|
298
301
|
|
|
299
|
-
Release
|
|
302
|
+
obj.call(Release, action="deploy").run()
|
|
300
303
|
|
|
301
304
|
|
|
302
305
|
@release.command("rollback", help="Rollback a deployment")
|
|
@@ -305,7 +308,7 @@ def cli_release_deploy(obj):
|
|
|
305
308
|
def cli_release_rollback(obj):
|
|
306
309
|
from suite_py.commands.release import Release
|
|
307
310
|
|
|
308
|
-
Release
|
|
311
|
+
obj.call(Release, "rollback").run()
|
|
309
312
|
|
|
310
313
|
|
|
311
314
|
@main.command("deploy", help="Deploy master branch in production")
|
|
@@ -314,7 +317,7 @@ def cli_release_rollback(obj):
|
|
|
314
317
|
def cli_deploy(obj):
|
|
315
318
|
from suite_py.commands.deploy import Deploy
|
|
316
319
|
|
|
317
|
-
Deploy
|
|
320
|
+
obj.call(Deploy).run()
|
|
318
321
|
|
|
319
322
|
|
|
320
323
|
@main.group("docker", help="Manage docker images")
|
|
@@ -328,7 +331,7 @@ def docker():
|
|
|
328
331
|
def cli_docker_release(obj):
|
|
329
332
|
from suite_py.commands.docker import Docker
|
|
330
333
|
|
|
331
|
-
Docker
|
|
334
|
+
obj.call(Docker, action="release").run()
|
|
332
335
|
|
|
333
336
|
|
|
334
337
|
@docker.command("versions", help="List all available versions of specific image")
|
|
@@ -337,7 +340,7 @@ def cli_docker_release(obj):
|
|
|
337
340
|
def cli_docker_versions(obj):
|
|
338
341
|
from suite_py.commands.docker import Docker
|
|
339
342
|
|
|
340
|
-
Docker
|
|
343
|
+
obj.call(Docker, action="versions").run()
|
|
341
344
|
|
|
342
345
|
|
|
343
346
|
@main.command("status", help="Current status of a project")
|
|
@@ -346,7 +349,7 @@ def cli_docker_versions(obj):
|
|
|
346
349
|
def cli_status(obj):
|
|
347
350
|
from suite_py.commands.status import Status
|
|
348
351
|
|
|
349
|
-
Status
|
|
352
|
+
obj.call(Status, action="versions").run()
|
|
350
353
|
|
|
351
354
|
|
|
352
355
|
@main.command("check", help="Verify authorisations for third party services")
|
|
@@ -355,7 +358,7 @@ def cli_status(obj):
|
|
|
355
358
|
def cli_check(obj):
|
|
356
359
|
from suite_py.commands.check import Check
|
|
357
360
|
|
|
358
|
-
Check
|
|
361
|
+
obj.call(Check).run()
|
|
359
362
|
|
|
360
363
|
|
|
361
364
|
@main.command("id", help="Get the ID of the hosts where the task is running")
|
|
@@ -365,7 +368,7 @@ def cli_check(obj):
|
|
|
365
368
|
def cli_id(obj, environment):
|
|
366
369
|
from suite_py.commands.id import ID
|
|
367
370
|
|
|
368
|
-
ID
|
|
371
|
+
obj.call(ID, environment=environment).run()
|
|
369
372
|
|
|
370
373
|
|
|
371
374
|
@main.command("ip", help="Get the IP addresses of the hosts where the task is running")
|
|
@@ -375,7 +378,7 @@ def cli_id(obj, environment):
|
|
|
375
378
|
def cli_ip(obj, environment):
|
|
376
379
|
from suite_py.commands.ip import IP
|
|
377
380
|
|
|
378
|
-
IP
|
|
381
|
+
obj.call(IP, environment=environment).run()
|
|
379
382
|
|
|
380
383
|
|
|
381
384
|
@main.command("generator", help="Generate different files from templates")
|
|
@@ -384,7 +387,7 @@ def cli_ip(obj, environment):
|
|
|
384
387
|
def cli_generator(obj):
|
|
385
388
|
from suite_py.commands.generator import Generator
|
|
386
389
|
|
|
387
|
-
Generator
|
|
390
|
+
obj.call(Generator).run()
|
|
388
391
|
|
|
389
392
|
|
|
390
393
|
@main.group(
|
|
@@ -415,7 +418,7 @@ def aggregator(ctx, show_list, change):
|
|
|
415
418
|
def cli_aggregator_list(obj):
|
|
416
419
|
from suite_py.commands.aggregator import Aggregator
|
|
417
420
|
|
|
418
|
-
Aggregator
|
|
421
|
+
obj.call(Aggregator, action="list").run()
|
|
419
422
|
|
|
420
423
|
|
|
421
424
|
@aggregator.command("change", help="Change aggregator record")
|
|
@@ -424,7 +427,7 @@ def cli_aggregator_list(obj):
|
|
|
424
427
|
def cli_aggregator_change(obj):
|
|
425
428
|
from suite_py.commands.aggregator import Aggregator
|
|
426
429
|
|
|
427
|
-
Aggregator
|
|
430
|
+
obj.call(Aggregator, action="list").run()
|
|
428
431
|
|
|
429
432
|
|
|
430
433
|
@main.command("login", help="manage login against Auth0")
|
|
@@ -433,144 +436,7 @@ def cli_aggregator_change(obj):
|
|
|
433
436
|
def login(obj):
|
|
434
437
|
from suite_py.commands.login import Login
|
|
435
438
|
|
|
436
|
-
Login
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
@main.group("qa", help="Manage QA envs")
|
|
440
|
-
def qa():
|
|
441
|
-
pass
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
@qa.command("update-quota", help="Update quota in QA for a user")
|
|
445
|
-
@click.pass_obj
|
|
446
|
-
@catch_exceptions
|
|
447
|
-
def cli_qa_update_quota(obj):
|
|
448
|
-
from suite_py.commands.qa import QA
|
|
449
|
-
|
|
450
|
-
QA("update-quota", obj["project"], obj["config"], obj["tokens"]).run()
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
@qa.command("list", help="List QA envs for user: all to show qa of all users.")
|
|
454
|
-
@click.option("-u", "--user", "user", required=False)
|
|
455
|
-
@click.option("-s", "--status", "status", multiple=True, type=str)
|
|
456
|
-
@click.option("-c", "--card", "card", type=str)
|
|
457
|
-
@click.pass_obj
|
|
458
|
-
@catch_exceptions
|
|
459
|
-
def cli_qa_list(obj, user, status, card):
|
|
460
|
-
from suite_py.commands.qa import QA
|
|
461
|
-
|
|
462
|
-
QA(
|
|
463
|
-
"list",
|
|
464
|
-
obj["project"],
|
|
465
|
-
obj["config"],
|
|
466
|
-
obj["tokens"],
|
|
467
|
-
{"user": user, "status": status, "card": card},
|
|
468
|
-
).run()
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
@qa.command("create", help="Create QA env")
|
|
472
|
-
@click.argument("microservices", nargs=-1, required=True)
|
|
473
|
-
@click.pass_obj
|
|
474
|
-
@catch_exceptions
|
|
475
|
-
def cli_qa_create(obj, microservices):
|
|
476
|
-
from suite_py.commands.qa import QA
|
|
477
|
-
|
|
478
|
-
QA(
|
|
479
|
-
"create",
|
|
480
|
-
obj["project"],
|
|
481
|
-
obj["config"],
|
|
482
|
-
obj["tokens"],
|
|
483
|
-
{"services": microservices},
|
|
484
|
-
).run()
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
@qa.command("update", help="Update QA env")
|
|
488
|
-
@click.argument("qa_hash", required=True)
|
|
489
|
-
@click.argument("microservices", nargs=-1, required=True)
|
|
490
|
-
@click.pass_obj
|
|
491
|
-
@catch_exceptions
|
|
492
|
-
def cli_qa_update(obj, qa_hash, microservices):
|
|
493
|
-
from suite_py.commands.qa import QA
|
|
494
|
-
|
|
495
|
-
QA(
|
|
496
|
-
"update",
|
|
497
|
-
obj["project"],
|
|
498
|
-
obj["config"],
|
|
499
|
-
obj["tokens"],
|
|
500
|
-
{"hash": qa_hash, "services": microservices},
|
|
501
|
-
).run()
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
@qa.command("delete", help="Delete QA env")
|
|
505
|
-
@click.argument("qa_hashes", nargs=-1, required=True)
|
|
506
|
-
@click.option("--force", is_flag=True, default=False, help="Force QA deletion")
|
|
507
|
-
@click.pass_obj
|
|
508
|
-
@catch_exceptions
|
|
509
|
-
def cli_qa_delete(obj, qa_hashes, force):
|
|
510
|
-
from suite_py.commands.qa import QA
|
|
511
|
-
|
|
512
|
-
QA(
|
|
513
|
-
"delete",
|
|
514
|
-
obj["project"],
|
|
515
|
-
obj["config"],
|
|
516
|
-
obj["tokens"],
|
|
517
|
-
{"hashes": qa_hashes, "force": force},
|
|
518
|
-
).run()
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
@qa.command("freeze", help="Freeze QA env")
|
|
522
|
-
@click.argument("qa_hash", required=True)
|
|
523
|
-
@click.pass_obj
|
|
524
|
-
@catch_exceptions
|
|
525
|
-
def cli_qa_freeze(obj, qa_hash):
|
|
526
|
-
from suite_py.commands.qa import QA
|
|
527
|
-
|
|
528
|
-
QA("freeze", obj["project"], obj["config"], obj["tokens"], {"hash": qa_hash}).run()
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
@qa.command("unfreeze", help="Unfreeze QA env")
|
|
532
|
-
@click.argument("qa_hash", required=True)
|
|
533
|
-
@click.pass_obj
|
|
534
|
-
@catch_exceptions
|
|
535
|
-
def cli_qa_unfreeze(obj, qa_hash):
|
|
536
|
-
from suite_py.commands.qa import QA
|
|
537
|
-
|
|
538
|
-
QA(
|
|
539
|
-
"unfreeze", obj["project"], obj["config"], obj["tokens"], {"hash": qa_hash}
|
|
540
|
-
).run()
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
@qa.command("check", help="Check QA conf")
|
|
544
|
-
@click.pass_obj
|
|
545
|
-
@catch_exceptions
|
|
546
|
-
def cli_qa_check(obj):
|
|
547
|
-
from suite_py.commands.qa import QA
|
|
548
|
-
|
|
549
|
-
QA("check", obj["project"], obj["config"], obj["tokens"]).run()
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
@qa.command("describe", help="Describe QA environment")
|
|
553
|
-
@click.argument("qa_hash", required=True)
|
|
554
|
-
@click.option("--json", is_flag=True, default=False, help="Get response as JSON")
|
|
555
|
-
@click.pass_obj
|
|
556
|
-
@catch_exceptions
|
|
557
|
-
def cli_qa_describe(obj, qa_hash, json):
|
|
558
|
-
from suite_py.commands.qa import QA
|
|
559
|
-
|
|
560
|
-
flags = {"hash": qa_hash, "json": json}
|
|
561
|
-
QA("describe", obj["project"], obj["config"], obj["tokens"], flags).run()
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
@qa.command(
|
|
565
|
-
"toggle-maintenance",
|
|
566
|
-
help="Toggle maintenance mode (requires 'manage:maintenance' permission)",
|
|
567
|
-
)
|
|
568
|
-
@click.pass_obj
|
|
569
|
-
@catch_exceptions
|
|
570
|
-
def cli_qa_toggle_maintenance(obj):
|
|
571
|
-
from suite_py.commands.qa import QA
|
|
572
|
-
|
|
573
|
-
QA("toggle-maintenance", obj["project"], obj["config"], obj["tokens"]).run()
|
|
439
|
+
obj.call(Login).run()
|
|
574
440
|
|
|
575
441
|
|
|
576
442
|
@main.group(
|
|
@@ -588,7 +454,9 @@ def secret():
|
|
|
588
454
|
def cli_secret_create(obj, base_profile, secret_file):
|
|
589
455
|
from suite_py.commands.secret import Secret
|
|
590
456
|
|
|
591
|
-
|
|
457
|
+
obj.call(
|
|
458
|
+
Secret, action="create", base_profile=base_profile, secret_file=secret_file
|
|
459
|
+
).run()
|
|
592
460
|
|
|
593
461
|
|
|
594
462
|
@secret.command("grant", help="Grant permissions to an existing secret")
|
|
@@ -599,7 +467,9 @@ def cli_secret_create(obj, base_profile, secret_file):
|
|
|
599
467
|
def cli_secret_grant(obj, base_profile, secret_file):
|
|
600
468
|
from suite_py.commands.secret import Secret
|
|
601
469
|
|
|
602
|
-
|
|
470
|
+
obj.call(
|
|
471
|
+
Secret, action="grant", base_profile=base_profile, secret_file=secret_file
|
|
472
|
+
).run()
|
|
603
473
|
|
|
604
474
|
|
|
605
475
|
@main.command("batch-job", help="Run batch job on kube")
|
|
@@ -625,13 +495,11 @@ def cli_secret_grant(obj, base_profile, secret_file):
|
|
|
625
495
|
def cli_run_batch_job(obj, environment, cpu_request, memory_request):
|
|
626
496
|
from suite_py.commands.batch_job import BatchJob
|
|
627
497
|
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
cpu_request,
|
|
634
|
-
memory_request,
|
|
498
|
+
obj.call(
|
|
499
|
+
BatchJob,
|
|
500
|
+
environment=environment,
|
|
501
|
+
cpu_request=cpu_request,
|
|
502
|
+
memory_request=memory_request,
|
|
635
503
|
).run()
|
|
636
504
|
|
|
637
505
|
|
|
@@ -641,4 +509,4 @@ def cli_run_batch_job(obj, environment, cpu_request, memory_request):
|
|
|
641
509
|
def cli_set_token(obj):
|
|
642
510
|
from suite_py.commands.set_token import SetToken
|
|
643
511
|
|
|
644
|
-
SetToken
|
|
512
|
+
obj.call(SetToken).run()
|
|
@@ -7,15 +7,13 @@ from kubernetes import client, config
|
|
|
7
7
|
from rich.console import Console
|
|
8
8
|
from rich.table import Table
|
|
9
9
|
|
|
10
|
-
from suite_py.lib import logger
|
|
11
|
-
from suite_py.lib import metrics
|
|
10
|
+
from suite_py.lib import logger, metrics
|
|
12
11
|
from suite_py.lib.handler import prompt_utils
|
|
13
|
-
from suite_py.lib.handler.captainhook_handler import CaptainHook
|
|
14
12
|
|
|
15
13
|
|
|
16
14
|
class Aggregator:
|
|
17
|
-
def __init__(self,
|
|
18
|
-
self._captainhook =
|
|
15
|
+
def __init__(self, captainhook, command):
|
|
16
|
+
self._captainhook = captainhook
|
|
19
17
|
self._command = command
|
|
20
18
|
|
|
21
19
|
@metrics.command("aggregator")
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
import sys
|
|
3
3
|
|
|
4
|
-
from suite_py.lib import logger
|
|
5
|
-
from suite_py.lib import metrics
|
|
6
|
-
from suite_py.lib.handler.captainhook_handler import CaptainHook
|
|
4
|
+
from suite_py.lib import logger, metrics
|
|
7
5
|
from suite_py.lib.handler.frequent_reviewers_handler import FrequentReviewersHandler
|
|
8
6
|
from suite_py.lib.handler.git_handler import GitHandler
|
|
9
7
|
from suite_py.lib.handler.github_handler import GithubHandler
|
|
@@ -12,11 +10,11 @@ from suite_py.lib.handler.youtrack_handler import YoutrackHandler
|
|
|
12
10
|
|
|
13
11
|
|
|
14
12
|
class AskReview:
|
|
15
|
-
def __init__(self, project, config, tokens):
|
|
13
|
+
def __init__(self, project, captainhook, config, tokens):
|
|
16
14
|
self._project = project
|
|
17
15
|
self._config = config
|
|
18
16
|
self._youtrack = YoutrackHandler(config, tokens)
|
|
19
|
-
self._captainhook =
|
|
17
|
+
self._captainhook = captainhook
|
|
20
18
|
self._git = GitHandler(project, config)
|
|
21
19
|
self._github = GithubHandler(tokens)
|
|
22
20
|
self._frequent_reviewers = FrequentReviewersHandler(config)
|
|
@@ -5,8 +5,7 @@ import textwrap
|
|
|
5
5
|
|
|
6
6
|
import semver
|
|
7
7
|
|
|
8
|
-
from suite_py.lib import logger
|
|
9
|
-
from suite_py.lib import metrics
|
|
8
|
+
from suite_py.lib import logger, metrics
|
|
10
9
|
from suite_py.lib.handler import prompt_utils
|
|
11
10
|
from suite_py.lib.handler.drone_handler import DroneHandler
|
|
12
11
|
from suite_py.lib.handler.git_handler import GitHandler
|
|
@@ -8,8 +8,7 @@ from typing import Any, Dict, List, Optional, cast
|
|
|
8
8
|
|
|
9
9
|
from yaml import safe_load
|
|
10
10
|
|
|
11
|
-
from suite_py.lib import logger
|
|
12
|
-
from suite_py.lib import metrics
|
|
11
|
+
from suite_py.lib import logger, metrics
|
|
13
12
|
from suite_py.lib.handler.changelog_handler import ChangelogHandler
|
|
14
13
|
from suite_py.lib.handler.git_handler import GitHandler
|
|
15
14
|
from suite_py.lib.handler.github_handler import GithubHandler
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
|
|
3
|
-
from suite_py.lib import logger
|
|
4
|
-
from suite_py.lib import metrics
|
|
3
|
+
from suite_py.lib import logger, metrics
|
|
5
4
|
from suite_py.lib.handler import prompt_utils
|
|
6
|
-
from suite_py.lib.handler.captainhook_handler import CaptainHook
|
|
7
5
|
from suite_py.lib.handler.drone_handler import DroneHandler
|
|
8
6
|
from suite_py.lib.handler.github_handler import GithubHandler
|
|
9
7
|
from suite_py.lib.handler.youtrack_handler import YoutrackHandler
|
|
@@ -11,13 +9,13 @@ from suite_py.lib.symbol import CHECKMARK, CROSSMARK
|
|
|
11
9
|
|
|
12
10
|
|
|
13
11
|
class Check:
|
|
14
|
-
def __init__(self, config, tokens):
|
|
12
|
+
def __init__(self, captainhook, config, tokens):
|
|
15
13
|
self.config = config
|
|
16
14
|
self._invalid_or_missing_tokens = []
|
|
17
15
|
self._tokens = tokens
|
|
18
16
|
self._youtrack = YoutrackHandler(config, tokens)
|
|
19
17
|
self._github = GithubHandler(tokens)
|
|
20
|
-
self._captainhook =
|
|
18
|
+
self._captainhook = captainhook
|
|
21
19
|
self._drone = DroneHandler(config, tokens)
|
|
22
20
|
|
|
23
21
|
self._checks = [
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import dataclasses
|
|
2
|
+
from inspect import signature
|
|
3
|
+
|
|
4
|
+
from suite_py.lib.config import Config
|
|
5
|
+
from suite_py.lib.handler.captainhook_handler import CaptainHook
|
|
6
|
+
from suite_py.lib.handler.okta_handler import Okta
|
|
7
|
+
from suite_py.lib.tokens import Tokens
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@dataclasses.dataclass
|
|
11
|
+
class Context:
|
|
12
|
+
project: str
|
|
13
|
+
config: Config
|
|
14
|
+
captainhook: CaptainHook
|
|
15
|
+
tokens: Tokens
|
|
16
|
+
okta: Okta
|
|
17
|
+
|
|
18
|
+
# Call the function to_call with kwargs, injecting fields from self as default arguments
|
|
19
|
+
def call(self, to_call, **kwargs):
|
|
20
|
+
provided = dataclasses.asdict(self)
|
|
21
|
+
needed = signature(to_call).parameters.keys()
|
|
22
|
+
provided = {k: provided[k] for k in needed if k in provided}
|
|
23
|
+
|
|
24
|
+
kwargs = provided | kwargs
|
|
25
|
+
|
|
26
|
+
return to_call(**kwargs)
|
|
@@ -4,8 +4,7 @@ import sys
|
|
|
4
4
|
|
|
5
5
|
import requests
|
|
6
6
|
|
|
7
|
-
from suite_py.lib import logger
|
|
8
|
-
from suite_py.lib import metrics
|
|
7
|
+
from suite_py.lib import logger, metrics
|
|
9
8
|
from suite_py.lib.handler import prompt_utils
|
|
10
9
|
from suite_py.lib.handler.git_handler import GitHandler, is_branch_name_valid
|
|
11
10
|
from suite_py.lib.handler.youtrack_handler import YoutrackHandler
|
|
@@ -4,11 +4,9 @@ import sys
|
|
|
4
4
|
|
|
5
5
|
from suite_py.commands import common
|
|
6
6
|
from suite_py.commands.release import _parse_available_countries
|
|
7
|
-
from suite_py.lib import logger
|
|
8
|
-
from suite_py.lib import metrics
|
|
7
|
+
from suite_py.lib import logger, metrics
|
|
9
8
|
from suite_py.lib.handler import git_handler as git
|
|
10
9
|
from suite_py.lib.handler import prompt_utils
|
|
11
|
-
from suite_py.lib.handler.captainhook_handler import CaptainHook
|
|
12
10
|
from suite_py.lib.handler.changelog_handler import ChangelogHandler
|
|
13
11
|
from suite_py.lib.handler.drone_handler import DroneHandler
|
|
14
12
|
from suite_py.lib.handler.git_handler import GitHandler
|
|
@@ -19,11 +17,11 @@ from suite_py.lib.handler.youtrack_handler import YoutrackHandler
|
|
|
19
17
|
|
|
20
18
|
class Deploy:
|
|
21
19
|
# pylint: disable=too-many-instance-attributes
|
|
22
|
-
def __init__(self, project, config, tokens):
|
|
20
|
+
def __init__(self, project, captainhook, config, tokens):
|
|
23
21
|
self._project = project
|
|
24
22
|
self._config = config
|
|
25
23
|
self._youtrack = YoutrackHandler(config, tokens)
|
|
26
|
-
self._captainhook =
|
|
24
|
+
self._captainhook = captainhook
|
|
27
25
|
self._changelog_handler = ChangelogHandler()
|
|
28
26
|
self._github = GithubHandler(tokens)
|
|
29
27
|
self._repo = self._github.get_repo(project)
|