qontract-reconcile 0.9.1rc132__py3-none-any.whl → 0.9.1rc133__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: qontract-reconcile
3
- Version: 0.9.1rc132
3
+ Version: 0.9.1rc133
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
@@ -16,7 +16,7 @@ reconcile/aws_iam_password_reset.py,sha256=Fequr4Zs7oARnp0rpC4B4rVfyZvl6LXZ3kaDs
16
16
  reconcile/aws_support_cases_sos.py,sha256=UJEs3lpmCioUxLu9ek2WuySCI3sYyc2dVP9zU0FIh1s,2888
17
17
  reconcile/blackbox_exporter_endpoint_monitoring.py,sha256=4MrHEFUCaHDtSL8DPAo7iJgZ95Nl1HiVzNFvshAJ0_M,3552
18
18
  reconcile/checkpoint.py,sha256=figtZRuWUvdpdSnkhAqeGvO5dI02TT6J3heyeFhlwqM,5016
19
- reconcile/cli.py,sha256=BH6ADj_EGy3ruZ9k_W1fA9hNUC5Yehr3jYZvr8jZpOc,70745
19
+ reconcile/cli.py,sha256=_CnhmVbwH6d97ud04cX2Y5GqxrKyMg1-pIAI3T502pM,70825
20
20
  reconcile/closedbox_endpoint_monitoring_base.py,sha256=Yl1_BzgIQbLS6Y16W-u0I82WMcXADpIUOpfQ4J88umY,4888
21
21
  reconcile/cluster_deployment_mapper.py,sha256=2Ah-nu-Mdig0pjuiZl_XLrmVAjYzFjORR3dMlCgkmw0,2352
22
22
  reconcile/dashdotdb_base.py,sha256=Ca75-OQiu5HeA8Q6zQpEYuhyCSjeuWe99K4y9ipTORM,4032
@@ -87,7 +87,7 @@ reconcile/openshift_resources.py,sha256=Lkn3KdIqxUCmOzlwoKjM2xVotTbJDfgjMGySvWtB
87
87
  reconcile/openshift_resources_base.py,sha256=tWUCzZNEEOTjrl-9Fj2BUwSMt1xNyhqiqwSLBPXlZr4,40756
88
88
  reconcile/openshift_rolebindings.py,sha256=1k0o3hb3ZhhlbUjc8cP7IjKFux0oZApT8kLT8Y-pvqI,6579
89
89
  reconcile/openshift_routes.py,sha256=fXvuPSjcjVw1X3j2EQvUAdbOepmIFdKk-M3qP8QzPiw,1075
90
- reconcile/openshift_saas_deploy.py,sha256=4Ufk_dbd2ZkeAI8Q-blAgDrnXg9qqtq63LrkPNiBSZs,7857
90
+ reconcile/openshift_saas_deploy.py,sha256=URaGXvp5C4rrQS3rgBLS-Czw5eJadByvYh1wvbENajI,8710
91
91
  reconcile/openshift_saas_deploy_change_tester.py,sha256=gdEke-uNKv1v8vuveThCn8_zEdP-BpiltS_OugqDFhg,9105
92
92
  reconcile/openshift_saas_deploy_trigger_base.py,sha256=WARMn3elQ8TN0Z-9NKQLQZMhtSN2JO6iD3pRaaa44GY,13343
93
93
  reconcile/openshift_saas_deploy_trigger_cleaner.py,sha256=fbSO48dnIMPV6XKPDoPD0pEFrhHYWfZcmvQfxAwQ-Ps,2728
@@ -95,7 +95,7 @@ reconcile/openshift_saas_deploy_trigger_configs.py,sha256=uWzUV5D5CW0frdi1ys7BOb
95
95
  reconcile/openshift_saas_deploy_trigger_images.py,sha256=Yl4lMtxqab-c04I2Ju8isAJuYuNTbHN01Bk3dF9nTos,967
96
96
  reconcile/openshift_saas_deploy_trigger_moving_commits.py,sha256=VqjwgRhA-yOSq0WFPqGIJVgYkdq_UrTHcVusBzOFgMY,973
97
97
  reconcile/openshift_saas_deploy_trigger_upstream_jobs.py,sha256=etfBGj7GDXTOhNHKc40ee5QM0Chq3oHE40HrbWgopc8,971
98
- reconcile/openshift_saas_deploy_wrapper.py,sha256=VhOYalFNOK0-szqU9W5f-kfwwobKf-8LMxoOgpiNbjk,1701
98
+ reconcile/openshift_saas_deploy_wrapper.py,sha256=worob8HdaQ31kndkQoWXqD-wK2jAIa4IR5um6KRsyf4,1854
99
99
  reconcile/openshift_serviceaccount_tokens.py,sha256=UlBRjfAxzf9-h4uxQwHqrYnBWMUGFqqfp6KvW2lM76k,6369
100
100
  reconcile/openshift_tekton_resources.py,sha256=nSJDPqL6Rl3jeUQKS6mFIqkWPdbXu_FNCeHER8w_GyY,13552
101
101
  reconcile/openshift_upgrade_watcher.py,sha256=4LtXziBS1tGfUiioGGzx6h7ZHXdGk97DSMLNblcGmHk,4843
@@ -482,8 +482,8 @@ tools/sre_checkpoints/util.py,sha256=zEDbGr18ZeHNQwW8pUsr2JRjuXIPz--WAGJxZo9sv_Y
482
482
  tools/test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
483
483
  tools/test/test_qontract_cli.py,sha256=awwTHEc2DWlykuqGIYM0WOBoSL0KRnOraCLk3C7izis,1401
484
484
  tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
485
- qontract_reconcile-0.9.1rc132.dist-info/METADATA,sha256=TLuvu9giLnYV33cluVk3hrGVytV6lAYuznjfmdrK69w,2259
486
- qontract_reconcile-0.9.1rc132.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
487
- qontract_reconcile-0.9.1rc132.dist-info/entry_points.txt,sha256=3BPvsRryM1C4S_mb5kXmP5AVv-wJBzVCrOJyv6qUmc0,195
488
- qontract_reconcile-0.9.1rc132.dist-info/top_level.txt,sha256=j0CHPIc8TsVRB50wOz_jhxjjaRyCJB3NOQeXhuHS67c,34
489
- qontract_reconcile-0.9.1rc132.dist-info/RECORD,,
485
+ qontract_reconcile-0.9.1rc133.dist-info/METADATA,sha256=Y6ZjvDqi2URKKdxZeGYrSJwCyJ2Xv3yYZRFNRJHCR44,2259
486
+ qontract_reconcile-0.9.1rc133.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
487
+ qontract_reconcile-0.9.1rc133.dist-info/entry_points.txt,sha256=3BPvsRryM1C4S_mb5kXmP5AVv-wJBzVCrOJyv6qUmc0,195
488
+ qontract_reconcile-0.9.1rc133.dist-info/top_level.txt,sha256=j0CHPIc8TsVRB50wOz_jhxjjaRyCJB3NOQeXhuHS67c,34
489
+ qontract_reconcile-0.9.1rc133.dist-info/RECORD,,
reconcile/cli.py CHANGED
@@ -1044,12 +1044,12 @@ def openshift_saas_deploy(
1044
1044
  run_integration(
1045
1045
  reconcile.openshift_saas_deploy,
1046
1046
  ctx.obj,
1047
- thread_pool_size,
1048
- io_dir,
1049
- use_jump_host,
1050
- saas_file_name,
1051
- env_name,
1052
- gitlab_project_id,
1047
+ thread_pool_size=thread_pool_size,
1048
+ io_dir=io_dir,
1049
+ use_jump_host=use_jump_host,
1050
+ saas_file_name=saas_file_name,
1051
+ env_name=env_name,
1052
+ gitlab_project_id=gitlab_project_id,
1053
1053
  )
1054
1054
 
1055
1055
 
@@ -1,5 +1,10 @@
1
1
  import logging
2
2
  import sys
3
+ from collections.abc import Callable
4
+ from typing import (
5
+ Any,
6
+ Optional,
7
+ )
3
8
 
4
9
  import reconcile.jenkins_plugins as jenkins_base
5
10
  import reconcile.openshift_base as ob
@@ -16,12 +21,15 @@ from reconcile.utils.openshift_resource import ResourceInventory
16
21
  from reconcile.utils.saasherder import SaasHerder
17
22
  from reconcile.utils.secret_reader import SecretReader
18
23
  from reconcile.utils.semver_helper import make_semver
24
+ from reconcile.utils.slack_api import SlackApi
19
25
 
20
26
  QONTRACT_INTEGRATION = "openshift-saas-deploy"
21
27
  QONTRACT_INTEGRATION_VERSION = make_semver(0, 1, 0)
22
28
 
23
29
 
24
- def compose_console_url(saas_file, saas_file_name, env_name):
30
+ def compose_console_url(
31
+ saas_file: dict[str, Any], saas_file_name: str, env_name: str
32
+ ) -> str:
25
33
  pp = saas_file["pipelinesProvider"]
26
34
  pp_ns = pp["namespace"]
27
35
  pp_ns_name = pp_ns["name"]
@@ -46,7 +54,14 @@ def compose_console_url(saas_file, saas_file_name, env_name):
46
54
  )
47
55
 
48
56
 
49
- def slack_notify(saas_file_name, env_name, slack, ri, console_url, in_progress):
57
+ def slack_notify(
58
+ saas_file_name: str,
59
+ env_name: str,
60
+ slack: SlackApi,
61
+ ri: ResourceInventory,
62
+ console_url: str,
63
+ in_progress: bool,
64
+ ) -> None:
50
65
  success = not ri.has_error_registered()
