qontract-reconcile 0.10.1rc1071__py3-none-any.whl → 0.10.1rc1073__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.1rc1071
3
+ Version: 0.10.1rc1073
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
@@ -161,7 +161,7 @@ reconcile/aws_version_sync/merge_request_manager/merge_request_manager.py,sha256
161
161
  reconcile/change_owners/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
162
162
  reconcile/change_owners/approver.py,sha256=Z3_11vnK2WNOxjEEXVDh0224-_-qbt9d6mBeVE-7fsc,2259
163
163
  reconcile/change_owners/bundle.py,sha256=ZIlXRo6Z2raeWSCUqYsexBdol-q-r9kWJs5O_YPaEYk,5273
164
- reconcile/change_owners/change_log_tracking.py,sha256=XE-DbH3ktABaeEVdP6EoVsI6s3Nk21l6WKbHd3zMouM,5555
164
+ reconcile/change_owners/change_log_tracking.py,sha256=9A_fJoahIckRF_qepfKYEwZmedrcq8KTJh_KFt4DuRQ,6542
165
165
  reconcile/change_owners/change_owners.py,sha256=0HRJhDm0oW3uYJFgzynqA1gA0lbhalhSkmWOiQmr-NM,17062
166
166
  reconcile/change_owners/change_types.py,sha256=TjVtvmkU0s8w2NA6qvWQccB6PwlCrChFySlsHLYZjpE,32027
167
167
  reconcile/change_owners/changes.py,sha256=pa3cNAL-Xawh700ARJJQjY0p09NA1J2329RcE0F0MHM,17224
@@ -839,7 +839,7 @@ tools/app_interface_metrics_exporter.py,sha256=zkwkxdAUAxjdc-pzx2_oJXG25fo0Fnyd5
839
839
  tools/app_interface_reporter.py,sha256=oZPib4HPq0aZ2Zui1QGJGk6qQdfpeihujGDBnSdKyGE,17627
840
840
  tools/glitchtip_access_reporter.py,sha256=oPBnk_YoDuljU3v0FaChzOwwnk4vap1xEE67QEjzdqs,2948
841
841
  tools/glitchtip_access_revalidation.py,sha256=8kbBJk04mkq28kWoRDDkfCGIF3GRg3pJrFAh1sW0dbk,2821
842
- tools/qontract_cli.py,sha256=02oYg1l8ADkfGIH1QxkUvBs72Itu_LXM4gMu39GI3E4,130479
842
+ tools/qontract_cli.py,sha256=b-CcgDr-o91gRCxiKka3MrbP9Pb9FjW5VcdyxuPzg3k,130544
843
843
  tools/sd_app_sre_alert_report.py,sha256=e9vAdyenUz2f5c8-z-5WY0wv-SJ9aePKDH2r4IwB6pc,5063
844
844
  tools/template_validation.py,sha256=qpKYaTgk0GOPGa2Ct5_5sKdwIHtCAKIBGzsMPuJU5fw,3371
845
845
  tools/cli_commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -870,8 +870,8 @@ tools/test/test_qontract_cli.py,sha256=_D61RFGAN5x44CY1tYbouhlGXXABwYfxKSWSQx3Jr
870
870
  tools/test/test_saas_promotion_state.py,sha256=dy4kkSSAQ7bC0Xp2CociETGN-2aABEfL6FU5D9Jl00Y,6056
871
871
  tools/test/test_sd_app_sre_alert_report.py,sha256=v363r9zM7__0kR5K6mvJoGFcM9BvE33fWAayrqkpojA,2116
872
872
  tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
873
- qontract_reconcile-0.10.1rc1071.dist-info/METADATA,sha256=lkxennEtXd4pdqXqbrgp94jY5GLsnJV84np3cwcm5zs,2213
874
- qontract_reconcile-0.10.1rc1071.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
875
- qontract_reconcile-0.10.1rc1071.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
876
- qontract_reconcile-0.10.1rc1071.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
877
- qontract_reconcile-0.10.1rc1071.dist-info/RECORD,,
873
+ qontract_reconcile-0.10.1rc1073.dist-info/METADATA,sha256=-kqHT-1qUat0a9_QgEuiARkSUDCNkc-JxeGfmvp3nDk,2213
874
+ qontract_reconcile-0.10.1rc1073.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
875
+ qontract_reconcile-0.10.1rc1073.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
876
+ qontract_reconcile-0.10.1rc1073.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
877
+ qontract_reconcile-0.10.1rc1073.dist-info/RECORD,,
@@ -1,4 +1,5 @@
1
1
  import logging
2
+ from collections import defaultdict
2
3
  from collections.abc import Callable
