qontract-reconcile 0.10.1rc1012__py3-none-any.whl → 0.10.1rc1014__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.1rc1012
3
+ Version: 0.10.1rc1014
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
@@ -765,7 +765,7 @@ reconcile/utils/membershipsources/resolver.py,sha256=meERrCZqeVJZR2lHdZEznaZDsCs
765
765
  reconcile/utils/merge_request_manager/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
766
766
  reconcile/utils/merge_request_manager/merge_request_manager.py,sha256=3EP6Yw_zB7nY0OkU8D_32nDqta1TITgtRI0cSmOlNQg,3332
767
767
  reconcile/utils/merge_request_manager/parser.py,sha256=5pGoz8Q6EuYXlUc1z-D0FahdRP2YLO8CpACoa9HcgtQ,2098
768
- reconcile/utils/mr/__init__.py,sha256=uvqxcp-uSlJExaH00XNCX9DSvA57jHTlPTg5dbZ_xvk,2487
768
+ reconcile/utils/mr/__init__.py,sha256=IvDRx0x33ROPZ66DDkg3FCt8pLpcaVRGWyCJvZQ1SPE,2578
769
769
  reconcile/utils/mr/app_interface_reporter.py,sha256=6Kpg93V9FvcOke9Jimkva359MQ-ZyBIkUpf8QIA6-to,1793
770
770
  reconcile/utils/mr/aws_access.py,sha256=w-UJutB_OfBJOvr-gsPzhtBPkDfKcNZZWGGuI9cN3HI,2605
771
771
  reconcile/utils/mr/base.py,sha256=TP6xaxznxsF_v2KcC_D3ut1cX_4KCcx4pjIC1-4eZUY,7307
@@ -775,7 +775,7 @@ reconcile/utils/mr/labels.py,sha256=9QRTRjZAtq45zELd9SwavaraczMjwjn5no3RK1YxFTg,
775
775
  reconcile/utils/mr/notificator.py,sha256=cp80wFzu_ZzrJPye7L1pI0H6JRGb7hOGuNxJYUq4Yr8,2967
776
776
  reconcile/utils/mr/ocm_update_recommended_version.py,sha256=p_aVP0TGrlKk9WBwgQnYWqUDsED_Hg6G5Bqj0UvtRwA,1536
777
777
  reconcile/utils/mr/ocm_upgrade_scheduler_org_updates.py,sha256=ojnIjw-8vRnmCCxOGBOEgPZLH4nC1hcuef74LWw2Rpk,3004
778
- reconcile/utils/mr/promote_qontract.py,sha256=AgA7AXizYvUoycLMZb1zaa4BCLi4stsokWfEH4B0eWY,1266
778
+ reconcile/utils/mr/promote_qontract.py,sha256=6WWCSOU9B7P1VY8z7PCFWCnHA0LM0RuOwkZPWsFR700,6095
779
779
  reconcile/utils/mr/user_maintenance.py,sha256=cHPBn8zrReWLHalyk-EFdkFJe9zjVjRoZhT4t2zZfGE,3956
780
780
  reconcile/utils/ocm/__init__.py,sha256=xv7CJp7K9LCQfa4gL_W0MMCOD1P4qOy8t5aZj1xXNUE,808
781
781
  reconcile/utils/ocm/addons.py,sha256=_LDdJ-gapM3s5exKlIUt-MlXZTAUoHezbYBU0QmvfWQ,7335
@@ -859,8 +859,8 @@ tools/test/test_qontract_cli.py,sha256=_D61RFGAN5x44CY1tYbouhlGXXABwYfxKSWSQx3Jr
859
859
  tools/test/test_saas_promotion_state.py,sha256=dy4kkSSAQ7bC0Xp2CociETGN-2aABEfL6FU5D9Jl00Y,6056
860
860
  tools/test/test_sd_app_sre_alert_report.py,sha256=v363r9zM7__0kR5K6mvJoGFcM9BvE33fWAayrqkpojA,2116
