qontract-reconcile 0.10.2.dev242__py3-none-any.whl → 0.10.2.dev244__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.4
2
2
  Name: qontract-reconcile
3
- Version: 0.10.2.dev242
3
+ Version: 0.10.2.dev244
4
4
  Summary: Collection of tools to reconcile services with their desired state as defined in the app-interface DB.
5
5
  Project-URL: homepage, https://github.com/app-sre/qontract-reconcile
6
6
  Project-URL: repository, https://github.com/app-sre/qontract-reconcile
@@ -190,8 +190,6 @@ OpenShift templates can be found [here](/openshift/qontract-reconcile.yaml). In
190
190
  instances.
191
191
  jenkins-worker-fleets Manage Jenkins worker fleets via JCasC.
192
192
  jira-permissions-validator Validate permissions in Jira.
193
- jira-watcher Watch for changes in Jira boards and notify
194
- on Slack.
195
193
  ldap-groups Manages LDAP groups based on App-Interface
196
194
  roles.
197
195
  ldap-users Removes users which are not found in LDAP
@@ -7,8 +7,8 @@ reconcile/aws_iam_keys.py,sha256=mw_lvmWqpJkzYW8Za6lHfxEMkT-_DOzWiCPhJAmYPIQ,398
7
7
  reconcile/aws_iam_password_reset.py,sha256=O0JX2N5kNRKs3u2xzu4NNrI6p0ag5JWy3MTsvZmtleg,3173
8
8
  reconcile/aws_support_cases_sos.py,sha256=PDhilxQ4TBxVnxUPIUdTbKEaNUI0wzPiEsB91oHT2fY,3384
9
9
  reconcile/blackbox_exporter_endpoint_monitoring.py,sha256=O1wFp52EyF538c6txaWBs8eMtUIy19gyHZ6VzJ6QXS8,3512
10
- reconcile/checkpoint.py,sha256=_JhMxrye5BgkRMxWYuf7Upli6XayPINKSsuo3ynHTRc,5010
11
- reconcile/cli.py,sha256=7uAtN-LiukRmaoowvgyHvmfTDf4Ffw-eo1teD11IK2g,113302
10
+ reconcile/checkpoint.py,sha256=gjtS8g6KIyKFYlHMSZjAqDUOlVh83nh4go-9yNrhWZU,5016
11
+ reconcile/cli.py,sha256=kp-YLjPfnqwyJdXDfVPE0lmfaRWDO1_ocTlZDCuVUOI,113061
12
12
  reconcile/closedbox_endpoint_monitoring_base.py,sha256=al7m8EgnnYx90rY1REryW3byN_ItfJfAzEeLtjbCfi0,4921
13
13
  reconcile/cluster_deployment_mapper.py,sha256=5gumAaRCcFXsabUJ1dnuUy9WrP_FEEM5JnOnE8ch9sE,2326
14
14
  reconcile/dashdotdb_base.py,sha256=83ZWIf5JJk3P_D69y2TmXRcQr6ELJGlv10OM0h7fJVs,4767
@@ -44,7 +44,6 @@ reconcile/jenkins_webhooks.py,sha256=KANd1ExYw6jp6F-d-QEbX1L1CNbRF270yL2ppDCAjio
44
44
  reconcile/jenkins_webhooks_cleaner.py,sha256=tFbAzsFGvJ6UrHRZFdIuLdqG-Ocd5_OknfsbtN-eyFY,1619
45
45
  reconcile/jenkins_worker_fleets.py,sha256=L2wEXpd4xuEHrXGss4iH788nG8UlLSYduZe1EY2IVw4,5377
46
46
  reconcile/jira_permissions_validator.py,sha256=nVHZg7kNn04Q-ryNM20wthMrhXos28g3O9b0ahzxAKc,14690
47
- reconcile/jira_watcher.py,sha256=S3xbnyo-Xdn64eY_TyHv1TnuoS9_H4z6HwiLn6De6pc,4135
48
47
  reconcile/ldap_users.py,sha256=oP1CAxmgSi3zDJ3vKTPySjap6WmEX1U469FmFrov5l4,4599
49
48
  reconcile/mr_client_gateway.py,sha256=WhjMd-sIXDFCV8-rt8CEjurJ5OYB1pOD0K3o0tZRXQg,1885
50
49
  reconcile/ocm_additional_routers.py,sha256=KfcFDVbNoc6n5dHWjYdAf1_DiVqVG6Tw23WLKoV8cdg,3306
