qontract-reconcile 0.10.1rc1032__py3-none-any.whl → 0.10.1rc1034__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.10.1rc1032
3
+ Version: 0.10.1rc1034
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
@@ -186,9 +186,9 @@ reconcile/dynatrace_token_provider/metrics.py,sha256=xiKkl8fTEBQaXJelGCPNTZhHAWd
186
186
  reconcile/dynatrace_token_provider/model.py,sha256=gkpqo5rRRueBXnIMjp4EEHqBUBuU65TRI8zpdb8GJ0A,241
187
187
  reconcile/dynatrace_token_provider/ocm.py,sha256=iHMsgbsLs-dlrB9UXmWNDF7E4UDe49JOsLa9rnowKfo,4282
188
188
  reconcile/endpoints_discovery/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
189
- reconcile/endpoints_discovery/integration.py,sha256=lUx_S_mQNATuB3tqGbyaliHBb355PCuU5SaVAiD_tbQ,12354
189
+ reconcile/endpoints_discovery/integration.py,sha256=q01DJgCv1YiDY-VUWDfQ5kfGm67BUhP-YP7c0JQObj8,12333
190
190
  reconcile/endpoints_discovery/merge_request.py,sha256=_yLb4tnvoZMCko8rta2C_CvOInJa9pa3HzSmHNtjgGU,2978
191
- reconcile/endpoints_discovery/merge_request_manager.py,sha256=oY3lovy5DcUgHNEDzWrbOPabzZtaGMns6YLl5ipZJ0c,6346
191
+ reconcile/endpoints_discovery/merge_request_manager.py,sha256=wUMsumxv8RnWaRattax4HfoRlhtVzmgro3GiJJ1C4Vc,6392
192
192
  reconcile/external_resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
193
193
  reconcile/external_resources/aws.py,sha256=JvjKaABy2Pg8u8Lq82Acv4zMvpE3_qGKes7OG-zlHOM,2956
194
194
  reconcile/external_resources/factories.py,sha256=DXgaLxoO87zZ76VOpRpu2GeYGhsbfOnOx5mrzgo4Gf4,4767
@@ -636,6 +636,7 @@ reconcile/typed_queries/status_board.py,sha256=I4btoMpEHGfoeGJn74XVUhMfX3zVSc7FZ
636
636
  reconcile/typed_queries/tekton_pipeline_providers.py,sha256=LtoSnSRkuckYsXIU64L1Mf-o3iuUjaN-5O-ARzIROZA,515
637
637
  reconcile/typed_queries/terraform_namespaces.py,sha256=4H9WE90jN_BVYBAt1DxJITS4vkL-vykbXZIS1H4EKNM,413
638
638
  reconcile/typed_queries/unleash.py,sha256=7HDc4owF044xM9Thx4WsXV7DZgETxJjy4lbpwmqz1vU,282
639
+ reconcile/typed_queries/users.py,sha256=UXlaxeZAoNIugMEndfcjbkHYowUURE72aWcdmxfb3yk,377
639
640
  reconcile/typed_queries/vault.py,sha256=lkRsmobykorof3fcrIPLz-NgvAiSOWSOZc_jXBlnl1w,274
640
641
  reconcile/typed_queries/app_interface_metrics_exporter/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
641
642
  reconcile/typed_queries/app_interface_metrics_exporter/onboarding_status.py,sha256=X-N1WJGOL6OR9940P0_K4-YJzkL5Vg4favhYrBxXD9A,327
@@ -781,7 +782,7 @@ reconcile/utils/mr/labels.py,sha256=9QRTRjZAtq45zELd9SwavaraczMjwjn5no3RK1YxFTg,
781
782
  reconcile/utils/mr/notificator.py,sha256=cp80wFzu_ZzrJPye7L1pI0H6JRGb7hOGuNxJYUq4Yr8,2967
782
783
  reconcile/utils/mr/ocm_update_recommended_version.py,sha256=p_aVP0TGrlKk9WBwgQnYWqUDsED_Hg6G5Bqj0UvtRwA,1536
783
784
  reconcile/utils/mr/ocm_upgrade_scheduler_org_updates.py,sha256=ojnIjw-8vRnmCCxOGBOEgPZLH4nC1hcuef74LWw2Rpk,3004
784
- reconcile/utils/mr/promote_qontract.py,sha256=3o_Lpn3gQc8HP3kSJRB1d7TvaDoIAKWLap5bhagQRaM,5945
785
+ reconcile/utils/mr/promote_qontract.py,sha256=8cYAa2zW47ZsqqG8aQ8Akj31NQPc9ARN936_OY7t1pI,7016
785
786
  reconcile/utils/mr/user_maintenance.py,sha256=cHPBn8zrReWLHalyk-EFdkFJe9zjVjRoZhT4t2zZfGE,3956
786
787
  reconcile/utils/ocm/__init__.py,sha256=Y-bp8GomMpyCo0tFW6kJ78-ZG1UIupYRtBzbMWU0kwM,798
787
788
  reconcile/utils/ocm/addons.py,sha256=_LDdJ-gapM3s5exKlIUt-MlXZTAUoHezbYBU0QmvfWQ,7335