3
4
  from dataclasses import asdict, dataclass, field
4
5
 
@@ -13,8 +14,10 @@ from reconcile.change_owners.change_owners import (
13
14
  from reconcile.change_owners.change_types import ChangeTypeContext
14
15
  from reconcile.change_owners.changes import aggregate_file_moves, parse_bundle_changes
15
16
  from reconcile.typed_queries.apps import get_apps
17
+ from reconcile.typed_queries.external_resources import get_namespaces
16
18
  from reconcile.utils import gql
17
19
  from reconcile.utils.defer import defer
20
+ from reconcile.utils.gitlab_api import MRState
18
21
  from reconcile.utils.runtime.integration import (
19
22
  PydanticRunParams,
20
23
  QontractReconcileIntegration,
@@ -28,7 +31,7 @@ BUNDLE_DIFFS_OBJ = "bundle-diffs.json"
28
31
  @dataclass
29
32
  class ChangeLogItem:
30
33
  commit: str
31
- created_at: str
34
+ merged_at: str
32
35
  change_types: list[str] = field(default_factory=list)
33
36
  error: bool = False
34
37
  apps: list[str] = field(default_factory=list)
@@ -64,6 +67,12 @@ class ChangeLogIntegration(QontractReconcileIntegration[ChangeLogIntegrationPara
64
67
  ]
65
68
  apps = get_apps()
66
69
  app_name_by_path = {a.path: a.name for a in apps}
70
+ namespaces = get_namespaces()
71
+ app_names_by_cluster_name = defaultdict(set)
72
+ for ns in namespaces:
73
+ cluster = ns.cluster.name
74
+ app = ns.app.name
75
+ app_names_by_cluster_name[cluster].add(app)
67
76
 
68
77
  integration_state = init_state(
69
78
  integration=self.name,
@@ -101,9 +110,15 @@ class ChangeLogIntegration(QontractReconcileIntegration[ChangeLogIntegrationPara
101
110
 
102
111
  logging.info(f"Processing commit {commit}")
103
112
  gl_commit = gl.project.commits.get(commit)
113
+ merged_at = max(
114
+ mr["merged_at"]
115
+ for mr in gl_commit.merge_requests()
116
+ if mr["state"] == MRState.MERGED
117
+ and mr["target_branch"] == gl.project.default_branch
118
+ )
104
119
  change_log_item = ChangeLogItem(
105
120
  commit=commit,
106
- created_at=gl_commit.created_at,
121
+ merged_at=merged_at,
107
122
  )
108
123
  change_log.items.append(change_log_item)
109
124
  obj = diff_state.get(key, None)
@@ -127,6 +142,13 @@ class ChangeLogIntegration(QontractReconcileIntegration[ChangeLogIntegrationPara
127
142
  if (name := app_name_by_path.get(c["app"]["$ref"]))
128
143
  }
129
144
  change_log_item.apps.extend(changed_apps)
145
+ case "/openshift/cluster-1.yml":
146
+ changed_apps = {
147
+ name
148
+ for c in change_versions
149
+ for name in app_names_by_cluster_name.get(c["name"], [])
150
+ }
151
+ change_log_item.apps.extend(changed_apps)
130
152
 
131
153
  # TODO(maorfr): switch apps to set
132
154
  change_log_item.apps = list(set(change_log_item.apps))
@@ -146,7 +168,7 @@ class ChangeLogIntegration(QontractReconcileIntegration[ChangeLogIntegrationPara
146
168
  change_log_item.change_types.append(ctp.name)
147
169
 
148
170
  change_log.items = sorted(
149
- change_log.items, key=lambda i: i.created_at, reverse=True
171
+ change_log.items, key=lambda i: i.merged_at, reverse=True
150
172
  )
151
173
  if not dry_run:
152
174
  integration_state.add(BUNDLE_DIFFS_OBJ, asdict(change_log), force=True)
tools/qontract_cli.py CHANGED
@@ -2903,13 +2903,14 @@ def change_log_tracking(ctx):
2903
2903
  ]
2904
2904
  item = {
2905
2905
  "commit": f"[{commit}]({repo_url}/commit/{commit})",
2906
+ "merged_at": change_log_item.merged_at,
2906
2907
  "apps": ", ".join(change_log_item.apps),
2907
2908
  "changes": ", ".join(covered_change_types_descriptions),
2908
2909
  "error": change_log_item.error,
2909
2910
  }
2910
2911
  data.append(item)
2911
2912
 
2912
- columns = ["commit", "apps", "changes", "error"]
2913
+ columns = ["commit", "merged_at", "apps", "changes", "error"]
2913
2914
  print_output(ctx.obj["options"], data, columns)
2914
2915
 
2915
2916