@@ -92,7 +91,7 @@ reconcile/quay_mirror.py,sha256=PBooiA0ShZpWYfO6oeKFqYYT6Syi7Q8JJD9kj0wRRLg,1403
92
91
  reconcile/quay_mirror_org.py,sha256=I-tEqRHLL6uFqbSi7qCfPuDNoae7EAI2U68NbDOhmv8,10809
93
92
  reconcile/quay_permissions.py,sha256=9KOutS1w4RFQqkvMSy54VtsKNx56-phzP6yI_rEW-B8,4244
94
93
  reconcile/quay_repos.py,sha256=cuEYG0HUe0ut5yvLdEwOF5-CmccpXQHRb_wDazvDrvQ,6895
95
- reconcile/queries.py,sha256=Jmndc6jIGW_VZnDJ8u68mKXKNLk_XpiogeHrin9AJkc,50883
94
+ reconcile/queries.py,sha256=4ljTNPmRwzJQz14RXHMH-GLW3uOTdoXMwvgJmnSJP7I,49924
96
95
  reconcile/query_validator.py,sha256=MSh5pKLBksws4AqfuvT8nrIGucIbqX-IOzYyPYTLO7k,1491
97
96
  reconcile/requests_sender.py,sha256=914iluuF4UVgG3VyxxtnHOu4yf6YKS2fIy6PViSsFTQ,3875
98
97
  reconcile/resource_scraper.py,sha256=znXCHrU7YwPfKuxGBiUrV7T1tYtn4vlz9qmZlfy6Flg,2307
@@ -139,7 +138,7 @@ reconcile/aus/version_gates/ocp_gate_handler.py,sha256=RW1ppDaCZXVegV9AzzqYXxDUu
139
138
  reconcile/aus/version_gates/sts_version_gate_handler.py,sha256=swwwz0YyvrEBf_InqrRRBCt2QzHYNvvq8jz9aYwElh4,3663
140
139
  reconcile/automated_actions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
141
140
  reconcile/automated_actions/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
142
- reconcile/automated_actions/config/integration.py,sha256=sHraZXmSg5diPr2T80qhqmm5flA-Wnz_dk15ZAK3dh0,12908
141
+ reconcile/automated_actions/config/integration.py,sha256=EbVJGyEAFf91dHiIlnwbetbqZ3Y7HJOez2Fnexzd550,13853
143
142
  reconcile/aws_account_manager/README.md,sha256=_XFM3GZNHUzv--e_navqJuaUWpjC6QrHfulreHynFf0,262
144
143
  reconcile/aws_account_manager/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
145
144
  reconcile/aws_account_manager/integration.py,sha256=XTamC824imAezzVoQhhwdMOawNcPCOghR_y7i_8bpJI,15343
@@ -217,7 +216,7 @@ reconcile/glitchtip_project_alerts/integration.py,sha256=d3PMy-mQSbSZdIGAVaZCA2U
217
216
  reconcile/glitchtip_project_dsn/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
218
217
  reconcile/glitchtip_project_dsn/integration.py,sha256=2iugub-kHYkHNK33n0v9_TeWonuxCPah_VkoTPvaajE,8077
219
218
  reconcile/gql_definitions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
220
- reconcile/gql_definitions/introspection.json,sha256=7uISKAEWpJ2RvF2BvOeIDXvKEL46DaKjG1lHMFft2V8,2338518
219
+ reconcile/gql_definitions/introspection.json,sha256=_PKgzpmgWQJ8HF4irKjyxjOTXdw4YRgytoZQWJfigao,2346322
221
220
  reconcile/gql_definitions/acs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
222
221
  reconcile/gql_definitions/acs/acs_instances.py,sha256=L91WW9LbhJbBSrECqShQpFtjoBOsmNIYLRpMbx1io5o,2181
223
222
  reconcile/gql_definitions/acs/acs_policies.py,sha256=Ygpfl2-VkYLSlJvHgp_dJBfb66K_Rwfdfpsa18w1v1s,4338
@@ -231,7 +230,7 @@ reconcile/gql_definitions/app_sre_tekton_access_revalidation/__init__.py,sha256=
231
230
  reconcile/gql_definitions/app_sre_tekton_access_revalidation/roles.py,sha256=8Y4NsS5T7tumDWxY5MuoV50MK2i-DsLYSpCRjb7KaLE,2353
232
231
  reconcile/gql_definitions/app_sre_tekton_access_revalidation/users.py,sha256=XdVxBxiyTR6Cy939EHNw__0k7iWrZWlhrgS5DakST0I,2504
233
232
  reconcile/gql_definitions/automated_actions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
234
- reconcile/gql_definitions/automated_actions/instance.py,sha256=s7u8DczbfpVVzzDO5sOHYNWdWoPXJmkP2gGF6MpwUbA,9946
233
+ reconcile/gql_definitions/automated_actions/instance.py,sha256=6UPBKXPSjBsTXGdRQMK1ZXuns5pMPgYBscO3LxU3Gow,12406
235
234
  reconcile/gql_definitions/aws_account_manager/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
236
235
  reconcile/gql_definitions/aws_account_manager/aws_accounts.py,sha256=vF51KrY2gwX0J9vESiaRMPQqdAMEtz9f_tBq52bInp0,5148
237
236
  reconcile/gql_definitions/aws_ami_cleanup/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -653,7 +652,7 @@ reconcile/utils/rhcsv2_certs.py,sha256=ZnlUlEI2k6UrljGarkm1ey0znMlQtjeZB7VEfCH1A
653
652
  reconcile/utils/ruamel.py,sha256=FzL4_L0FnMOUZmgThrZSMJs5MTdXwiy-E9MZWfk8bh8,397
654
653
  reconcile/utils/secret_reader.py,sha256=MaP56KZaAE35EyYbgAitdm6fUSxdzWeGFSOym9qiZkw,10206
655
654
  reconcile/utils/semver_helper.py,sha256=-WfPOMSA2v1h7hT3PwVf-Htg7wOsoKlQC1JdmDX2Ars,1268
656
- reconcile/utils/sharding.py,sha256=DDBHfs5TT9UgjmzewiXUjbncnrPuceAZWeOA4veGa7s,843
655
+ reconcile/utils/sharding.py,sha256=CNyU9mkSbt7FRANEhOOZpWJl7L-YliHhaxr898gmX8c,573
657
656
  reconcile/utils/slack_api.py,sha256=IcnXmQrKXQwYEhKfXTBmOeuYKxpSG2Wvc1Fq-Nf1Xgg,17551
658
657
  reconcile/utils/slo_document_manager.py,sha256=CPgM2oH4AVzBqenakWo59R5yfwB62tnxSnSOHgir7l8,9500
659
658
  reconcile/utils/smtp_client.py,sha256=0xefB4I9E5eBB-FlxFJYjvz3Kvuqi_K3Ma_Wk0NAQKM,2779
@@ -800,7 +799,7 @@ tools/saas_promotion_state/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJ
800
799
  tools/saas_promotion_state/saas_promotion_state.py,sha256=UfwwRLS5Ya4_Nh1w5n1dvoYtchQvYE9yj1VANt2IKqI,3925
801
800
  tools/sre_checkpoints/__init__.py,sha256=CDaDaywJnmRCLyl_NCcvxi-Zc0hTi_3OdwKiFOyS39I,145
802
801
  tools/sre_checkpoints/util.py,sha256=zEDbGr18ZeHNQwW8pUsr2JRjuXIPz--WAGJxZo9sv_Y,894
803
- qontract_reconcile-0.10.2.dev242.dist-info/METADATA,sha256=ZPBCbcD6RjER29qHo9IkVjoZLVn2F52-WKT2_OiCSWE,24289
804
- qontract_reconcile-0.10.2.dev242.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
805
- qontract_reconcile-0.10.2.dev242.dist-info/entry_points.txt,sha256=5i9l54La3vQrDLAdwDKQWC0iG4sV9RRfOb1BpvzOWLc,698
806
- qontract_reconcile-0.10.2.dev242.dist-info/RECORD,,
802
+ qontract_reconcile-0.10.2.dev244.dist-info/METADATA,sha256=vSTlPOJMBSSh7kEWJNZt5D815lP-mxDRAnqbAYkBwRs,24167
803
+ qontract_reconcile-0.10.2.dev244.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
804
+ qontract_reconcile-0.10.2.dev244.dist-info/entry_points.txt,sha256=5i9l54La3vQrDLAdwDKQWC0iG4sV9RRfOb1BpvzOWLc,698
805
+ qontract_reconcile-0.10.2.dev244.dist-info/RECORD,,
@@ -19,6 +19,7 @@ from reconcile.gql_definitions.automated_actions.instance import (
19
19
  AutomatedActionActionListV1,
20
20
  AutomatedActionExternalResourceFlushElastiCacheV1,
21
21
  AutomatedActionExternalResourceRdsRebootV1,
22
+ AutomatedActionExternalResourceRdsSnapshotV1,
22
23
  AutomatedActionOpenshiftWorkloadRestartArgumentV1,
23
24
  AutomatedActionOpenshiftWorkloadRestartV1,
24
25
  AutomatedActionsInstanceV1,
@@ -178,13 +179,30 @@ class AutomatedActionsConfigIntegration(
178
179
  "identifier": ec_arg.identifier,
179
180
  })