861
861
  tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
862
- qontract_reconcile-0.10.1rc1012.dist-info/METADATA,sha256=mF7VTRaqvqomAcDgHl1erECgIQ54KoxAT6lFU0Sv690,2263
863
- qontract_reconcile-0.10.1rc1012.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
864
- qontract_reconcile-0.10.1rc1012.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
865
- qontract_reconcile-0.10.1rc1012.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
866
- qontract_reconcile-0.10.1rc1012.dist-info/RECORD,,
862
+ qontract_reconcile-0.10.1rc1014.dist-info/METADATA,sha256=_oYiLMwp1_SSIsoW1g1574AcwpLZcBG_NwIFvcUG_XU,2263
863
+ qontract_reconcile-0.10.1rc1014.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
864
+ qontract_reconcile-0.10.1rc1014.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
865
+ qontract_reconcile-0.10.1rc1014.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
866
+ qontract_reconcile-0.10.1rc1014.dist-info/RECORD,,
@@ -12,7 +12,10 @@ from reconcile.utils.mr.ocm_update_recommended_version import (
12
12
  from reconcile.utils.mr.ocm_upgrade_scheduler_org_updates import (
13
13
  CreateOCMUpgradeSchedulerOrgUpdates,
14
14
  )
15
- from reconcile.utils.mr.promote_qontract import PromoteQontractSchemas
15
+ from reconcile.utils.mr.promote_qontract import (
16
+ PromoteQontractReconcileCommercial,
17
+ PromoteQontractSchemas,
18
+ )
16
19
  from reconcile.utils.mr.user_maintenance import (
17
20
  CreateDeleteUserAppInterface,
18
21
  CreateDeleteUserInfra,
@@ -31,6 +34,7 @@ __all__ = [
31
34
  "CreateDeleteUserAppInterface",
32
35
  "CreateDeleteUserInfra",
33
36
  "PromoteQontractSchemas",
37
+ "PromoteQontractReconcileCommercial",
34
38
  ]
35
39
 
36
40
 
@@ -1,5 +1,8 @@
1
+ from ruamel.yaml.compat import StringIO
2
+
1
3
  from reconcile.utils.gitlab_api import GitLabApi
2
4
  from reconcile.utils.mr.base import MergeRequestBase
5
+ from reconcile.utils.ruamel import create_ruamel_instance
3
6
 
4
7
 
5
8
  class PromoteQontractSchemas(MergeRequestBase):
@@ -39,3 +42,126 @@ class PromoteQontractSchemas(MergeRequestBase):
39
42
  commit_message=self.description,
40
43
  content=new_content,
41
44
  )
45
+
46
+
47
+ class PromoteQontractReconcileCommercial(MergeRequestBase):
48
+ name = "promote_qontract_reconcile"
49
+
50
+ def __init__(self, version: str, commit_sha: str):
51
+ self.version = version
52
+ self.commit_sha = commit_sha
53
+
54
+ super().__init__()
55
+
56
+ self.labels = []
57
+
58
+ @property
59
+ def title(self) -> str:
60
+ return f"[{self.name}] promote qontract-reconcile to version {self.version}"
61
+
62
+ @property
63
+ def description(self) -> str:
64
+ return f"promote qontract-reconcile to version {self.version}"
65
+
66
+ def process(self, gitlab_cli: GitLabApi) -> None:
67
+ yml = create_ruamel_instance()
68
+
69
+ # .env
70
+ path = ".env"
71
+ raw_file = gitlab_cli.project.files.get(
72
+ file_path=path, ref=gitlab_cli.main_branch
73
+ ).decode()
74
+ content = raw_file.decode("utf-8")
75
+ lines = content.splitlines()
76
+ for index, text in enumerate(lines):
77
+ if text.startswith("export RECONCILE_IMAGE_TAG="):
78
+ lines[index] = f"export RECONCILE_IMAGE_TAG={self.version}"
79
+ new_content = "\n".join(lines) + "\n"
80
+ gitlab_cli.update_file(
81
+ branch_name=self.branch,
82
+ file_path=path,
83
+ commit_message=self.description,
84
+ content=new_content,
85
+ )
86
+
87
+ # resources/jenkins/global/defaults.yaml
88
+ path = "resources/jenkins/global/defaults.yaml"
89
+ raw_file = gitlab_cli.project.files.get(
90
+ file_path=path, ref=gitlab_cli.main_branch
91
+ ).decode()
92
+ content = raw_file.decode("utf-8")
93
+ lines = content.splitlines()
94
+ for index, text in enumerate(lines):
95
+ if text.startswith(" qontract_reconcile_image_tag: "):
96
+ lines[index] = f" qontract_reconcile_image_tag: '{self.version}'"
97
+ new_content = "\n".join(lines) + "\n"
98
+ gitlab_cli.update_file(
99
+ branch_name=self.branch,
100
+ file_path=path,
101
+ commit_message=self.description,
102
+ content=new_content,
103
+ )
104
+
105
+ # data/services/app-interface/cicd/ci-ext/saas-qontract-dashboards.yaml
106
+ path = "data/services/app-interface/cicd/ci-ext/saas-qontract-dashboards.yaml"
107
+ raw_file = gitlab_cli.project.files.get(
108
+ file_path=path, ref=gitlab_cli.main_branch
109
+ ).decode()
110
+ content = yml.load(raw_file)
111
+ for rt in content["resourceTemplates"]:
112
+ if rt["url"] == "https://github.com/app-sre/qontract-reconcile":
113
+ for t in rt["targets"]:
114
+ if t["name"] == "app-sre-observability-production":
115
+ t["ref"] = self.commit_sha
116
+ new_content = "---\n"
117
+ with StringIO() as stream:
118
+ yml.dump(content, stream)
119
+ new_content += stream.getvalue() or ""
120
+ gitlab_cli.update_file(
121
+ branch_name=self.branch,
122
+ file_path=path,
123
+ commit_message=self.description,
124
+ content=new_content,
125
+ )
126
+
127
+ # data/services/app-interface/cicd/ci-int/saas-qontract-manager-int.yaml
128
+ path = "data/services/app-interface/cicd/ci-int/saas-qontract-manager-int.yaml"
129
+ raw_file = gitlab_cli.project.files.get(
130
+ file_path=path, ref=gitlab_cli.main_branch
131
+ ).decode()
132
+ content = yml.load(raw_file)
133
+ for rt in content["resourceTemplates"]:
134
+ if rt["url"] == "https://github.com/app-sre/qontract-reconcile":
135
+ for t in rt["targets"]:
136
+ if t["name"] == "app-interface-production":
137
+ t["ref"] = self.commit_sha
138
+ new_content = "---\n"
139
+ with StringIO() as stream:
140
+ yml.dump(content, stream)
141
+ new_content += stream.getvalue() or ""
142
+ gitlab_cli.update_file(
143
+ branch_name=self.branch,
144
+ file_path=path,
145
+ commit_message=self.description,
146
+ content=new_content,
147
+ )
148
+
149
+ # data/pipelines/tekton-provider-global-defaults.yaml
150
+ path = "data/pipelines/tekton-provider-global-defaults.yaml"
151
+ raw_file = gitlab_cli.project.files.get(
152
+ file_path=path, ref=gitlab_cli.main_branch
153
+ ).decode()
154
+ content = yml.load(raw_file)
155
+ for tt in content["taskTemplates"]:
156
+ if tt["name"] == "openshift-saas-deploy":
157
+ tt["variables"]["qontract_reconcile_image_tag"] = self.version
158
+ new_content = "---\n"
159
+ with StringIO() as stream:
160
+ yml.dump(content, stream)
161
+ new_content += stream.getvalue() or ""
162
+ gitlab_cli.update_file(
163
+ branch_name=self.branch,
164
+ file_path=path,
165
+ commit_message=self.description,
166
+ content=new_content,
167
+ )