qontract-reconcile 0.9.1rc241__py3-none-any.whl → 0.9.1rc243__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.
- {qontract_reconcile-0.9.1rc241.dist-info → qontract_reconcile-0.9.1rc243.dist-info}/METADATA +1 -1
- {qontract_reconcile-0.9.1rc241.dist-info → qontract_reconcile-0.9.1rc243.dist-info}/RECORD +17 -20
- reconcile/gql_definitions/common/saas_files.py +1 -0
- reconcile/gql_definitions/common/saas_target_namespaces.py +1 -0
- reconcile/gql_definitions/fragments/saas_target_namespace.py +1 -0
- reconcile/saas_auto_promotions_manager/integration.py +2 -4
- reconcile/saas_auto_promotions_manager/utils/saas_files_inventory.py +3 -8
- reconcile/test/conftest.py +8 -0
- reconcile/test/saas_auto_promotions_manager/conftest.py +26 -7
- reconcile/test/saas_auto_promotions_manager/test_integration_test.py +2 -4
- reconcile/test/saas_auto_promotions_manager/utils/saas_files_inventory/test_multiple_publishers_for_single_channel.py +2 -4
- reconcile/test/saas_auto_promotions_manager/utils/saas_files_inventory/test_saas_files_with_auto_promote.py +2 -4
- reconcile/test/saas_auto_promotions_manager/utils/saas_files_inventory/test_saas_files_without_auto_promote.py +2 -4
- reconcile/utils/oc.py +23 -17
- reconcile/gql_definitions/saas_auto_promotions_manager/__init__.py +0 -0
- reconcile/gql_definitions/saas_auto_promotions_manager/saas_files_for_auto_promotion.py +0 -154
- reconcile/typed_queries/saas_files_for_auto_promotions.py +0 -19
- {qontract_reconcile-0.9.1rc241.dist-info → qontract_reconcile-0.9.1rc243.dist-info}/WHEEL +0 -0
- {qontract_reconcile-0.9.1rc241.dist-info → qontract_reconcile-0.9.1rc243.dist-info}/entry_points.txt +0 -0
- {qontract_reconcile-0.9.1rc241.dist-info → qontract_reconcile-0.9.1rc243.dist-info}/top_level.txt +0 -0
{qontract_reconcile-0.9.1rc241.dist-info → qontract_reconcile-0.9.1rc243.dist-info}/METADATA
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: qontract-reconcile
|
3
|
-
Version: 0.9.
|
3
|
+
Version: 0.9.1rc243
|
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
|
@@ -183,8 +183,8 @@ reconcile/gql_definitions/common/ocm_environments.py,sha256=yV4UVjdnNmqbR5trQCOA
|
|
183
183
|
reconcile/gql_definitions/common/pagerduty_instances.py,sha256=8NBHKRXg_OKG9NsJv6FOj8UVFcjkdJg-9E16ZqZIRPQ,2006
|
184
184
|
reconcile/gql_definitions/common/pgp_reencryption_settings.py,sha256=tS68-tBBd7BJYmfTjtdTlxpABF3f_z9eJdtaKnyZc0Q,2305
|
185
185
|
reconcile/gql_definitions/common/pipeline_providers.py,sha256=6GgiGxV4Y25VTlfmhunFO_isU0gHKfid4L0YH9AGf80,9398
|
186
|
-
reconcile/gql_definitions/common/saas_files.py,sha256=
|
187
|
-
reconcile/gql_definitions/common/saas_target_namespaces.py,sha256=
|
186
|
+
reconcile/gql_definitions/common/saas_files.py,sha256=Qwe2Wt_gkeEGnCt2w1VwQBNgbSWZiYc7oAya1YqDz44,14795
|
187
|
+
reconcile/gql_definitions/common/saas_target_namespaces.py,sha256=5DVpj16kzRWmWmG5DgaFdb6SGEwAFu27FlPmxTJcXWQ,2543
|
188
188
|
reconcile/gql_definitions/common/saasherder_settings.py,sha256=jxrFr03NmiwV3uegKCxQgB5iveC2IaGZIoguXoiNMgs,1797
|
189
189
|
reconcile/gql_definitions/common/smtp_client_settings.py,sha256=Pb8VgTGFqCh4_rI0BOHoXuicfdNyol1kIN8NLONHaxI,2252
|
190
190
|
reconcile/gql_definitions/common/users.py,sha256=C5EvC5gNBHqWuY4tvOG5oZUiFV4eognyu-KjBRsIkMM,1685
|
@@ -198,7 +198,7 @@ reconcile/gql_definitions/fragments/oc_connection_cluster.py,sha256=DoAYQLQXB-TY
|
|
198
198
|
reconcile/gql_definitions/fragments/ocm_environment.py,sha256=DOfBY4fb02UF5R3ZxtwHBTlxhPYOOBJaqGeENElX7oc,1037
|
199
199
|
reconcile/gql_definitions/fragments/resource_requirements.py,sha256=p7bMDzeIMr008A_4skrZjXAwVXA4PtO2rX93iGBYqvk,732
|
200
200
|
reconcile/gql_definitions/fragments/resource_values.py,sha256=DS3KqzgjT_wJ36SWPZ9HyNXOBNvbhhGnh06IMQmrFXQ,746
|
201
|
-
reconcile/gql_definitions/fragments/saas_target_namespace.py,sha256=
|
201
|
+
reconcile/gql_definitions/fragments/saas_target_namespace.py,sha256=Bnf_qQg3a6tt1GVTD89dWmTkxIe9GosJrLl-jW5JKeo,1559
|
202
202
|
reconcile/gql_definitions/fragments/upgrade_policy.py,sha256=73VyC3kbkZ_g3aXmhD016a0axoJxKlIJSGmcue1A2Ow,1077
|
203
203
|
reconcile/gql_definitions/fragments/user.py,sha256=6RVsHZVHjOrZKcH8rWGQG9V1OtPpACSZ3wNwca3H8pA,943
|
204
204
|
reconcile/gql_definitions/fragments/vault_secret.py,sha256=pXbTPa-ptuT1L5HF83pEGMxhjRVA_b_wfGHS4NoZEW8,837
|
@@ -222,8 +222,6 @@ reconcile/gql_definitions/openshift_groups/managed_groups.py,sha256=_Cr0z4BJlWF0
|
|
222
222
|
reconcile/gql_definitions/openshift_groups/managed_roles.py,sha256=Q9U2hRiAZiCBEHmT1ipHhS2z1Yn5VIXvpIxNJgNrw_Y,2607
|
223
223
|
reconcile/gql_definitions/quay_membership/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
224
224
|
reconcile/gql_definitions/quay_membership/quay_membership.py,sha256=npj_e5xcDfUt_3sPlhZvRElcT2srT2EkBhtwQebKqz8,2842
|
225
|
-
reconcile/gql_definitions/saas_auto_promotions_manager/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
226
|
-
reconcile/gql_definitions/saas_auto_promotions_manager/saas_files_for_auto_promotion.py,sha256=iHs93a7Mlz90LkXVEWlaqIp8OnJTjOUPFXSw7HTzBsw,4274
|
227
225
|
reconcile/gql_definitions/service_dependencies/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
228
226
|
reconcile/gql_definitions/service_dependencies/jenkins_instance_fragment.py,sha256=s2NzPeR0MABYKWp_t9PiAIgiNvVqxQRQvBkfGn1MZ9o,703
|
229
227
|
reconcile/gql_definitions/service_dependencies/service_dependencies.py,sha256=OUjr8-S06vOBmVtTYygbucIms5CwV505q6ZaU8jdWl0,5004
|
@@ -257,7 +255,7 @@ reconcile/jenkins/types.py,sha256=-WMs4TsCEcbJNF_n-615Fealk08boBYZcTzVUk3Wlns,26
|
|
257
255
|
reconcile/ocm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
258
256
|
reconcile/ocm/types.py,sha256=gCuVra66cIk2Wvoj8PQ-hvsZiozFDFXxUOilPdC0w-c,3138
|
259
257
|
reconcile/saas_auto_promotions_manager/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
260
|
-
reconcile/saas_auto_promotions_manager/integration.py,sha256=
|
258
|
+
reconcile/saas_auto_promotions_manager/integration.py,sha256=BHiTU_gCQ39OwjaQ9pWFLvDvgy14rVAutUOjAEqOsTE,6091
|
261
259
|
reconcile/saas_auto_promotions_manager/publisher.py,sha256=HHVuYyEeBSvjuwh0XB8VQaGV3TeQvW-4Mh6YNyrNbtM,1255
|
262
260
|
reconcile/saas_auto_promotions_manager/subscriber.py,sha256=iWT27JhhDMhQC8Qam5nnR0NKK8NhlT8guAsmLClhIw0,5754
|
263
261
|
reconcile/saas_auto_promotions_manager/merge_request_manager/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -266,7 +264,7 @@ reconcile/saas_auto_promotions_manager/merge_request_manager/merge_request_manag
|
|
266
264
|
reconcile/saas_auto_promotions_manager/merge_request_manager/renderer.py,sha256=z0zXicF7mVMJuCmUoRt0LqvGPw6jjtuwa4GSik86-hs,3659
|
267
265
|
reconcile/saas_auto_promotions_manager/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
268
266
|
reconcile/saas_auto_promotions_manager/utils/deployment_state.py,sha256=rJbYBD4Omq_ZLToSwKBuiE2B_TobTdvTm1pIUpqPuWQ,1349
|
269
|
-
reconcile/saas_auto_promotions_manager/utils/saas_files_inventory.py,sha256=
|
267
|
+
reconcile/saas_auto_promotions_manager/utils/saas_files_inventory.py,sha256=aQ-rVGjJfD0eAWFwU0ocOGTF5BHld-49yBwSmgKtUvg,8371
|
270
268
|
reconcile/saas_auto_promotions_manager/utils/vcs.py,sha256=mgD8_eHOK-yCETQBYW4BRttgYK_eeBEbj1O59KBO9GQ,5053
|
271
269
|
reconcile/skupper_network/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
272
270
|
reconcile/skupper_network/integration.py,sha256=jF5uPhePnWq4axnxxarEQ_tw71WBxYoTZZUoi9JrZ6M,9831
|
@@ -284,7 +282,7 @@ reconcile/templates/aws_access_key_email.j2,sha256=2MUr1ERmyISzKgHqsWYLd-1Wbl-pe
|
|
284
282
|
reconcile/templates/email.yml.j2,sha256=OZgczNRgXPj2gVYTgwQyHAQrMGu7xp-e4W1rX19GcrU,690
|
285
283
|
reconcile/templates/jira-checkpoint-missinginfo.j2,sha256=c_Vvg-lEENsB3tgxm9B6Y9igCUQhCnFDYh6xw-zcIbU,570
|
286
284
|
reconcile/test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
287
|
-
reconcile/test/conftest.py,sha256=
|
285
|
+
reconcile/test/conftest.py,sha256=QsvEVVuiVs_qIbwYI1A9mbcM8yY8pmya-hsdHblcJLU,5219
|
288
286
|
reconcile/test/fixtures.py,sha256=VhvLXH0AWXEyu3FgPp7bcSTPmDPfMEa2v-_9cd8dCmw,572
|
289
287
|
reconcile/test/test_aggregated_list.py,sha256=iiWitQuNYC58aimWaiBoE4NROHjr1NCgQ91MnHEG_Ro,6412
|
290
288
|
reconcile/test/test_amtool.py,sha256=vxRhGieeydMBOb9UI2ziMHjJa8puMeGNsUhGhy-yMnk,1032
|
@@ -390,8 +388,8 @@ reconcile/test/test_version_bump.py,sha256=q6-3Y1roriI6YWpFwaHOMN7emEP3yL33sh_0V
|
|
390
388
|
reconcile/test/test_vpc_peerings_validator.py,sha256=j4MlmIoGptMJsYNfJAChHRkilSxtqBEUJBQhL6Uqfmo,3710
|
391
389
|
reconcile/test/test_wrong_region.py,sha256=7KzL7OaICQ9Z3DW27zt_ykMN7_87owAFC-2CYjvGoyA,2138
|
392
390
|
reconcile/test/saas_auto_promotions_manager/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
393
|
-
reconcile/test/saas_auto_promotions_manager/conftest.py,sha256=
|
394
|
-
reconcile/test/saas_auto_promotions_manager/test_integration_test.py,sha256=
|
391
|
+
reconcile/test/saas_auto_promotions_manager/conftest.py,sha256=_tXaxYxn7PfX2N_wi0czF9uoetEmog8coyHsO_6mUcw,2481
|
392
|
+
reconcile/test/saas_auto_promotions_manager/test_integration_test.py,sha256=TkxVbWDQ5H8zj4cTWgq3EaCsiu7u7GvOCxt90X_r6CE,4603
|
395
393
|
reconcile/test/saas_auto_promotions_manager/merge_request_manager/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
396
394
|
reconcile/test/saas_auto_promotions_manager/merge_request_manager/merge_request_manager/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
397
395
|
reconcile/test/saas_auto_promotions_manager/merge_request_manager/merge_request_manager/conftest.py,sha256=Ogww6W3CbRq1BTHnNbWVKQ5BXJa2s5-lcYNdyoLKi1I,3101
|
@@ -415,9 +413,9 @@ reconcile/test/saas_auto_promotions_manager/utils/__init__.py,sha256=47DEQpj8HBS
|
|
415
413
|
reconcile/test/saas_auto_promotions_manager/utils/deployment_state/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
416
414
|
reconcile/test/saas_auto_promotions_manager/utils/deployment_state/test_deployment_state.py,sha256=bTMwr-d_VYls1iq1NRPyrKr1KRQ5iC84DP2uywaB9dU,1257
|
417
415
|
reconcile/test/saas_auto_promotions_manager/utils/saas_files_inventory/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
418
|
-
reconcile/test/saas_auto_promotions_manager/utils/saas_files_inventory/test_multiple_publishers_for_single_channel.py,sha256=
|
419
|
-
reconcile/test/saas_auto_promotions_manager/utils/saas_files_inventory/test_saas_files_with_auto_promote.py,sha256=
|
420
|
-
reconcile/test/saas_auto_promotions_manager/utils/saas_files_inventory/test_saas_files_without_auto_promote.py,sha256=
|
416
|
+
reconcile/test/saas_auto_promotions_manager/utils/saas_files_inventory/test_multiple_publishers_for_single_channel.py,sha256=A2bw4U2jcwpQpTd8nab2Pe7QeF-__2CEJp8kWocVHVc,2414
|
417
|
+
reconcile/test/saas_auto_promotions_manager/utils/saas_files_inventory/test_saas_files_with_auto_promote.py,sha256=bGT1dlFk2NGOvAa1U4t4eNpWvVUxLMIFI-8sp0W_4nk,2643
|
418
|
+
reconcile/test/saas_auto_promotions_manager/utils/saas_files_inventory/test_saas_files_without_auto_promote.py,sha256=6EYKmXDN9ckkMvdUBZlUiunCKuwQ9UmnPijKvXU8iZo,2170
|
421
419
|
reconcile/typed_queries/__init__.py,sha256=rRk4CyslLsBr4vAh1pIPgt6s3P4R1M9NSEPLnyQgBpk,61
|
422
420
|
reconcile/typed_queries/app_interface_vault_settings.py,sha256=N0GiRYDzlPipTOMM50ieR08BxsXaGAga6GxiIKjQDS8,1002
|
423
421
|
reconcile/typed_queries/clusters.py,sha256=mjEudUxMl0pqT0CIbDhgRONLQqfhTvDPS4SVyl0zIpM,393
|
@@ -431,7 +429,6 @@ reconcile/typed_queries/ocp_release_mirror.py,sha256=jwX29Tcdvov8oEDNkE4t1j-2Hz8
|
|
431
429
|
reconcile/typed_queries/pagerduty_instances.py,sha256=QCHqEAakiH6eSob0Pnnn3IBd8Ga0zpEp1Z6Qu3v2uH4,733
|
432
430
|
reconcile/typed_queries/repos.py,sha256=RKBsf7IDS6NsXTtXxJ9Ol9G3bxG9sr3vW9QQ2bahEHo,512
|
433
431
|
reconcile/typed_queries/saas_files.py,sha256=rdrmz6vxcnUfswaeD6f57Yax-Y1DOutGCc60BBUXJK0,10593
|
434
|
-
reconcile/typed_queries/saas_files_for_auto_promotions.py,sha256=HxGESxXPUfh7LNNcZs0oXo2PAGYTMN2T8q0miUTUvdc,649
|
435
432
|
reconcile/typed_queries/smtp.py,sha256=aSLglYa5bHKmlGwKkxq2RZqyMWuAf0a4S_mOuhDa084,542
|
436
433
|
reconcile/typed_queries/tekton_pipeline_providers.py,sha256=2mpHBdsNPQB94tw0H9aenGuqj8EEjYolQ03YEq1CpiY,546
|
437
434
|
reconcile/typed_queries/terraform_namespaces.py,sha256=71ARJ-GzkU9tBM0IfJTL3NF4349SJy-Mgs_DwAgUz_g,444
|
@@ -474,7 +471,7 @@ reconcile/utils/ldap_client.py,sha256=atreTLA1f7gnG54Ub3JWkToP9tCwAci-q17dqB5XSh
|
|
474
471
|
reconcile/utils/lean_terraform_client.py,sha256=no9MMgG6TsgjM3EypIhLQtRmPZl9eNnZ0k0llWSBn6Y,865
|
475
472
|
reconcile/utils/make.py,sha256=QaEwucrzbl8-VHS66Wfdjfo0ubmAcvt_hZGpiGsKU50,231
|
476
473
|
reconcile/utils/metrics.py,sha256=7DO12hEJ7sNOjrTNmA24l5wmAe4MT0WgY-Y2iPhBgXI,2015
|
477
|
-
reconcile/utils/oc.py,sha256
|
474
|
+
reconcile/utils/oc.py,sha256=SMjqezK6XQEWYgkXAEVGeNXdbEC1wAnzdAn439fK-L0,68610
|
478
475
|
reconcile/utils/oc_connection_parameters.py,sha256=jlEMObRAx0NuWQfEF7NXkLoY-Ewrr9egA7nUr_oUHyM,10011
|
479
476
|
reconcile/utils/oc_filters.py,sha256=RWn8pC5A7ZZT7C6WPq9bOw5KBNkiAb5puFSr_FpdAf8,1358
|
480
477
|
reconcile/utils/oc_map.py,sha256=2y8A2B7iSNG4dTxaF9OkKlbw0DYcUwjeF3uv-P0lTBM,9538
|
@@ -562,8 +559,8 @@ tools/sre_checkpoints/util.py,sha256=zEDbGr18ZeHNQwW8pUsr2JRjuXIPz--WAGJxZo9sv_Y
|
|
562
559
|
tools/test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
563
560
|
tools/test/test_qontract_cli.py,sha256=awwTHEc2DWlykuqGIYM0WOBoSL0KRnOraCLk3C7izis,1401
|
564
561
|
tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
|
565
|
-
qontract_reconcile-0.9.
|
566
|
-
qontract_reconcile-0.9.
|
567
|
-
qontract_reconcile-0.9.
|
568
|
-
qontract_reconcile-0.9.
|
569
|
-
qontract_reconcile-0.9.
|
562
|
+
qontract_reconcile-0.9.1rc243.dist-info/METADATA,sha256=qS1WgtZ7FKOBBRdze5SVZeHuFnArF6mR6uYKQDZa5vs,2287
|
563
|
+
qontract_reconcile-0.9.1rc243.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
|
564
|
+
qontract_reconcile-0.9.1rc243.dist-info/entry_points.txt,sha256=aIVvB7OTCxYu0QkONzBPfFEyg68Pr8KUVKEEm4ChDVc,333
|
565
|
+
qontract_reconcile-0.9.1rc243.dist-info/top_level.txt,sha256=j0CHPIc8TsVRB50wOz_jhxjjaRyCJB3NOQeXhuHS67c,34
|
566
|
+
qontract_reconcile-0.9.1rc243.dist-info/RECORD,,
|
@@ -48,6 +48,7 @@ class AppV1(ConfiguredBaseModel):
|
|
48
48
|
|
49
49
|
class SaasTargetNamespace(ConfiguredBaseModel):
|
50
50
|
name: str = Field(..., alias="name")
|
51
|
+
path: str = Field(..., alias="path")
|
51
52
|
environment: EnvironmentV1 = Field(..., alias="environment")
|
52
53
|
app: AppV1 = Field(..., alias="app")
|
53
54
|
cluster: OcConnectionCluster = Field(..., alias="cluster")
|
@@ -29,9 +29,7 @@ from reconcile.typed_queries.app_interface_vault_settings import (
|
|
29
29
|
)
|
30
30
|
from reconcile.typed_queries.github_orgs import get_github_orgs
|
31
31
|
from reconcile.typed_queries.gitlab_instances import get_gitlab_instances
|
32
|
-
from reconcile.typed_queries.
|
33
|
-
get_saas_files_for_auto_promotions,
|
34
|
-
)
|
32
|
+
from reconcile.typed_queries.saas_files import get_saas_files
|
35
33
|
from reconcile.utils.defer import defer
|
36
34
|
from reconcile.utils.secret_reader import create_secret_reader
|
37
35
|
from reconcile.utils.semver_helper import make_semver
|
@@ -138,7 +136,7 @@ def init_external_dependencies(
|
|
138
136
|
vcs=vcs,
|
139
137
|
renderer=Renderer(),
|
140
138
|
)
|
141
|
-
saas_files =
|
139
|
+
saas_files = get_saas_files()
|
142
140
|
saas_inventory = SaasFilesInventory(saas_files=saas_files)
|
143
141
|
deployment_state = DeploymentState(
|
144
142
|
state=init_state(integration=OPENSHIFT_SAAS_DEPLOY, secret_reader=secret_reader)
|
@@ -1,16 +1,14 @@
|
|
1
1
|
import logging
|
2
2
|
from collections.abc import Iterable
|
3
3
|
|
4
|
-
from reconcile.gql_definitions.
|
5
|
-
ParentSaasPromotionV1,
|
6
|
-
SaasFileV2,
|
7
|
-
)
|
4
|
+
from reconcile.gql_definitions.common.saas_files import ParentSaasPromotionV1
|
8
5
|
from reconcile.saas_auto_promotions_manager.publisher import Publisher
|
9
6
|
from reconcile.saas_auto_promotions_manager.subscriber import (
|
10
7
|
Channel,
|
11
8
|
ConfigHash,
|
12
9
|
Subscriber,
|
13
10
|
)
|
11
|
+
from reconcile.typed_queries.saas_files import SaasFile
|
14
12
|
|
15
13
|
|
16
14
|
class SaasFileInventoryError(Exception):
|
@@ -27,7 +25,7 @@ class SaasFilesInventory:
|
|
27
25
|
This basically spans a directed graph, with subscribers as the root.
|
28
26
|
"""
|
29
27
|
|
30
|
-
def __init__(self, saas_files: Iterable[
|
28
|
+
def __init__(self, saas_files: Iterable[SaasFile]):
|
31
29
|
self._saas_files = saas_files
|
32
30
|
self._channels_by_name: dict[str, Channel] = {}
|
33
31
|
self.subscribers: list[Subscriber] = []
|
@@ -94,9 +92,6 @@ class SaasFilesInventory:
|
|
94
92
|
continue
|
95
93
|
if not target.promotion.auto:
|
96
94
|
continue
|
97
|
-
if not target.namespace:
|
98
|
-
# this should never happen - it's just to make mypy happy
|
99
|
-
raise RuntimeError("target.namespace is None")
|
100
95
|
subscriber = Subscriber(
|
101
96
|
saas_name=saas_file.name,
|
102
97
|
template_name=resource_template.name,
|
reconcile/test/conftest.py
CHANGED
@@ -57,8 +57,16 @@ def data_default_none(
|
|
57
57
|
continue
|
58
58
|
|
59
59
|
if field.alias not in data:
|
60
|
+
# Settings defaults
|
60
61
|
if field.allow_none:
|
61
62
|
data[field.alias] = None
|
63
|
+
else:
|
64
|
+
if isinstance(field.type_, type) and issubclass(field.type_, str):
|
65
|
+
data[field.alias] = "I was too lazy to define a string here"
|
66
|
+
elif isinstance(field.type_, type) and issubclass(field.type_, int):
|
67
|
+
data[field.alias] = 42
|
68
|
+
elif isinstance(field.type_, type) and issubclass(field.type_, bool):
|
69
|
+
data[field.alias] = False
|
62
70
|
else:
|
63
71
|
if isinstance(field.type_, type) and issubclass(field.type_, BaseModel):
|
64
72
|
if isinstance(data[field.alias], dict):
|
@@ -2,6 +2,7 @@ from collections.abc import (
|
|
2
2
|
Callable,
|
3
3
|
Iterable,
|
4
4
|
Mapping,
|
5
|
+
MutableMapping,
|
5
6
|
)
|
6
7
|
from unittest.mock import (
|
7
8
|
MagicMock,
|
@@ -10,20 +11,38 @@ from unittest.mock import (
|
|
10
11
|
|
11
12
|
import pytest
|
12
13
|
|
13
|
-
from reconcile.gql_definitions.saas_auto_promotions_manager.saas_files_for_auto_promotion import (
|
14
|
-
SaasFileV2,
|
15
|
-
)
|
16
14
|
from reconcile.saas_auto_promotions_manager.utils.vcs import VCS
|
15
|
+
from reconcile.typed_queries.saas_files import SaasFile
|
17
16
|
from reconcile.utils.gitlab_api import GitLabApi
|
18
17
|
from reconcile.utils.state import State
|
19
18
|
|
20
19
|
|
21
20
|
@pytest.fixture
|
22
21
|
def saas_files_builder(
|
23
|
-
gql_class_factory: Callable[[type[
|
24
|
-
) -> Callable[[Iterable[
|
25
|
-
def builder(data: Iterable[
|
26
|
-
|
22
|
+
gql_class_factory: Callable[[type[SaasFile], Mapping], SaasFile]
|
23
|
+
) -> Callable[[Iterable[MutableMapping]], list[SaasFile]]:
|
24
|
+
def builder(data: Iterable[MutableMapping]) -> list[SaasFile]:
|
25
|
+
for d in data:
|
26
|
+
if "app" not in d:
|
27
|
+
d["app"] = {}
|
28
|
+
if "pipelinesProvider" not in d:
|
29
|
+
d["pipelinesProvider"] = {}
|
30
|
+
if "managedResourceTypes" not in d:
|
31
|
+
d["managedResourceTypes"] = []
|
32
|
+
if "imagePatterns" not in d:
|
33
|
+
d["imagePatterns"] = []
|
34
|
+
for rt in d.get("resourceTemplates", []):
|
35
|
+
for t in rt.get("targets", []):
|
36
|
+
ns = t["namespace"]
|
37
|
+
if "name" not in ns:
|
38
|
+
ns["name"] = "some_name"
|
39
|
+
if "environment" not in ns:
|
40
|
+
ns["environment"] = {}
|
41
|
+
if "app" not in ns:
|
42
|
+
ns["app"] = {}
|
43
|
+
if "cluster" not in ns:
|
44
|
+
ns["cluster"] = {}
|
45
|
+
return [gql_class_factory(SaasFile, d) for d in data]
|
27
46
|
|
28
47
|
return builder
|
29
48
|
|
@@ -5,9 +5,6 @@ from collections.abc import (
|
|
5
5
|
)
|
6
6
|
from unittest.mock import create_autospec
|
7
7
|
|
8
|
-
from reconcile.gql_definitions.saas_auto_promotions_manager.saas_files_for_auto_promotion import (
|
9
|
-
SaasFileV2,
|
10
|
-
)
|
11
8
|
from reconcile.saas_auto_promotions_manager.integration import SaasAutoPromotionsManager
|
12
9
|
from reconcile.saas_auto_promotions_manager.merge_request_manager.merge_request_manager import (
|
13
10
|
MergeRequestManager,
|
@@ -22,11 +19,12 @@ from reconcile.saas_auto_promotions_manager.utils.saas_files_inventory import (
|
|
22
19
|
SaasFilesInventory,
|
23
20
|
)
|
24
21
|
from reconcile.saas_auto_promotions_manager.utils.vcs import VCS
|
22
|
+
from reconcile.typed_queries.saas_files import SaasFile
|
25
23
|
from reconcile.utils.state import State
|
26
24
|
|
27
25
|
|
28
26
|
def test_integration_test(
|
29
|
-
saas_files_builder: Callable[[Iterable[Mapping]], list[
|
27
|
+
saas_files_builder: Callable[[Iterable[Mapping]], list[SaasFile]],
|
30
28
|
vcs_builder: Callable[..., VCS],
|
31
29
|
s3_state_builder: Callable[[Mapping], State],
|
32
30
|
):
|
@@ -4,16 +4,14 @@ from collections.abc import (
|
|
4
4
|
Mapping,
|
5
5
|
)
|
6
6
|
|
7
|
-
from reconcile.gql_definitions.saas_auto_promotions_manager.saas_files_for_auto_promotion import (
|
8
|
-
SaasFileV2,
|
9
|
-
)
|
10
7
|
from reconcile.saas_auto_promotions_manager.utils.saas_files_inventory import (
|
11
8
|
SaasFilesInventory,
|
12
9
|
)
|
10
|
+
from reconcile.typed_queries.saas_files import SaasFile
|
13
11
|
|
14
12
|
|
15
13
|
def test_multiple_publishers_for_single_channel(
|
16
|
-
saas_files_builder: Callable[[Iterable[Mapping]], list[
|
14
|
+
saas_files_builder: Callable[[Iterable[Mapping]], list[SaasFile]]
|
17
15
|
):
|
18
16
|
saas_files = saas_files_builder(
|
19
17
|
[
|
@@ -4,16 +4,14 @@ from collections.abc import (
|
|
4
4
|
Mapping,
|
5
5
|
)
|
6
6
|
|
7
|
-
from reconcile.gql_definitions.saas_auto_promotions_manager.saas_files_for_auto_promotion import (
|
8
|
-
SaasFileV2,
|
9
|
-
)
|
10
7
|
from reconcile.saas_auto_promotions_manager.utils.saas_files_inventory import (
|
11
8
|
SaasFilesInventory,
|
12
9
|
)
|
10
|
+
from reconcile.typed_queries.saas_files import SaasFile
|
13
11
|
|
14
12
|
|
15
13
|
def test_single_channel(
|
16
|
-
saas_files_builder: Callable[[Iterable[Mapping]], list[
|
14
|
+
saas_files_builder: Callable[[Iterable[Mapping]], list[SaasFile]]
|
17
15
|
):
|
18
16
|
saas_files = saas_files_builder(
|
19
17
|
[
|
@@ -4,16 +4,14 @@ from collections.abc import (
|
|
4
4
|
Mapping,
|
5
5
|
)
|
6
6
|
|
7
|
-
from reconcile.gql_definitions.saas_auto_promotions_manager.saas_files_for_auto_promotion import (
|
8
|
-
SaasFileV2,
|
9
|
-
)
|
10
7
|
from reconcile.saas_auto_promotions_manager.utils.saas_files_inventory import (
|
11
8
|
SaasFilesInventory,
|
12
9
|
)
|
10
|
+
from reconcile.typed_queries.saas_files import SaasFile
|
13
11
|
|
14
12
|
|
15
13
|
def test_saas_files_without_auto_promote(
|
16
|
-
saas_files_builder: Callable[[Iterable[Mapping]], list[
|
14
|
+
saas_files_builder: Callable[[Iterable[Mapping]], list[SaasFile]]
|
17
15
|
):
|
18
16
|
saas_files = saas_files_builder(
|
19
17
|
[
|
reconcile/utils/oc.py
CHANGED
@@ -711,27 +711,33 @@ class OCDeprecated: # pylint: disable=too-many-public-methods
|
|
711
711
|
cmd = ["sa", "-n", namespace, "get-token", name]
|
712
712
|
return self._run(cmd)
|
713
713
|
|
714
|
+
def _process_api_resources(self, results):
|
715
|
+
for line in results:
|
716
|
+
r = line.split()
|
717
|
+
kind = r[-1]
|
718
|
+
namespaced = r[-2].lower() == "true"
|
719
|
+
group_version = r[-3].split("/", 1)
|
720
|
+
# Core group (v1)
|
721
|
+
group = ""
|
722
|
+
api_version = group_version
|
723
|
+
if len(group_version) > 1:
|
724
|
+
# group/version
|
725
|
+
group = group_version[0]
|
726
|
+
api_version = group_version[1]
|
727
|
+
obj = OCDeprecatedApiResource(kind, group, api_version, namespaced)
|
728
|
+
d = self.api_resources.setdefault(kind, [])
|
729
|
+
d.append(obj)
|
730
|
+
|
714
731
|
def get_api_resources(self):
|
715
732
|
with self.api_resources_lock:
|
716
733
|
if not self.api_resources:
|
717
734
|
cmd = ["api-resources", "--no-headers"]
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
# Core group (v1)
|
725
|
-
group = ""
|
726
|
-
api_version = group_version
|
727
|
-
if len(group_version) > 1:
|
728
|
-
# group/version
|
729
|
-
group = group_version[0]
|
730
|
-
api_version = group_version[1]
|
731
|
-
obj = OCDeprecatedApiResource(kind, group, api_version, namespaced)
|
732
|
-
d = self.api_resources.setdefault(kind, [])
|
733
|
-
d.append(obj)
|
734
|
-
|
735
|
+
try:
|
736
|
+
results = self._run(cmd).decode("utf-8").split("\n")
|
737
|
+
self._process_api_resources(results)
|
738
|
+
except AttributeError:
|
739
|
+
results = self._run(cmd).split("\n")
|
740
|
+
self._process_api_resources(results)
|
735
741
|
return self.api_resources
|
736
742
|
|
737
743
|
def get_version(self):
|
File without changes
|
@@ -1,154 +0,0 @@
|
|
1
|
-
"""
|
2
|
-
Generated by qenerate plugin=pydantic_v1. DO NOT MODIFY MANUALLY!
|
3
|
-
"""
|
4
|
-
from collections.abc import Callable # noqa: F401 # pylint: disable=W0611
|
5
|
-
from datetime import datetime # noqa: F401 # pylint: disable=W0611
|
6
|
-
from enum import Enum # noqa: F401 # pylint: disable=W0611
|
7
|
-
from typing import ( # noqa: F401 # pylint: disable=W0611
|
8
|
-
Any,
|
9
|
-
Optional,
|
10
|
-
Union,
|
11
|
-
)
|
12
|
-
|
13
|
-
from pydantic import ( # noqa: F401 # pylint: disable=W0611
|
14
|
-
BaseModel,
|
15
|
-
Extra,
|
16
|
-
Field,
|
17
|
-
Json,
|
18
|
-
)
|
19
|
-
|
20
|
-
from reconcile.gql_definitions.fragments.vault_secret import VaultSecret
|
21
|
-
|
22
|
-
|
23
|
-
DEFINITION = """
|
24
|
-
fragment VaultSecret on VaultSecret_v1 {
|
25
|
-
path
|
26
|
-
field
|
27
|
-
version
|
28
|
-
format
|
29
|
-
}
|
30
|
-
|
31
|
-
query SaasFilesForAutoPromotion {
|
32
|
-
saas_files: saas_files_v2 {
|
33
|
-
path
|
34
|
-
name
|
35
|
-
authentication {
|
36
|
-
code {
|
37
|
-
... VaultSecret
|
38
|
-
}
|
39
|
-
}
|
40
|
-
resourceTemplates {
|
41
|
-
name
|
42
|
-
url
|
43
|
-
targets {
|
44
|
-
ref
|
45
|
-
path
|
46
|
-
namespace {
|
47
|
-
path
|
48
|
-
}
|
49
|
-
promotion {
|
50
|
-
auto
|
51
|
-
publish
|
52
|
-
subscribe
|
53
|
-
promotion_data {
|
54
|
-
channel
|
55
|
-
data {
|
56
|
-
type
|
57
|
-
... on ParentSaasPromotion_v1 {
|
58
|
-
parent_saas
|
59
|
-
target_config_hash
|
60
|
-
}
|
61
|
-
}
|
62
|
-
}
|
63
|
-
}
|
64
|
-
}
|
65
|
-
}
|
66
|
-
}
|
67
|
-
}
|
68
|
-
"""
|
69
|
-
|
70
|
-
|
71
|
-
class ConfiguredBaseModel(BaseModel):
|
72
|
-
class Config:
|
73
|
-
smart_union = True
|
74
|
-
extra = Extra.forbid
|
75
|
-
|
76
|
-
|
77
|
-
class SaasFileAuthenticationV1(ConfiguredBaseModel):
|
78
|
-
code: Optional[VaultSecret] = Field(..., alias="code")
|
79
|
-
|
80
|
-
|
81
|
-
class NamespaceV1(ConfiguredBaseModel):
|
82
|
-
path: str = Field(..., alias="path")
|
83
|
-
|
84
|
-
|
85
|
-
class PromotionChannelDataV1(ConfiguredBaseModel):
|
86
|
-
q_type: str = Field(..., alias="type")
|
87
|
-
|
88
|
-
|
89
|
-
class ParentSaasPromotionV1(PromotionChannelDataV1):
|
90
|
-
parent_saas: Optional[str] = Field(..., alias="parent_saas")
|
91
|
-
target_config_hash: Optional[str] = Field(..., alias="target_config_hash")
|
92
|
-
|
93
|
-
|
94
|
-
class PromotionDataV1(ConfiguredBaseModel):
|
95
|
-
channel: Optional[str] = Field(..., alias="channel")
|
96
|
-
data: Optional[list[Union[ParentSaasPromotionV1, PromotionChannelDataV1]]] = Field(
|
97
|
-
..., alias="data"
|
98
|
-
)
|
99
|
-
|
100
|
-
|
101
|
-
class SaasResourceTemplateTargetPromotionV1(ConfiguredBaseModel):
|
102
|
-
auto: Optional[bool] = Field(..., alias="auto")
|
103
|
-
publish: Optional[list[str]] = Field(..., alias="publish")
|
104
|
-
subscribe: Optional[list[str]] = Field(..., alias="subscribe")
|
105
|
-
promotion_data: Optional[list[PromotionDataV1]] = Field(..., alias="promotion_data")
|
106
|
-
|
107
|
-
|
108
|
-
class SaasResourceTemplateTargetV2(ConfiguredBaseModel):
|
109
|
-
ref: str = Field(..., alias="ref")
|
110
|
-
path: Optional[str] = Field(..., alias="path")
|
111
|
-
namespace: Optional[NamespaceV1] = Field(..., alias="namespace")
|
112
|
-
promotion: Optional[SaasResourceTemplateTargetPromotionV1] = Field(
|
113
|
-
..., alias="promotion"
|
114
|
-
)
|
115
|
-
|
116
|
-
|
117
|
-
class SaasResourceTemplateV2(ConfiguredBaseModel):
|
118
|
-
name: str = Field(..., alias="name")
|
119
|
-
url: str = Field(..., alias="url")
|
120
|
-
targets: list[SaasResourceTemplateTargetV2] = Field(..., alias="targets")
|
121
|
-
|
122
|
-
|
123
|
-
class SaasFileV2(ConfiguredBaseModel):
|
124
|
-
path: str = Field(..., alias="path")
|
125
|
-
name: str = Field(..., alias="name")
|
126
|
-
authentication: Optional[SaasFileAuthenticationV1] = Field(
|
127
|
-
..., alias="authentication"
|
128
|
-
)
|
129
|
-
resource_templates: list[SaasResourceTemplateV2] = Field(
|
130
|
-
..., alias="resourceTemplates"
|
131
|
-
)
|
132
|
-
|
133
|
-
|
134
|
-
class SaasFilesForAutoPromotionQueryData(ConfiguredBaseModel):
|
135
|
-
saas_files: Optional[list[SaasFileV2]] = Field(..., alias="saas_files")
|
136
|
-
|
137
|
-
|
138
|
-
def query(query_func: Callable, **kwargs: Any) -> SaasFilesForAutoPromotionQueryData:
|
139
|
-
"""
|
140
|
-
This is a convenience function which queries and parses the data into
|
141
|
-
concrete types. It should be compatible with most GQL clients.
|
142
|
-
You do not have to use it to consume the generated data classes.
|
143
|
-
Alternatively, you can also mime and alternate the behavior
|
144
|
-
of this function in the caller.
|
145
|
-
|
146
|
-
Parameters:
|
147
|
-
query_func (Callable): Function which queries your GQL Server
|
148
|
-
kwargs: optional arguments that will be passed to the query function
|
149
|
-
|
150
|
-
Returns:
|
151
|
-
SaasFilesForAutoPromotionQueryData: queried data parsed into generated classes
|
152
|
-
"""
|
153
|
-
raw_data: dict[Any, Any] = query_func(DEFINITION, **kwargs)
|
154
|
-
return SaasFilesForAutoPromotionQueryData(**raw_data)
|
@@ -1,19 +0,0 @@
|
|
1
|
-
from collections.abc import Callable
|
2
|
-
from typing import Optional
|
3
|
-
|
4
|
-
from reconcile.gql_definitions.saas_auto_promotions_manager.saas_files_for_auto_promotion import (
|
5
|
-
SaasFileV2,
|
6
|
-
)
|
7
|
-
from reconcile.gql_definitions.saas_auto_promotions_manager.saas_files_for_auto_promotion import (
|
8
|
-
query as query_saas_files_for_auto_promotions,
|
9
|
-
)
|
10
|
-
from reconcile.utils import gql
|
11
|
-
|
12
|
-
|
13
|
-
def get_saas_files_for_auto_promotions(
|
14
|
-
query_func: Optional[Callable] = None,
|
15
|
-
) -> list[SaasFileV2]:
|
16
|
-
if not query_func:
|
17
|
-
query_func = gql.get_api().query
|
18
|
-
data = query_saas_files_for_auto_promotions(query_func=query_func)
|
19
|
-
return list(data.saas_files or [])
|
File without changes
|
{qontract_reconcile-0.9.1rc241.dist-info → qontract_reconcile-0.9.1rc243.dist-info}/entry_points.txt
RENAMED
File without changes
|
{qontract_reconcile-0.9.1rc241.dist-info → qontract_reconcile-0.9.1rc243.dist-info}/top_level.txt
RENAMED
File without changes
|