180
181
  case AutomatedActionExternalResourceRdsRebootV1():
181
- for rds_arg in action.external_resource_rds_reboot_arguments:
182
- for rds_er in rds_arg.namespace.external_resources or []:
183
- if not isinstance(rds_er.provisioner, AWSAccountV1):
182
+ for rds_reboot_arg in action.external_resource_rds_reboot_arguments:
183
+ for rds_reboot_er in (
184
+ rds_reboot_arg.namespace.external_resources or []
185
+ ):
186
+ if not isinstance(rds_reboot_er.provisioner, AWSAccountV1):
184
187
  continue
185
188
  parameters.append({
186
- "account": f"^{rds_er.provisioner.name}$",
187
- "identifier": rds_arg.identifier,
189
+ "account": f"^{rds_reboot_er.provisioner.name}$",
190
+ "identifier": rds_reboot_arg.identifier,
191
+ })
192
+ case AutomatedActionExternalResourceRdsSnapshotV1():
193
+ for (
194
+ rds_snapshot_arg
195
+ ) in action.external_resource_rds_snapshot_arguments:
196
+ for rds_snapshot_er in (
197
+ rds_snapshot_arg.namespace.external_resources or []
198
+ ):
199
+ if not isinstance(
200
+ rds_snapshot_er.provisioner, AWSAccountV1
201
+ ):
202
+ continue
203
+ parameters.append({
204
+ "account": f"^{rds_snapshot_er.provisioner.name}$",
205
+ "identifier": rds_snapshot_arg.identifier,
188
206
  })
189
207
  case AutomatedActionOpenshiftWorkloadRestartV1():