@@ -865,8 +866,8 @@ tools/test/test_qontract_cli.py,sha256=_D61RFGAN5x44CY1tYbouhlGXXABwYfxKSWSQx3Jr
865
866
  tools/test/test_saas_promotion_state.py,sha256=dy4kkSSAQ7bC0Xp2CociETGN-2aABEfL6FU5D9Jl00Y,6056
866
867
  tools/test/test_sd_app_sre_alert_report.py,sha256=v363r9zM7__0kR5K6mvJoGFcM9BvE33fWAayrqkpojA,2116
867
868
  tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
868
- qontract_reconcile-0.10.1rc1032.dist-info/METADATA,sha256=I3gB9OldN-KPBWLzk-Pfm86cPqXs09u0XjHY_sG27rw,2213
869
- qontract_reconcile-0.10.1rc1032.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
870
- qontract_reconcile-0.10.1rc1032.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
871
- qontract_reconcile-0.10.1rc1032.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
872
- qontract_reconcile-0.10.1rc1032.dist-info/RECORD,,
869
+ qontract_reconcile-0.10.1rc1034.dist-info/METADATA,sha256=anqoDtbYv3GY1A_r6U3WWPYnqGq4eYevjbRPaY7lTTc,2213
870
+ qontract_reconcile-0.10.1rc1034.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
871
+ qontract_reconcile-0.10.1rc1034.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
872
+ qontract_reconcile-0.10.1rc1034.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
873
+ qontract_reconcile-0.10.1rc1034.dist-info/RECORD,,
@@ -261,8 +261,7 @@ class EndpointsDiscoveryIntegration(
261
261
  ) -> ExtendedEarlyExitRunnerResult:
262
262
  """Reconcile the endpoints for all namespaces."""
263
263
  apps = self.get_apps(oc_map, endpoint_template, namespaces)
264
- if apps:
265
- merge_request_manager.create_merge_request(apps=apps)
264
+ merge_request_manager.create_merge_request(apps=apps)
266
265
  return ExtendedEarlyExitRunnerResult(payload={}, applied_count=len(apps))
267
266
 
268
267
  @defer
@@ -139,6 +139,9 @@ class MergeRequestManager(MergeRequestManagerBase[EPDInfo]):
139
139
  # same external resource.
140
140
  return None
141
141
 
142
+ if not apps:
143
+ return None
144
+
142
145
  endpoints_discovery_mr = EndpointsDiscoveryMR(
143
146
  title=self._renderer.render_title(),
144
147
  description=self._renderer.render_description(hash=apps_hash),
@@ -0,0 +1,11 @@
1
+ from collections.abc import Callable
2
+
3
+ from reconcile.gql_definitions.common.users import query
4
+ from reconcile.gql_definitions.fragments.user import User
5
+ from reconcile.utils import gql
6
+
7
+
8
+ def get_users(query_func: Callable | None = None) -> list[User]:
9
+ if not query_func:
10
+ query_func = gql.get_api().query
11
+ return query(query_func=gql.get_api().query).users or []
@@ -1,6 +1,9 @@
1
1
  from jsonpath_ng.ext import parser
2
2
  from ruamel.yaml.compat import StringIO
3
3
 
4
+ from reconcile import typed_queries
5
+ from reconcile.gql_definitions.fragments.user import User
6
+ from reconcile.typed_queries.users import get_users
4
7
  from reconcile.utils.gitlab_api import GitLabApi
5
8
  from reconcile.utils.mr.base import MergeRequestBase
6
9
  from reconcile.utils.ruamel import create_ruamel_instance
@@ -48,17 +51,43 @@ class PromoteQontractSchemas(MergeRequestBase):
48
51
  class PromoteQontractReconcileCommercial(MergeRequestBase):
49
52
  name = "promote_qontract_reconcile"
50
53
 
51
- def __init__(self, version: str, commit_sha: str):
54
+ def __init__(self, version: str, commit_sha: str, author_email: str | None = None):
52
55
  self.version = version
53
56
  self.commit_sha = commit_sha
57
+ self.author_email = author_email
54
58
 
55
59
  super().__init__()
56
60
 
57
61
  self.labels = []
58
62
 
63
+ def author(self, all_users: list[User] | None = None) -> str | None:
64
+ if not self.author_email:
65
+ return None
66
+ if not all_users:
67
+ return None
68
+
69
+ username = self.author_email.split("@")[0]
70
+ users = None
71
+ if self.author_email.endswith(typed_queries.smtp.settings().mail_address):
72
+ users = [u for u in all_users if username == u.org_username]
73
+ elif self.author_email.endswith("users.noreply.github.com"):
74
+ users = [u for u in all_users if username == u.github_username]
75
+
76
+ if users:
77
+ return users[0].org_username
78
+
79
+ return None
80
+
59
81
  @property
60
82
  def title(self) -> str:
61
- return f"[{self.name}] promote qontract-reconcile to version {self.version}"
83
+ author = self.author(all_users=get_users())
84
+ return f"[{self.name}] promote qontract-reconcile to version {self.version}" + (
85
+ f" by @{author}"
86
+ if author
87
+ else f" by {self.author_email}"
88
+ if self.author_email
89
+ else ""
90
+ )
62
91
 
63
92
  @property
64
93
  def description(self) -> str: