qontract-reconcile 0.10.1rc1033__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.1rc1033
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
@@ -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.1rc1033.dist-info/METADATA,sha256=UgXHDzIBXemPFdpTK2uj033p1---CqacT8xzomQxMxI,2213
869
- qontract_reconcile-0.10.1rc1033.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
870
- qontract_reconcile-0.10.1rc1033.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
871
- qontract_reconcile-0.10.1rc1033.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
872
- qontract_reconcile-0.10.1rc1033.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,,
@@ -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: