qontract-reconcile 0.10.1rc1122__py3-none-any.whl → 0.10.1rc1124__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.1rc1122
3
+ Version: 0.10.1rc1124
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
@@ -30,7 +30,7 @@ reconcile/github_repo_permissions_validator.py,sha256=dcbXdUx6imjNchjp3pg9-z1i7l
30
30
  reconcile/github_users.py,sha256=nfTq78QRONIfDVj-5O3bD6psllJjzWFnog-EJ1WqFPU,3672
31
31
  reconcile/github_validator.py,sha256=cVTVxJIGR4a1Jz8wrdXEAb_CMpXUzvykVmUURX4cook,917
32
32
  reconcile/gitlab_fork_compliance.py,sha256=5joAIGOOLhHme1ipa7ZQeQkUOVe3dKbRO1wJtTwyNR4,4178
33
- reconcile/gitlab_housekeeping.py,sha256=YAzwk7tZDlw918PjokQksqYJQBUkjouhMpDxIwDdTY0,22208
33
+ reconcile/gitlab_housekeeping.py,sha256=D0DOqC-xuMBMct04_MI8Lq32OAi_QMvvGLOz_E-77Dw,22482
34
34
  reconcile/gitlab_labeler.py,sha256=4xJHmVX155fclrHqkR926sL1GH6RTN5XfZ8PnqNXbRA,4534
35
35
  reconcile/gitlab_members.py,sha256=PrJE9OhDRdGG_gHM_77nQojLb4B18jtUu8DxgLsRS88,8417
36
36
  reconcile/gitlab_mr_sqs_consumer.py,sha256=O46mdziPgGOndbU-0_UJKJVUaiEoVzJPEgKm4_UvYoI,2571
@@ -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=h30fU-JmLH5a-rCAovpzTeTkkkgZztsZ5A2raee0YuU,5355
164
- reconcile/change_owners/change_log_tracking.py,sha256=3cIS-evZbU1SGkFzKDa7y9GL6uvSBZ0xbTl_qiqp4ss,7937
164
+ reconcile/change_owners/change_log_tracking.py,sha256=kmGRDHwXmhR8nkhbWBXLEim7psEiDbgaviaO7aGQ0Dc,8673
165
165
  reconcile/change_owners/change_owners.py,sha256=0HRJhDm0oW3uYJFgzynqA1gA0lbhalhSkmWOiQmr-NM,17062
166
166
  reconcile/change_owners/change_types.py,sha256=HEsoBduhcczAXZHwT26mr5sVPxtf8J6tsvjSDDI1ceI,32077
167
167
  reconcile/change_owners/changes.py,sha256=YblT-JPFagctTphzd38SjVmj3k1YsgMzN48zGpnLYKM,18222
@@ -869,8 +869,8 @@ tools/test/test_qontract_cli.py,sha256=_D61RFGAN5x44CY1tYbouhlGXXABwYfxKSWSQx3Jr
869
869
  tools/test/test_saas_promotion_state.py,sha256=dy4kkSSAQ7bC0Xp2CociETGN-2aABEfL6FU5D9Jl00Y,6056
870
870
  tools/test/test_sd_app_sre_alert_report.py,sha256=v363r9zM7__0kR5K6mvJoGFcM9BvE33fWAayrqkpojA,2116
871
871
  tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
872
- qontract_reconcile-0.10.1rc1122.dist-info/METADATA,sha256=SJBDdVh53pJzF3BJNrVr8eAXEQhzEkgOpsSZy1kKv7g,2213
873
- qontract_reconcile-0.10.1rc1122.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
874
- qontract_reconcile-0.10.1rc1122.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
875
- qontract_reconcile-0.10.1rc1122.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
876
- qontract_reconcile-0.10.1rc1122.dist-info/RECORD,,
872
+ qontract_reconcile-0.10.1rc1124.dist-info/METADATA,sha256=U-g8D9p9PHLNvvdvnP8L0KXkA5inZmNFT8E-jEkRx-8,2213
873
+ qontract_reconcile-0.10.1rc1124.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
874
+ qontract_reconcile-0.10.1rc1124.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
875
+ qontract_reconcile-0.10.1rc1124.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
876
+ qontract_reconcile-0.10.1rc1124.dist-info/RECORD,,
@@ -46,6 +46,14 @@ class ChangeLogItem:
46
46
  class ChangeLog:
47
47
  items: list[ChangeLogItem] = field(default_factory=list)
48
48
 
49
+ @property
50
+ def apps(self) -> set[str]:
51
+ return {app for item in self.items for app in item.apps}
52
+
53
+ @property
54
+ def change_types(self) -> set[str]:
55
+ return {change_type for item in self.items for change_type in item.change_types}
56
+
49
57
 
50
58
  class ChangeLogIntegrationParams(PydanticRunParams):
51
59
  gitlab_project_id: str
@@ -160,14 +168,19 @@ class ChangeLogIntegration(QontractReconcileIntegration[ChangeLogIntegrationPara
160
168
  | "/dependencies/status-page-component-1.yml"
161
169
  | "/app-sre/app-changelog-1.yml"
162
170
  ):
163
- changed_apps = {
164
- name
165
- for c in change_versions
166
- if (app := c["app"])
167
- and (app_path := app.get("$ref") or app.get("path"))
168
- and (name := app_name_by_path.get(app_path))
169
- }
170
- change_log_item.apps.extend(changed_apps)
171
+ for c in change_versions:
172
+ c_app: dict[str, str] = c["app"]
173
+ app_path = c_app.get("$ref") or c_app.get("path")
174
+ if not app_path:
175
+ raise KeyError(
176
+ f"app path is expected. missing in query? app information: {c_app}"
177
+ )
178
+ app_name = app_name_by_path.get(app_path)
179
+ if not app_name:
180
+ raise KeyError(
181
+ f"app name is expected. missing in query? app information: {c_app}"
182
+ )
183
+ change_log_item.apps.append(app_name)
171
184
  case "/openshift/cluster-1.yml":
172
185
  changed_apps = {
173
186
  name
@@ -203,6 +216,9 @@ class ChangeLogIntegration(QontractReconcileIntegration[ChangeLogIntegrationPara
203
216
  )
204
217
  )
205
218
 
219
+ logging.info(f"apps: {change_log.apps}")
220
+ logging.info(f"change_types: {change_log.change_types}")
221
+
206
222
  change_log.items = sorted(
207
223
  change_log.items, key=lambda i: i.merged_at, reverse=True
208
224
  )
@@ -3,6 +3,7 @@ from collections.abc import (
3
3
  Iterable,
4
4
  Set,
5
5
  )
6
+ from contextlib import suppress
6
7
  from dataclasses import dataclass
7
8
  from datetime import (
8
9
  UTC,
@@ -562,9 +563,12 @@ def publish_access_token_expiration_metrics(gl: GitLabApi) -> None:
562
563
  if pat.active:
563
564
  expiration_date = datetime.strptime(pat.expires_at, EXPIRATION_DATE_FORMAT)
564
565
  days_until_expiration = expiration_date.date() - datetime.now(UTC).date()
565
- gitlab_token_expiration.labels(name=pat.name).set(
566
- days_until_expiration.days
567
- )
566
+ gitlab_token_expiration.labels(pat.name).set(days_until_expiration.days)
567
+ else:
568
+ with suppress(KeyError, ValueError):
569
+ # there's no publicly exposed method to determine if a label exists for a gauge
570
+ # which is why I wrapped the error like this
571
+ gitlab_token_expiration.remove(pat.name)
568
572
 
569
573
 
570
574
  def run(dry_run, wait_for_pipeline):