190
208
  parameters.extend(
reconcile/checkpoint.py CHANGED
@@ -133,7 +133,7 @@ def report_invalid_metadata(
133
133
  :param path: path in app-interface to said app
134
134
 
135
135
  :param board: JIRA board description, as per
136
- queries.JIRA_BOARDS_QUERY
136
+ queries.JIRA_BOARDS_QUICK_QUERY
137
137
 
138
138
  :param settings: app-interface settings (necessary to log into the
139
139
  JIRA instance)
reconcile/cli.py CHANGED
@@ -1146,14 +1146,6 @@ def jira_permissions_validator(
1146
1146
  )
1147
1147
 
1148
1148
 
1149
- @integration.command(short_help="Watch for changes in Jira boards and notify on Slack.")
1150
- @click.pass_context
1151
- def jira_watcher(ctx: click.Context) -> None:
1152
- import reconcile.jira_watcher
1153
-
1154
- run_integration(reconcile.jira_watcher, ctx)
1155
-
1156
-
1157
1149
  @integration.command(
1158
1150
  short_help="Watches for OpenShift upgrades and sends notifications."
1159
1151
  )
@@ -118,6 +118,20 @@ query AutomatedActionsInstances {
118
118
  identifier
119
119
  }
120
120
  }
121
+ ... on AutomatedActionExternalResourceRdsSnapshot_v1 {
122
+ external_resource_rds_snapshot_arguments: arguments {
123
+ namespace {
124
+ externalResources {
125
+ provisioner {
126
+ ... on AWSAccount_v1 {
127
+ name
128
+ }
129
+ }
130
+ }
131
+ }
132
+ identifier
133
+ }
134
+ }
121
135
  ... on AutomatedActionOpenshiftWorkloadRestart_v1 {
122
136
  openshift_workload_restart_arguments: arguments {
123
137
  namespace {
@@ -237,6 +251,31 @@ class AutomatedActionExternalResourceRdsRebootV1(AutomatedActionV1):
237
251
  external_resource_rds_reboot_arguments: list[AutomatedActionExternalResourceRdsRebootV1_AutomatedActionExternalResourceArgumentV1] = Field(..., alias="external_resource_rds_reboot_arguments")
238
252
 
239
253
 
254
+ class AutomatedActionExternalResourceRdsSnapshotV1_AutomatedActionExternalResourceArgumentV1_NamespaceV1_NamespaceExternalResourceV1_ExternalResourcesProvisionerV1(ConfiguredBaseModel):
255
+ ...
256
+
257
+
258
+ class AutomatedActionExternalResourceRdsSnapshotV1_AutomatedActionExternalResourceArgumentV1_NamespaceV1_NamespaceExternalResourceV1_ExternalResourcesProvisionerV1_AWSAccountV1(AutomatedActionExternalResourceRdsSnapshotV1_AutomatedActionExternalResourceArgumentV1_NamespaceV1_NamespaceExternalResourceV1_ExternalResourcesProvisionerV1):
259
+ name: str = Field(..., alias="name")
260
+
261
+
262
+ class AutomatedActionExternalResourceRdsSnapshotV1_AutomatedActionExternalResourceArgumentV1_NamespaceV1_NamespaceExternalResourceV1(ConfiguredBaseModel):
263
+ provisioner: Union[AutomatedActionExternalResourceRdsSnapshotV1_AutomatedActionExternalResourceArgumentV1_NamespaceV1_NamespaceExternalResourceV1_ExternalResourcesProvisionerV1_AWSAccountV1, AutomatedActionExternalResourceRdsSnapshotV1_AutomatedActionExternalResourceArgumentV1_NamespaceV1_NamespaceExternalResourceV1_ExternalResourcesProvisionerV1] = Field(..., alias="provisioner")
264
+
265
+
266
+ class AutomatedActionExternalResourceRdsSnapshotV1_AutomatedActionExternalResourceArgumentV1_NamespaceV1(ConfiguredBaseModel):
267
+ external_resources: Optional[list[AutomatedActionExternalResourceRdsSnapshotV1_AutomatedActionExternalResourceArgumentV1_NamespaceV1_NamespaceExternalResourceV1]] = Field(..., alias="externalResources")
268
+
269
+
270
+ class AutomatedActionExternalResourceRdsSnapshotV1_AutomatedActionExternalResourceArgumentV1(ConfiguredBaseModel):
271
+ namespace: AutomatedActionExternalResourceRdsSnapshotV1_AutomatedActionExternalResourceArgumentV1_NamespaceV1 = Field(..., alias="namespace")
272
+ identifier: str = Field(..., alias="identifier")
273
+
274
+
275
+ class AutomatedActionExternalResourceRdsSnapshotV1(AutomatedActionV1):
276
+ external_resource_rds_snapshot_arguments: list[AutomatedActionExternalResourceRdsSnapshotV1_AutomatedActionExternalResourceArgumentV1] = Field(..., alias="external_resource_rds_snapshot_arguments")
277
+
278
+
240
279
  class DisableClusterAutomationsV1(ConfiguredBaseModel):
241
280
  integrations: Optional[list[str]] = Field(..., alias="integrations")
242
281
 
@@ -265,7 +304,7 @@ class AutomatedActionOpenshiftWorkloadRestartV1(AutomatedActionV1):
265
304
  class AutomatedActionsInstanceV1(ConfiguredBaseModel):
266
305
  name: str = Field(..., alias="name")
267
306
  deployment: NamespaceV1 = Field(..., alias="deployment")
268
- actions: Optional[list[Union[AutomatedActionActionListV1, AutomatedActionExternalResourceFlushElastiCacheV1, AutomatedActionExternalResourceRdsRebootV1, AutomatedActionOpenshiftWorkloadRestartV1, AutomatedActionV1]]] = Field(..., alias="actions")
307
+ actions: Optional[list[Union[AutomatedActionActionListV1, AutomatedActionExternalResourceFlushElastiCacheV1, AutomatedActionExternalResourceRdsRebootV1, AutomatedActionExternalResourceRdsSnapshotV1, AutomatedActionOpenshiftWorkloadRestartV1, AutomatedActionV1]]] = Field(..., alias="actions")
269
308
 
270
309
 
271
310
  class AutomatedActionsInstancesQueryData(ConfiguredBaseModel):
@@ -5696,6 +5696,11 @@
5696
5696
  "name": "AutomatedActionExternalResourceRdsReboot_v1",
5697
5697
  "ofType": null
5698
5698
  },
5699
+ {
5700
+ "kind": "OBJECT",
5701
+ "name": "AutomatedActionExternalResourceRdsSnapshot_v1",
5702
+ "ofType": null
5703
+ },
5699
5704
  {
5700
5705
  "kind": "OBJECT",
5701
5706
  "name": "AutomatedActionNoOp_v1",
@@ -27286,6 +27291,11 @@
27286
27291
  "name": "AutomatedActionExternalResourceRdsReboot_v1",
27287
27292
  "ofType": null
27288
27293
  },
27294
+ {
27295
+ "kind": "OBJECT",
27296
+ "name": "AutomatedActionExternalResourceRdsSnapshot_v1",
27297
+ "ofType": null
27298
+ },
27289
27299
  {
27290
27300
  "kind": "OBJECT",
27291
27301
  "name": "AutomatedActionNoOp_v1",
@@ -53550,6 +53560,172 @@
53550
53560
  "enumValues": null,
53551
53561
  "possibleTypes": null
53552
53562
  },
53563
+ {
53564
+ "kind": "OBJECT",
53565
+ "name": "AutomatedActionExternalResourceRdsSnapshot_v1",
53566
+ "description": null,
53567
+ "fields": [
53568
+ {
53569
+ "name": "schema",
53570
+ "description": null,
53571
+ "args": [],
53572
+ "type": {
53573
+ "kind": "NON_NULL",
53574
+ "name": null,
53575
+ "ofType": {
53576
+ "kind": "SCALAR",
53577
+ "name": "String",
53578
+ "ofType": null
53579
+ }
53580
+ },
53581
+ "isDeprecated": false,
53582
+ "deprecationReason": null
53583
+ },
53584
+ {
53585
+ "name": "path",
53586
+ "description": null,
53587
+ "args": [],
53588
+ "type": {
53589
+ "kind": "NON_NULL",
53590
+ "name": null,
53591
+ "ofType": {
53592
+ "kind": "SCALAR",
53593
+ "name": "String",
53594
+ "ofType": null
53595
+ }
53596
+ },
53597
+ "isDeprecated": false,
53598
+ "deprecationReason": null
53599
+ },
53600
+ {
53601
+ "name": "type",
53602
+ "description": null,
53603
+ "args": [],
53604
+ "type": {
53605
+ "kind": "NON_NULL",
53606
+ "name": null,
53607
+ "ofType": {
53608
+ "kind": "SCALAR",
53609
+ "name": "String",
53610
+ "ofType": null
53611
+ }
53612
+ },
53613
+ "isDeprecated": false,
53614
+ "deprecationReason": null
53615
+ },
53616
+ {
53617
+ "name": "description",
53618
+ "description": null,
53619
+ "args": [],
53620
+ "type": {
53621
+ "kind": "SCALAR",
53622
+ "name": "String",
53623
+ "ofType": null
53624
+ },
53625
+ "isDeprecated": false,
53626
+ "deprecationReason": null
53627
+ },
53628
+ {
53629
+ "name": "maxOps",
53630
+ "description": null,
53631
+ "args": [],
53632
+ "type": {
53633
+ "kind": "NON_NULL",
53634
+ "name": null,
53635
+ "ofType": {
53636
+ "kind": "SCALAR",
53637
+ "name": "Int",
53638
+ "ofType": null
53639
+ }
53640
+ },
53641
+ "isDeprecated": false,
53642
+ "deprecationReason": null
53643
+ },
53644
+ {
53645
+ "name": "instances",
53646
+ "description": null,
53647
+ "args": [],
53648
+ "type": {
53649
+ "kind": "NON_NULL",
53650
+ "name": null,
53651
+ "ofType": {
53652
+ "kind": "LIST",
53653
+ "name": null,
53654
+ "ofType": {
53655
+ "kind": "NON_NULL",
53656
+ "name": null,
53657
+ "ofType": {
53658
+ "kind": "OBJECT",
53659
+ "name": "AutomatedActionsInstance_v1",
53660
+ "ofType": null
53661
+ }
53662
+ }
53663
+ }
53664
+ },
53665
+ "isDeprecated": false,
53666
+ "deprecationReason": null
53667
+ },
53668
+ {
53669
+ "name": "permissions",
53670
+ "description": null,
53671
+ "args": [],
53672
+ "type": {
53673
+ "kind": "LIST",
53674
+ "name": null,
53675
+ "ofType": {
53676
+ "kind": "NON_NULL",
53677
+ "name": null,
53678
+ "ofType": {
53679
+ "kind": "OBJECT",
53680
+ "name": "PermissionAutomatedActions_v1",
53681
+ "ofType": null
53682
+ }
53683
+ }
53684
+ },
53685
+ "isDeprecated": false,
53686
+ "deprecationReason": null
53687
+ },
53688
+ {
53689
+ "name": "arguments",
53690
+ "description": null,
53691
+ "args": [],
53692
+ "type": {
53693
+ "kind": "NON_NULL",
53694
+ "name": null,
53695
+ "ofType": {
53696
+ "kind": "LIST",
53697
+ "name": null,
53698
+ "ofType": {
53699
+ "kind": "NON_NULL",
53700
+ "name": null,
53701
+ "ofType": {
53702
+ "kind": "OBJECT",
53703
+ "name": "AutomatedActionExternalResourceArgument_v1",
53704
+ "ofType": null
53705
+ }
53706
+ }
53707
+ }
53708
+ },
53709
+ "isDeprecated": false,
53710
+ "deprecationReason": null
53711
+ }
53712
+ ],
53713
+ "inputFields": null,
53714
+ "interfaces": [
53715
+ {
53716
+ "kind": "INTERFACE",
53717
+ "name": "AutomatedAction_v1",
53718
+ "ofType": null
53719
+ },
53720
+ {
53721
+ "kind": "INTERFACE",
53722
+ "name": "DatafileObject_v1",
53723
+ "ofType": null
53724
+ }
53725
+ ],
53726
+ "enumValues": null,
53727
+ "possibleTypes": null
53728
+ },
53553
53729
  {
53554
53730
  "kind": "OBJECT",
53555
53731
  "name": "AutomatedActionNoOp_v1",
reconcile/queries.py CHANGED
@@ -2137,62 +2137,6 @@ def get_pipelines_providers():
2137
2137
  return pipelines_providers
2138
2138
 
2139
2139
 
2140
- JIRA_BOARDS_QUERY = """
2141
- {
2142
- jira_boards: jira_boards_v1 {
2143
- path
2144
- name
2145
- server {
2146
- serverUrl
2147
- token {
2148
- path
2149
- field
2150
- version
2151
- format
2152
- }
2153
- }
2154
- {% if with_slack %}
2155
- slack {
2156
- workspace {
2157
- name
2158
- integrations {
2159
- name
2160
- token {
2161
- path
2162
- field
2163
- version
2164
- format
2165
- }
2166
- channel
2167
- icon_emoji
2168
- username
2169
- }
2170
- api_client {
2171
- global {
2172
- max_retries
2173
- timeout
2174
- }
2175
- methods {
2176
- name
2177
- args
2178
- }
2179
- }
2180
- }
2181
- channel
2182
- }
2183
- {% endif %}
2184
- }
2185
- }
2186
- """
2187
-
2188
-
2189
- def get_jira_boards(with_slack: bool | None = True):
2190
- """Returns Jira boards resources defined in app-interface"""
2191
- gqlapi = gql.get_api()
2192
- query = Template(JIRA_BOARDS_QUERY).render(with_slack=with_slack)
2193
- return gqlapi.query(query)["jira_boards"]
2194
-
2195
-
2196
2140
  # Use APATH as the place holder because Python formatting interferes
2197
2141
  # with graphql use of curly braces
2198
2142
  JIRA_BOARDS_QUICK_QUERY = """
@@ -25,17 +25,3 @@ def is_in_shard(value):
25
25
  LOG.debug("IN_SHARD FALSE: %s", value)
26
26
 
27
27
  return in_shard
28
-
29
-
30
- def is_in_shard_round_robin(value, index):
31
- if SHARDS == 1:
32
- return True
33
-
34
- in_shard = index % SHARDS == SHARD_ID
35
-
36
- if in_shard:
37
- LOG.debug("IN_SHARD TRUE: %s", value)
38
- else:
39
- LOG.debug("IN_SHARD FALSE: %s", value)
40
-
41
- return in_shard
reconcile/jira_watcher.py DELETED
@@ -1,131 +0,0 @@
1
- import logging
2
- from collections.abc import Callable, Mapping, Sequence
3
- from typing import Any
4
-
5
- from reconcile import queries
6
- from reconcile.slack_base import slackapi_from_slack_workspace
7
- from reconcile.utils.defer import defer
8
- from reconcile.utils.jira_client import JiraClient
9
- from reconcile.utils.secret_reader import SecretReader
10
- from reconcile.utils.sharding import is_in_shard_round_robin
11
- from reconcile.utils.slack_api import SlackApi
12
- from reconcile.utils.state import (
13
- State,
14
- init_state,
15
- )
16
-
17
- QONTRACT_INTEGRATION = "jira-watcher"
18
-
19
-
20
- def fetch_current_state(
21
- jira_board: Mapping, settings: Mapping
22
- ) -> tuple[JiraClient, dict[str, dict[str, str]]]:
23
- jira = JiraClient(jira_board, settings=settings)
24
- issues = jira.get_issues(fields=["key", "status", "summary"])
25
- return jira, {
26
- issue.key: {"status": issue.fields.status.name, "summary": issue.fields.summary}
27
- for issue in issues
28
- }
29
-
30
-
31
- def fetch_previous_state(state: State, project: str) -> dict:
32
- return state.get(project, {})
33
-
34
-
35
- def format_message(
36
- server: str,
37
- key: str,
38
- data: Mapping,
39
- event: str,
40
- previous_state: Mapping | None = None,
41
- current_state: Mapping | None = None,
42
- ) -> str:
43
- summary = data["summary"]
44
- info = (
45
- ": {} -> {}".format(previous_state["status"], current_state["status"])
46
- if previous_state and current_state
47
- else ""
48
- )
49
- url = f"{server}/browse/{key}"
50
- return f"{url} ({summary}) {event}{info}"
51
-
52
-
53
- def calculate_diff(
54
- server: str, current_state: Mapping, previous_state: Mapping
55
- ) -> list[str]:
56
- messages = []
57
- new_issues = [
58
- format_message(server, key, data, "created")
59
- for key, data in current_state.items()
60
- if key not in previous_state
61
- ]
62
- messages.extend(new_issues)
63
-
64
- deleted_issues = [
65
- format_message(server, key, data, "deleted")
66
- for key, data in previous_state.items()
67
- if key not in current_state
68
- ]
69
- messages.extend(deleted_issues)
70
-
71
- updated_issues = [
72
- format_message(server, key, data, "status change", previous_state[key], data)
73
- for key, data in current_state.items()
74
- if key in previous_state and data["status"] != previous_state[key]["status"]
75
- ]
76
- messages.extend(updated_issues)
77
-
78
- return messages
79
-
80
-
81
- def init_slack(jira_board: Mapping[str, Any]) -> SlackApi:
82
- secret_reader = SecretReader(queries.get_secret_reader_settings())
83
- slack_info = jira_board["slack"]
84
-
85
- return slackapi_from_slack_workspace(
86
- slack_info,
87
- secret_reader,
88
- QONTRACT_INTEGRATION,
89
- channel=slack_info.get("channel"),
90
- init_usergroups=False,
91
- )
92
-
93
-
94
- def act(dry_run: bool, jira_board: Mapping[str, str], diffs: Sequence[str]) -> None:
95
- if not dry_run and diffs:
96
- slack = init_slack(jira_board)
97
-
98
- for diff in reversed(diffs):
99
- logging.info(diff)
100
- if not dry_run:
101
- slack.chat_post_message(diff)
102
-
103
-
104
- def write_state(state: State, project: str, state_to_write: Mapping) -> None:
105
- state.add(project, value=state_to_write, force=True)
106
-
107
-
108
- @defer
109
- def run(dry_run: bool, defer: Callable | None = None) -> None:
110
- jira_boards = [j for j in queries.get_jira_boards() if j.get("slack")]
111
- settings = queries.get_app_interface_settings()
112
- state = init_state(integration=QONTRACT_INTEGRATION)
113
- if defer:
114
- defer(state.cleanup)
115
- for index, jira_board in enumerate(jira_boards):
116
- if not is_in_shard_round_robin(jira_board["name"], index):
117
- continue
118
- jira, current_state = fetch_current_state(jira_board, settings)
119
- if not current_state:
120
- logging.warning(
121
- "not acting on empty Jira boards. "
122
- + "please create a ticket to get started."
123
- )
124
- continue
125
- previous_state = fetch_previous_state(state, jira.project)
126
- if previous_state:
127
- assert jira.server
128
- diffs = calculate_diff(jira.server, current_state, previous_state)
129
- act(dry_run, jira_board, diffs)
130
- if not dry_run:
131
- write_state(state, jira.project, current_state)