51
66
  if in_progress:
52
67
  icon = ":yellow_jenkins_circle:"
@@ -67,15 +82,15 @@ def slack_notify(saas_file_name, env_name, slack, ri, console_url, in_progress):
67
82
 
68
83
  @defer
69
84
  def run(
70
- dry_run,
71
- thread_pool_size=10,
72
- io_dir="throughput/",
73
- use_jump_host=True,
74
- saas_file_name=None,
75
- env_name=None,
76
- gitlab_project_id=None,
77
- defer=None,
78
- ):
85
+ dry_run: bool,
86
+ thread_pool_size: int = 10,
87
+ io_dir: str = "throughput/",
88
+ use_jump_host: bool = True,
89
+ saas_file_name: Optional[str] = None,
90
+ env_name: Optional[str] = None,
91
+ gitlab_project_id: Optional[str] = None,
92
+ defer: Optional[Callable] = None,
93
+ ) -> None:
79
94
  all_saas_files = queries.get_saas_files()
80
95
  saas_files = queries.get_saas_files(saas_file_name, env_name)
81
96
  if not saas_files:
@@ -91,6 +106,11 @@ def run(
91
106
  saas_file = saas_files[0]
92
107
  slack_info = saas_file.get("slack")
93
108
  if slack_info:
109
+ if not saas_file_name or not env_name:
110
+ raise RuntimeError(
111
+ "saas_file_name and env_name must be provided "
112
+ + "when using slack notifications"
113
+ )
94
114
  slack = slackapi_from_slack_workspace(
95
115
  slack_info,
96
116
  SecretReader(queries.get_secret_reader_settings()),
@@ -99,17 +119,20 @@ def run(
99
119
  )
100
120
  ri = ResourceInventory()
101
121
  console_url = compose_console_url(saas_file, saas_file_name, env_name)
102
- # deployment result notification
103
- defer(
104
- lambda: slack_notify(
105
- saas_file_name,
106
- env_name,
107
- slack,
108
- ri,
109
- console_url,
110
- in_progress=False,
122
+ if (
123
+ defer
124
+ ): # defer is provided by the method decorator. this makes just mypy happy
125
+ # deployment result notification
126
+ defer(
127
+ lambda: slack_notify(
128
+ saas_file_name,
129
+ env_name,
130
+ slack,
131
+ ri,
132
+ console_url,
133
+ in_progress=False,
134
+ )
111
135
  )
112
- )
113
136
  # deployment start notification
114
137
  slack_notifications = slack_info.get("notifications")
115
138
  if slack_notifications and slack_notifications.get("start"):
@@ -163,7 +186,8 @@ def run(
163
186
  cluster_admin=saasherder.cluster_admin,
164
187
  use_jump_host=use_jump_host,
165
188
  )
166
- defer(oc_map.cleanup)
189
+ if defer: # defer is provided by the method decorator. this makes just mypy happy
190
+ defer(oc_map.cleanup)
167
191
  saasherder.populate_desired_state(ri)
168
192
 
169
193
  # validate that this deployment is valid
@@ -1,4 +1,5 @@
1
1
  import sys
2
+ from typing import Optional
2
3
 
3
4
  from sretoolbox.utils import threaded
4
5
 
@@ -13,8 +14,12 @@ QONTRACT_INTEGRATION_VERSION = make_semver(0, 1, 0)
13
14
 
14
15
 
15
16
  def osd_run_wrapper(
16
- diff, dry_run, available_thread_pool_size, use_jump_host, gitlab_project_id
17
- ):
17
+ diff: dict[str, str],
18
+ dry_run: bool,
19
+ available_thread_pool_size: int,
20
+ use_jump_host: bool,
21
+ gitlab_project_id: Optional[str],
22
+ ) -> int:
18
23
  saas_file_name = diff["saas_file_name"]
19
24
  env_name = diff["environment"]
20
25
  exit_code = 0
@@ -33,12 +38,12 @@ def osd_run_wrapper(
33
38
 
34
39
 
35
40
  def run(
36
- dry_run,
37
- thread_pool_size=10,
38
- io_dir="throughput/",
39
- use_jump_host=True,
40
- gitlab_project_id=None,
41
- ):
41
+ dry_run: bool,
42
+ thread_pool_size: int = 10,
43
+ io_dir: str = "throughput/",
44
+ use_jump_host: bool = True,
45
+ gitlab_project_id: Optional[str] = None,
46
+ ) -> None:
42
47
  saas_file_owners_diffs = read_saas_file_owners_diffs(io_dir)
43
48
  if len(saas_file_owners_diffs) == 0:
44
49
  return