dbt-platform-helper 13.1.2__py3-none-any.whl → 13.3.0__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.

Potentially problematic release.


This version of dbt-platform-helper might be problematic. Click here for more details.

Files changed (57) hide show
  1. dbt_platform_helper/commands/application.py +2 -4
  2. dbt_platform_helper/commands/codebase.py +11 -7
  3. dbt_platform_helper/commands/conduit.py +1 -3
  4. dbt_platform_helper/commands/config.py +12 -314
  5. dbt_platform_helper/commands/copilot.py +14 -8
  6. dbt_platform_helper/commands/database.py +17 -9
  7. dbt_platform_helper/commands/environment.py +5 -6
  8. dbt_platform_helper/commands/generate.py +2 -3
  9. dbt_platform_helper/commands/notify.py +1 -3
  10. dbt_platform_helper/commands/pipeline.py +1 -3
  11. dbt_platform_helper/commands/secrets.py +1 -3
  12. dbt_platform_helper/commands/version.py +2 -2
  13. dbt_platform_helper/domain/codebase.py +17 -9
  14. dbt_platform_helper/domain/config.py +345 -0
  15. dbt_platform_helper/domain/copilot.py +158 -157
  16. dbt_platform_helper/domain/maintenance_page.py +42 -15
  17. dbt_platform_helper/domain/pipelines.py +1 -1
  18. dbt_platform_helper/domain/terraform_environment.py +1 -1
  19. dbt_platform_helper/domain/versioning.py +161 -30
  20. dbt_platform_helper/providers/aws/__init__.py +0 -0
  21. dbt_platform_helper/providers/{aws.py → aws/exceptions.py} +10 -0
  22. dbt_platform_helper/providers/aws/interfaces.py +13 -0
  23. dbt_platform_helper/providers/aws/opensearch.py +23 -0
  24. dbt_platform_helper/providers/aws/redis.py +21 -0
  25. dbt_platform_helper/providers/aws/sso_auth.py +61 -0
  26. dbt_platform_helper/providers/cache.py +40 -4
  27. dbt_platform_helper/providers/config.py +2 -1
  28. dbt_platform_helper/providers/config_validator.py +28 -25
  29. dbt_platform_helper/providers/copilot.py +1 -1
  30. dbt_platform_helper/providers/io.py +5 -2
  31. dbt_platform_helper/providers/kms.py +22 -0
  32. dbt_platform_helper/providers/load_balancers.py +26 -15
  33. dbt_platform_helper/providers/parameter_store.py +47 -0
  34. dbt_platform_helper/providers/platform_config_schema.py +17 -0
  35. dbt_platform_helper/providers/semantic_version.py +18 -88
  36. dbt_platform_helper/providers/terraform_manifest.py +1 -0
  37. dbt_platform_helper/providers/version.py +102 -26
  38. dbt_platform_helper/providers/version_status.py +80 -0
  39. dbt_platform_helper/providers/yaml_file.py +0 -1
  40. dbt_platform_helper/utils/aws.py +24 -142
  41. dbt_platform_helper/utils/git.py +3 -1
  42. dbt_platform_helper/utils/tool_versioning.py +12 -0
  43. {dbt_platform_helper-13.1.2.dist-info → dbt_platform_helper-13.3.0.dist-info}/METADATA +2 -2
  44. {dbt_platform_helper-13.1.2.dist-info → dbt_platform_helper-13.3.0.dist-info}/RECORD +48 -47
  45. {dbt_platform_helper-13.1.2.dist-info → dbt_platform_helper-13.3.0.dist-info}/WHEEL +1 -1
  46. platform_helper.py +1 -1
  47. dbt_platform_helper/providers/opensearch.py +0 -36
  48. dbt_platform_helper/providers/platform_helper_versioning.py +0 -107
  49. dbt_platform_helper/providers/redis.py +0 -34
  50. dbt_platform_helper/templates/svc/manifest-backend.yml +0 -69
  51. dbt_platform_helper/templates/svc/manifest-public.yml +0 -109
  52. dbt_platform_helper/utils/cloudfoundry.py +0 -14
  53. dbt_platform_helper/utils/files.py +0 -59
  54. dbt_platform_helper/utils/manifests.py +0 -18
  55. dbt_platform_helper/utils/versioning.py +0 -91
  56. {dbt_platform_helper-13.1.2.dist-info → dbt_platform_helper-13.3.0.dist-info}/LICENSE +0 -0
  57. {dbt_platform_helper-13.1.2.dist-info → dbt_platform_helper-13.3.0.dist-info}/entry_points.txt +0 -0
@@ -4,21 +4,19 @@ import time
4
4
  import urllib.parse
5
5
  from configparser import ConfigParser
6
6
  from pathlib import Path
7
- from typing import Tuple
8
7
 
9
8
  import boto3
10
9
  import botocore
11
10
  import botocore.exceptions
12
11
  import click
13
- import yaml
14
12
  from boto3 import Session
13
+ from botocore.exceptions import ClientError
15
14
 
16
15
  from dbt_platform_helper.constants import REFRESH_TOKEN_MESSAGE
17
16
  from dbt_platform_helper.platform_exception import PlatformException
18
- from dbt_platform_helper.providers.aws import CopilotCodebaseNotFoundException
19
- from dbt_platform_helper.providers.aws import ImageNotFoundException
20
- from dbt_platform_helper.providers.aws import LogGroupNotFoundException
21
- from dbt_platform_helper.providers.aws import RepositoryNotFoundException
17
+ from dbt_platform_helper.providers.aws.exceptions import ImageNotFoundException
18
+ from dbt_platform_helper.providers.aws.exceptions import LogGroupNotFoundException
19
+ from dbt_platform_helper.providers.aws.exceptions import RepositoryNotFoundException
22
20
  from dbt_platform_helper.providers.validation import ValidationException
23
21
 
24
22
  SSM_BASE_PATH = "/copilot/{app}/{env}/secrets/"
@@ -203,15 +201,6 @@ def set_ssm_param(
203
201
  client.put_parameter(**parameter_args)
204
202
 
205
203
 
206
- def check_response(response):
207
- if response["ResponseMetadata"]["HTTPStatusCode"] != 200:
208
- click.secho(
209
- f"Unknown response error from AWS.\nStatus Code: {response['ResponseMetadata']['HTTPStatusCode']}",
210
- fg="red",
211
- )
212
- exit()
213
-
214
-
215
204
  def get_codestar_connection_arn(app_name):
216
205
  session = get_aws_session_or_abort()
217
206
  response = session.client("codestar-connections").list_connections()
@@ -229,114 +218,6 @@ def get_account_details(sts_client=None):
229
218
  return response["Account"], response["UserId"]
230
219
 
231
220
 
232
- def get_public_repository_arn(repository_uri):
233
- session = get_aws_session_or_abort()
234
- response = session.client("ecr-public", region_name="us-east-1").describe_repositories()
235
- repository = [
236
- repo for repo in response["repositories"] if repo["repositoryUri"] == repository_uri
237
- ]
238
-
239
- return repository[0]["repositoryArn"] if repository else None
240
-
241
-
242
- def get_load_balancer_domain_and_configuration(
243
- project_session: Session, app: str, env: str, svc: str
244
- ) -> Tuple[str, dict]:
245
- response = get_load_balancer_configuration(project_session, app, env, svc)
246
-
247
- # Find the domain name
248
- with open(f"./copilot/{svc}/manifest.yml", "r") as fd:
249
- conf = yaml.safe_load(fd)
250
- if "environments" in conf:
251
- if env in conf["environments"]:
252
- for domain in conf["environments"].items():
253
- if domain[0] == env:
254
- if (
255
- domain[1] is None
256
- or domain[1]["http"] is None
257
- or domain[1]["http"]["alias"] is None
258
- ):
259
- click.secho(
260
- f"No domains found, please check the ./copilot/{svc}/manifest.yml file",
261
- fg="red",
262
- )
263
- exit()
264
- domain_name = domain[1]["http"]["alias"]
265
- else:
266
- click.secho(
267
- f"Environment {env} not found, please check the ./copilot/{svc}/manifest.yml file",
268
- fg="red",
269
- )
270
- exit()
271
-
272
- return domain_name, response["LoadBalancers"][0]
273
-
274
-
275
- def get_load_balancer_configuration(
276
- project_session: Session, app: str, env: str, svc: str
277
- ) -> list[Session]:
278
- proj_client = project_session.client("ecs")
279
-
280
- response = proj_client.list_clusters()
281
- check_response(response)
282
- no_items = True
283
- for cluster_arn in response["clusterArns"]:
284
- cluster_name = cluster_arn.split("/")[1]
285
- if cluster_name.startswith(f"{app}-{env}-Cluster"):
286
- no_items = False
287
- break
288
-
289
- if no_items:
290
- click.echo(
291
- click.style("There are no clusters for environment ", fg="red")
292
- + click.style(f"{env} ", fg="white", bold=True)
293
- + click.style("of application ", fg="red")
294
- + click.style(f"{app} ", fg="white", bold=True)
295
- + click.style("in AWS account ", fg="red")
296
- + click.style(f"{project_session.profile_name}", fg="white", bold=True),
297
- )
298
- exit()
299
-
300
- response = proj_client.list_services(cluster=cluster_name)
301
- check_response(response)
302
- no_items = True
303
- for service_arn in response["serviceArns"]:
304
- fully_qualified_service_name = service_arn.split("/")[2]
305
- if fully_qualified_service_name.startswith(f"{app}-{env}-{svc}-Service"):
306
- no_items = False
307
- break
308
-
309
- if no_items:
310
- click.echo(
311
- click.style("There are no services called ", fg="red")
312
- + click.style(f"{svc} ", fg="white", bold=True)
313
- + click.style("for environment ", fg="red")
314
- + click.style(f"{env} ", fg="white", bold=True)
315
- + click.style("of application ", fg="red")
316
- + click.style(f"{app} ", fg="white", bold=True)
317
- + click.style("in AWS account ", fg="red")
318
- + click.style(f"{project_session.profile_name}", fg="white", bold=True),
319
- )
320
- exit()
321
-
322
- elb_client = project_session.client("elbv2")
323
-
324
- elb_arn = elb_client.describe_target_groups(
325
- TargetGroupArns=[
326
- proj_client.describe_services(
327
- cluster=cluster_name,
328
- services=[
329
- fully_qualified_service_name,
330
- ],
331
- )["services"][0]["loadBalancers"][0]["targetGroupArn"],
332
- ],
333
- )["TargetGroups"][0]["LoadBalancerArns"][0]
334
-
335
- response = elb_client.describe_load_balancers(LoadBalancerArns=[elb_arn])
336
- check_response(response)
337
- return response
338
-
339
-
340
221
  def get_postgres_connection_data_updated_with_master_secret(session, parameter_name, secret_arn):
341
222
  # Todo: This is pretty much the same as dbt_platform_helper.providers.secrets.Secrets.get_postgres_connection_data_updated_with_master_secret
342
223
  ssm_client = session.client("ssm")
@@ -387,25 +268,6 @@ def start_pipeline_and_return_execution_id(codepipeline_client, build_options):
387
268
  return response["pipelineExecutionId"]
388
269
 
389
270
 
390
- # Todo: This should probably be in the AWS Copilot provider
391
- def check_codebase_exists(session: Session, application, codebase: str):
392
- try:
393
- # Todo: Can this leverage dbt_platform_helper.providers.secrets.Secrets.get_connection_secret_arn?
394
- ssm_client = session.client("ssm")
395
- json.loads(
396
- ssm_client.get_parameter(
397
- Name=f"/copilot/applications/{application.name}/codebases/{codebase}"
398
- )["Parameter"]["Value"]
399
- )
400
- except (
401
- KeyError,
402
- ValueError,
403
- ssm_client.exceptions.ParameterNotFound,
404
- json.JSONDecodeError,
405
- ):
406
- raise CopilotCodebaseNotFoundException(codebase)
407
-
408
-
409
271
  def check_image_exists(session, application, codebase, commit):
410
272
  ecr_client = session.client("ecr")
411
273
  repository = f"{application.name}/{codebase}"
@@ -484,3 +346,23 @@ def wait_for_log_group_to_exist(log_client, log_group_name, attempts=30):
484
346
 
485
347
  if not log_group_exists:
486
348
  raise LogGroupNotFoundException(log_group_name)
349
+
350
+
351
+ def get_image_build_project(codebuild_client, application, codebase):
352
+ project_name = f"{application}-{codebase}-codebase-image-build"
353
+ response = codebuild_client.batch_get_projects(names=[project_name])
354
+
355
+ if bool(response.get("projects")):
356
+ return project_name
357
+ else:
358
+ return f"{application}-{codebase}-codebase-pipeline-image-build"
359
+
360
+
361
+ def get_manual_release_pipeline(codepipeline_client, application, codebase):
362
+ pipeline_name = f"{application}-{codebase}-manual-release"
363
+ try:
364
+ codepipeline_client.get_pipeline(name=pipeline_name)
365
+ return pipeline_name
366
+ except ClientError as e:
367
+ if e.response["Error"]["Code"] == "PipelineNotFoundException":
368
+ return f"{pipeline_name}-pipeline"
@@ -1,8 +1,10 @@
1
1
  import re
2
2
  import subprocess
3
3
 
4
+ from dbt_platform_helper.platform_exception import PlatformException
4
5
 
5
- class CommitNotFoundException(Exception):
6
+
7
+ class CommitNotFoundException(PlatformException):
6
8
  pass
7
9
 
8
10
 
@@ -0,0 +1,12 @@
1
+ from dbt_platform_helper.constants import DEFAULT_TERRAFORM_PLATFORM_MODULES_VERSION
2
+
3
+
4
+ def get_required_terraform_platform_modules_version(
5
+ cli_terraform_platform_modules_version, platform_config_terraform_modules_default_version
6
+ ):
7
+ version_preference_order = [
8
+ cli_terraform_platform_modules_version,
9
+ platform_config_terraform_modules_default_version,
10
+ DEFAULT_TERRAFORM_PLATFORM_MODULES_VERSION,
11
+ ]
12
+ return [version for version in version_preference_order if version][0]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: dbt-platform-helper
3
- Version: 13.1.2
3
+ Version: 13.3.0
4
4
  Summary: Set of tools to help transfer applications/services from GOV.UK PaaS to DBT PaaS augmenting AWS Copilot.
5
5
  License: MIT
6
6
  Author: Department for Business and Trade Platform Team
@@ -12,7 +12,7 @@ Classifier: Programming Language :: Python :: 3.10
12
12
  Classifier: Programming Language :: Python :: 3.11
13
13
  Classifier: Programming Language :: Python :: 3.12
14
14
  Classifier: Programming Language :: Python :: 3.13
15
- Requires-Dist: Jinja2 (==3.1.5)
15
+ Requires-Dist: Jinja2 (==3.1.6)
16
16
  Requires-Dist: PyYAML (==6.0.1)
17
17
  Requires-Dist: aiohttp (>=3.8.4,<4.0.0)
18
18
  Requires-Dist: boto3 (>=1.28.24,<2.0.0)
@@ -3,55 +3,61 @@ dbt_platform_helper/README.md,sha256=B0qN2_u_ASqqgkGDWY2iwNGZt_9tUgMb9XqtaTuzYjw
3
3
  dbt_platform_helper/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  dbt_platform_helper/addon-plans.yml,sha256=O46a_ODsGG9KXmQY_1XbSGqrpSaHSLDe-SdROzHx8Go,4545
5
5
  dbt_platform_helper/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
- dbt_platform_helper/commands/application.py,sha256=EVbFscw0VoJC_f2Fupm6k8JR_WPDJ9lzKrBSNzXre9A,10155
7
- dbt_platform_helper/commands/codebase.py,sha256=-2fh9sgWfGzQgzaKWqGK_Me326HTVM-wvpLyBc6YPu4,2383
8
- dbt_platform_helper/commands/conduit.py,sha256=Ymd0Vl1lRGoK5udrxgkOU4FbAsSACXBUyaeHLtAnhO8,2328
9
- dbt_platform_helper/commands/config.py,sha256=RKpln4mAgDGErG4CtWFrfsx8nAt7h50E-il1cpUZ-v0,11727
10
- dbt_platform_helper/commands/copilot.py,sha256=zkfMbAO8mMQF5UdlhrD0rC_KpITvpJLD3yQhxXwmIqc,1307
11
- dbt_platform_helper/commands/database.py,sha256=aG3zcMHL5PE96b7LSAu0FGCbgcycQej3AGRcd-bpXUo,4115
12
- dbt_platform_helper/commands/environment.py,sha256=oic1zorx0Muc49h3F3OaUp5soOnmjBjfG_WgVXauRCM,3920
13
- dbt_platform_helper/commands/generate.py,sha256=6fgEImHxrmY-8fusprjSouisqhZUrfttEjlnYMJG0eo,718
14
- dbt_platform_helper/commands/notify.py,sha256=nwbbNgvtEhPO63sTCRoZ22QI5u5cS6mTCaVgPpiVkNU,3892
15
- dbt_platform_helper/commands/pipeline.py,sha256=Lu6qXKDsq-5WIMrLeesppF8ePAWKH_V8xcvmOJ33c2Q,3011
16
- dbt_platform_helper/commands/secrets.py,sha256=5dcQI-zsA-e9vXIOBZ3m6cHGkwhx9Ka4zdPKOFcVVts,4002
17
- dbt_platform_helper/commands/version.py,sha256=eU403r418bHJRZa4PkVYt0BVV95wfQJgqICQlApABsY,1358
6
+ dbt_platform_helper/commands/application.py,sha256=OUQsahXXHSEKxmXAmK8fSy_bTLNwM_TdLuv6CvffRPk,10126
7
+ dbt_platform_helper/commands/codebase.py,sha256=lwkZ9PZ7Zp1jQ2NaZ5-10gOMy85rYsHBa1-w8fU52k8,2763
8
+ dbt_platform_helper/commands/conduit.py,sha256=v5geTJzRHkOnbFfOqmjO6b57HXhs4YxTo_zJgDEYB0A,2300
9
+ dbt_platform_helper/commands/config.py,sha256=7XRFgLHUg1n-k6DReEouVm9NzOm0zFtnBwDLyDLSBLw,1225
10
+ dbt_platform_helper/commands/copilot.py,sha256=L9UUuqD62q0aFrTTEUla3A1WJBz-vFBfVi6p455TTgQ,1458
11
+ dbt_platform_helper/commands/database.py,sha256=2RJZEzaSqcNtDG1M2mZw-nB6agAd3GNAJsg2pjFF7vc,4407
12
+ dbt_platform_helper/commands/environment.py,sha256=JTCkAVrlIOqgzdlT2y2pXp_9rQHc2In0sxhbQyj3jFw,3975
13
+ dbt_platform_helper/commands/generate.py,sha256=4M0ZiGN2w-bwgPMxeItFfT6vA7sOMjuceHEN7RAYkhc,735
14
+ dbt_platform_helper/commands/notify.py,sha256=MWVlNalASSq0WghE5LjMrM6C7cGv8QosbmU5iXuI2bo,3864
15
+ dbt_platform_helper/commands/pipeline.py,sha256=tw6pE429FVGj8JoAvDnrpkJzC-qi6JJch7PDz2cKBvM,2983
16
+ dbt_platform_helper/commands/secrets.py,sha256=ommqp__Vus_OaJAJYzUdC-08xpomx01deyT0NljsTNs,3974
17
+ dbt_platform_helper/commands/version.py,sha256=gRQkmcFTz90SbYhO1L-j727AuZ_gnjQfcnsNN7CzBs4,1376
18
18
  dbt_platform_helper/constants.py,sha256=DpHGG54lwjw3XGp2TKCEGNmzaz083lAWMGkEabujDrw,1050
19
19
  dbt_platform_helper/default-extensions.yml,sha256=SU1ZitskbuEBpvE7efc3s56eAUF11j70brhj_XrNMMo,493
20
20
  dbt_platform_helper/domain/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
21
- dbt_platform_helper/domain/codebase.py,sha256=XsNjXkpVnDikbcN-DN01gY7adg4W2PvfQzhPZJyIBEk,10294
21
+ dbt_platform_helper/domain/codebase.py,sha256=2rSVCwGsnbFZbs9JvAFwjq2yPKfTqCPiBegYLvmCgIQ,10914
22
22
  dbt_platform_helper/domain/conduit.py,sha256=5C5GnF5jssJ1rFFCY6qaKgvLjYUkyytRJE4tHlanYa0,4370
23
- dbt_platform_helper/domain/copilot.py,sha256=yoHAHwBY7tsARcMhMBbeiuQAlj3f2JfTKNvr1CRmVt0,14514
23
+ dbt_platform_helper/domain/config.py,sha256=au45EnEAjv0RZUEDJ_0IQnsRV7wM0hHi-ZJ6LOnavYc,13361
24
+ dbt_platform_helper/domain/copilot.py,sha256=9L4h-WFwgRU8AMjf14PlDqwLqOpIRinkuPvhe-8Uk3c,15034
24
25
  dbt_platform_helper/domain/copilot_environment.py,sha256=yPt6ZarOvFPo06XwY1sU5MOQsoV7TEsKSQHyM-G8aGc,9058
25
26
  dbt_platform_helper/domain/database_copy.py,sha256=CKvI9LsHyowg0bPT9jImk07w4TyQLPoInQoU2TUDiJQ,9485
26
- dbt_platform_helper/domain/maintenance_page.py,sha256=27-ylByLDO7pl3xHlCOLeknmT5rAWS5kWfm0BgPhKpQ,13145
27
- dbt_platform_helper/domain/pipelines.py,sha256=d5QF9iayFPEeqLuo6ztiGoAN_gLaMV91ps9JoGiAAUI,6498
28
- dbt_platform_helper/domain/terraform_environment.py,sha256=pyUWIxvMESbyp4yAq715JXKKHW133tr1vwxi2cMK5MI,1754
29
- dbt_platform_helper/domain/versioning.py,sha256=KuCQBrUFVCBUMiU7lGwtqPlBc9jk9sSgaI2OkjhrwlM,2705
27
+ dbt_platform_helper/domain/maintenance_page.py,sha256=h7uYlUi4rlaDV9DvdElb2yD4H6Nz7dHMx3RIQfjHFZw,14258
28
+ dbt_platform_helper/domain/pipelines.py,sha256=mUvGaNMtBAUemsb-fHDcpWV-9LfqGoSogI2LwDnvt0I,6503
29
+ dbt_platform_helper/domain/terraform_environment.py,sha256=7ZKLZ8Zk6-V_IPaCDUP8eYTRudqDjHxvFnbG6LIlLO4,1759
30
+ dbt_platform_helper/domain/versioning.py,sha256=9AdQ_pW20RUwdvdSgY_OzqlDkFaevLNAeh5WZ-w0Xww,7865
30
31
  dbt_platform_helper/jinja2_tags.py,sha256=hKG6RS3zlxJHQ-Op9r2U2-MhWp4s3lZir4Ihe24ApJ0,540
31
32
  dbt_platform_helper/platform_exception.py,sha256=bheZV9lqGvrCVTNT92349dVntNDEDWTEwciZgC83WzE,187
32
33
  dbt_platform_helper/providers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
- dbt_platform_helper/providers/aws.py,sha256=mlorH0fni6m8aUpm1x2jQPhaI3T0QsDMWpoGiSURBcI,1387
34
- dbt_platform_helper/providers/cache.py,sha256=GIFVdpfXVnVgf2POQvBvZDP6pvYeUFjEuAdAQLbhJXs,2563
34
+ dbt_platform_helper/providers/aws/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
35
+ dbt_platform_helper/providers/aws/exceptions.py,sha256=LcTRdjnABDx44BEC4kd4Qb9HNrEcyyCY4yzG16kV3eE,1712
36
+ dbt_platform_helper/providers/aws/interfaces.py,sha256=0JFggcUTJ8zERdxNVVpIiKvaaZeT2c-VECDG--MOi8E,285
37
+ dbt_platform_helper/providers/aws/opensearch.py,sha256=Qne2SoPllmacVSc7AxtjBlEbSBsRMbR_ySEkEymSF9k,581
38
+ dbt_platform_helper/providers/aws/redis.py,sha256=i3Kb00_BdqssjQg1wgZ-8GRXcEWQiORWnIEq6qkAXjQ,551
39
+ dbt_platform_helper/providers/aws/sso_auth.py,sha256=1cE9gVu0XZoE3Nycs1anShistRU_CZCOGMFzFpaAq0w,2275
40
+ dbt_platform_helper/providers/cache.py,sha256=1hEwp0y9WYbEfgsp-RU9MyzIgCt1-4BxApgd_0uVweE,3615
35
41
  dbt_platform_helper/providers/cloudformation.py,sha256=SvCZgEVqxdpKfQMRAG3KzFQ43YeOEDqMm2tKmFGtacY,5347
36
- dbt_platform_helper/providers/config.py,sha256=nGpL2_-ko94Dd4YM5vDEpME_8IGEhWpFcLQqKkb_h8E,4145
37
- dbt_platform_helper/providers/config_validator.py,sha256=of2iD4JX69Ekvs1CbAHU-KHsg9aVUgyB5uHkeYsGGlQ,10722
38
- dbt_platform_helper/providers/copilot.py,sha256=nBbt-PoGXVkmb9njJti6Et8dq1W9GytW3jGBydNNYYU,5317
42
+ dbt_platform_helper/providers/config.py,sha256=X84xQxTVWDcuLAeGBM4A5uVhEiXIzjiVfCB9nAjqVf8,4249
43
+ dbt_platform_helper/providers/config_validator.py,sha256=-n9KjfTQhk2NPK5Vw1Bbz9z-uTSQfWPWUbtRLp1EbTs,11088
44
+ dbt_platform_helper/providers/copilot.py,sha256=Pgdh1JS-so2thT7Jqipol5aVkA_CgU6doUmy3YjYSXs,5328
39
45
  dbt_platform_helper/providers/ecr.py,sha256=lmLKGR5OQT8EyGsX-9M7oO0DHIyoMqgchBAVQBeoBZs,639
40
46
  dbt_platform_helper/providers/ecs.py,sha256=XlQHYhZiLGrqR-1ZWMagGH2R2Hy7mCP6676eZL3YbNQ,3842
41
47
  dbt_platform_helper/providers/files.py,sha256=cJdOV6Eupi-COmGUMxZMF10BZnMi3MCCipTVUnE_NPA,857
42
- dbt_platform_helper/providers/io.py,sha256=T5E_SvmTE4aWq_nAvlYwK6yY-6_nEgK_cd0dQ8PCNUs,1267
43
- dbt_platform_helper/providers/load_balancers.py,sha256=YBnjhuNuUdbz7HPmxvD2xcu7cUaSwAGFkBxmrZiortU,10310
44
- dbt_platform_helper/providers/opensearch.py,sha256=tp64jTzHlutleqMpi2h_ZKH1iakZPJnUODebX6i2mfA,1335
45
- dbt_platform_helper/providers/platform_config_schema.py,sha256=1PjqzdOnhSncyX3BPpewl0be9xOBauCfnLLHOW40f2c,26972
46
- dbt_platform_helper/providers/platform_helper_versioning.py,sha256=_2iKrghWh9JzEbDq5ZgH5o50r1L5bNCyXTNsQXlSvZE,4332
47
- dbt_platform_helper/providers/redis.py,sha256=aj8pitxG9IKrMkL3fIYayQhcHPPzApdaXq0Uq_0yblg,1217
48
+ dbt_platform_helper/providers/io.py,sha256=FrVwWZqm8TFxp4Ph2AqbgsePpt6tryNdaPzc4wyGJmA,1364
49
+ dbt_platform_helper/providers/kms.py,sha256=JR2EU3icXePoJCtr7QnqDPj1wWbyn5Uf9CRFq3_4lRs,647
50
+ dbt_platform_helper/providers/load_balancers.py,sha256=KTsdpNttdUay_2d_IfC6oWbC8rWfs4Oh2eSgGMyK1Ag,10572
51
+ dbt_platform_helper/providers/parameter_store.py,sha256=klxDhcQ65Yc2KAc4Gf5P0vhpZOW7_vZalAVb-LLAA4s,1568
52
+ dbt_platform_helper/providers/platform_config_schema.py,sha256=yDfZ61qJLpKUJWu3M9HaGninf02dojmlbGRoQ6g5i9o,27588
48
53
  dbt_platform_helper/providers/secrets.py,sha256=6cYIR15dLdHmqxtWQpM6R71e0_Xgsg9V291HBG-0LV0,5272
49
- dbt_platform_helper/providers/semantic_version.py,sha256=XPvwbxTKfrW8Tp3kSEtkRG9jNR2bb3Axo0hcE2Uv7y8,5193
50
- dbt_platform_helper/providers/terraform_manifest.py,sha256=hrCjkuQIV0Ymt5MPLkh-BfXHtuAScXhWwNkVEp9K5Jg,9354
54
+ dbt_platform_helper/providers/semantic_version.py,sha256=zVEYRnonWs1eENzMULp4VLEH5sRbxLQgiXAEcx-lp1E,2455
55
+ dbt_platform_helper/providers/terraform_manifest.py,sha256=65lVbq3nSsMpADoSUse78LCRWFTsQeV6r6Az8sDZWdQ,9459
51
56
  dbt_platform_helper/providers/validation.py,sha256=i2g-Mrd4hy_fGIfGa6ZQy4vTJ40OM44Fe_XpEifGWxs,126
52
- dbt_platform_helper/providers/version.py,sha256=w5SEnm4OryKM3qtXYCcLx77vH5rhnbYadNGwQCTNdU8,2054
57
+ dbt_platform_helper/providers/version.py,sha256=uVPnFdwNhkIj0J-RYgMfJy3zTCoGAb7Y12ZZhpkPGeg,5086
58
+ dbt_platform_helper/providers/version_status.py,sha256=6BgUqhqfGFKkne1xd3Zv9MhV9WR7Jt8A295A58mtkAU,2988
53
59
  dbt_platform_helper/providers/vpc.py,sha256=EIjjD71K1Ry3V1jyaAkAjZwlwu_FSTn-AS7kiJFiipA,2953
54
- dbt_platform_helper/providers/yaml_file.py,sha256=D4ESXYBdryT4kJ7Jr3koL05c5Lbn6fFv1YReImrYKQo,2180
60
+ dbt_platform_helper/providers/yaml_file.py,sha256=q-1DWtuG9bfR24lOYzwCwzgOpGPwDaoJpLUB1DtdEmE,2179
55
61
  dbt_platform_helper/templates/.copilot/config.yml,sha256=J_bA9sCtBdCPBRImpCBRnYvhQd4vpLYIXIU-lq9vbkA,158
56
62
  dbt_platform_helper/templates/.copilot/image_build_run.sh,sha256=adYucYXEB-kAgZNjTQo0T6EIAY8sh_xCEvVhWKKQ8mw,164
57
63
  dbt_platform_helper/templates/.copilot/phases/build.sh,sha256=umKXePcRvx4XyrRY0fAWIyYFtNjqBI2L8vIJk-V7C60,121
@@ -75,25 +81,20 @@ dbt_platform_helper/templates/environment-pipelines/main.tf,sha256=qElclUHb0pv-N
75
81
  dbt_platform_helper/templates/svc/maintenance_pages/default.html,sha256=OTZ-qwwSXu7PFbsgp4kppdm1lsg_iHK7FCFqhPnvrEs,741
76
82
  dbt_platform_helper/templates/svc/maintenance_pages/dmas-migration.html,sha256=qvI6tHuI0UQbMBCuvPgK1a_zLANB6w7KVo9N5d8r-i0,829
77
83
  dbt_platform_helper/templates/svc/maintenance_pages/migration.html,sha256=GiQsOiuaMFb7jG5_wU3V7BMcByHBl9fOBgrNf8quYlw,783
78
- dbt_platform_helper/templates/svc/manifest-backend.yml,sha256=aAD9ndkbXnF7JBAKS21rl6wmCuIQufHaaAO7yqVHgj4,2571
79
- dbt_platform_helper/templates/svc/manifest-public.yml,sha256=6NHVR_onBu5hbwynLrB6roDRce7JcylSc0qeYvzlPdI,3664
80
84
  dbt_platform_helper/templates/svc/overrides/cfn.patches.yml,sha256=W7-d017akuUq9kda64DQxazavcRcCPDjaAik6t1EZqM,742
81
85
  dbt_platform_helper/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
82
86
  dbt_platform_helper/utils/application.py,sha256=_O2ywJRYYdWfBVz4LzD07PLO9hSPJf7FylE6toH19KM,5448
83
87
  dbt_platform_helper/utils/arn_parser.py,sha256=BaXzIxSOLdFmP_IfAxRq-0j-0Re1iCN7L4j2Zi5-CRQ,1304
84
- dbt_platform_helper/utils/aws.py,sha256=C18qEs8rekApGpJ39UslPvmpdFKhKX8Pybvz62YslQU,16918
88
+ dbt_platform_helper/utils/aws.py,sha256=trdBgq1HqbW9rczog1LTZ1XLTwn2L1liUFrl9QSTDNA,12589
85
89
  dbt_platform_helper/utils/click.py,sha256=Fx4y4bbve1zypvog_sgK7tJtCocmzheoEFLBRv1lfdM,2943
86
- dbt_platform_helper/utils/cloudfoundry.py,sha256=GnQ4fVLnDfOdNSrsJjI6ElZHqpgwINeoPn77cUH2UFY,484
87
- dbt_platform_helper/utils/files.py,sha256=koqFGJhu4uoxKEMoY3_v1n6JUhSK5832ubJdTMHorlQ,2141
88
- dbt_platform_helper/utils/git.py,sha256=7JGZMaI8-cU6-GjXIXjOlsYfKu_RppLOGyAicBd4n_8,704
89
- dbt_platform_helper/utils/manifests.py,sha256=ji3UYHCxq9tTpkm4MlRa2y0-JOYYqq1pWZ2h_zpj0UU,507
90
+ dbt_platform_helper/utils/git.py,sha256=pVa6K9LFscAHFpVEOZFoUwj-uHZP-52MFH7_C-uPQGs,782
90
91
  dbt_platform_helper/utils/messages.py,sha256=nWA7BWLb7ND0WH5TejDN4OQUJSKYBxU4tyCzteCrfT0,142
91
92
  dbt_platform_helper/utils/template.py,sha256=g-Db-0I6a6diOHkgK1nYA0IxJSO4TRrjqOvlyeOR32o,950
93
+ dbt_platform_helper/utils/tool_versioning.py,sha256=UXrICUnnWCSpOdIIJaVnZcN2U3pgCUbpjvL4exevDbw,510
92
94
  dbt_platform_helper/utils/validation.py,sha256=coN7WsKW_nPGW9EU23AInBkAuvUl1NfQvc2bjVtgs14,1188
93
- dbt_platform_helper/utils/versioning.py,sha256=hlZdHSpPtOrHZmkA3kiE-rALX02ZUXWGCpZT2xcS4G8,3726
94
- platform_helper.py,sha256=lUGBsVgsGGJSDXxRvtvZCo2ybRAWuJXosbzfTzkIxU8,1892
95
- dbt_platform_helper-13.1.2.dist-info/LICENSE,sha256=dP79lN73--7LMApnankTGLqDbImXg8iYFqWgnExGkGk,1090
96
- dbt_platform_helper-13.1.2.dist-info/METADATA,sha256=pq1WY9ZXizECbK7o70ufepml4puyw1o_gfF_6brbxLw,3243
97
- dbt_platform_helper-13.1.2.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
98
- dbt_platform_helper-13.1.2.dist-info/entry_points.txt,sha256=QhbY8F434A-onsg0-FsdMd2U6HKh6Q7yCFFZrGUh5-M,67
99
- dbt_platform_helper-13.1.2.dist-info/RECORD,,
95
+ platform_helper.py,sha256=_YNNGtMkH5BcpC_mQQYJrmlf2mt7lkxTYeH7ZgflPoA,1925
96
+ dbt_platform_helper-13.3.0.dist-info/LICENSE,sha256=dP79lN73--7LMApnankTGLqDbImXg8iYFqWgnExGkGk,1090
97
+ dbt_platform_helper-13.3.0.dist-info/METADATA,sha256=ebTgbrOTabzJ8qyfYiXRv_sPazEI02tdhbhu7v3XUbg,3243
98
+ dbt_platform_helper-13.3.0.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
99
+ dbt_platform_helper-13.3.0.dist-info/entry_points.txt,sha256=QhbY8F434A-onsg0-FsdMd2U6HKh6Q7yCFFZrGUh5-M,67
100
+ dbt_platform_helper-13.3.0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 2.1.1
2
+ Generator: poetry-core 2.1.2
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
platform_helper.py CHANGED
@@ -42,4 +42,4 @@ platform_helper.add_command(database_commands)
42
42
  platform_helper.add_command(version_commands)
43
43
 
44
44
  if __name__ == "__main__":
45
- platform_helper()
45
+ platform_helper(auto_envvar_prefix="DBT_PLATFORM")
@@ -1,36 +0,0 @@
1
- from dbt_platform_helper.providers.cache import CacheProvider
2
-
3
-
4
- class OpensearchProvider:
5
-
6
- def __init__(self, opensearch_client):
7
- self.opensearch_client = opensearch_client
8
-
9
- def get_supported_opensearch_versions(self) -> list[str]:
10
-
11
- cache_provider = self.__get_cache_provider()
12
-
13
- if cache_provider.cache_refresh_required("opensearch"):
14
-
15
- response = self.opensearch_client.list_versions()
16
- all_versions = response["Versions"]
17
-
18
- opensearch_versions = [
19
- version for version in all_versions if not version.startswith("Elasticsearch_")
20
- ]
21
- supported_versions = [
22
- version.removeprefix("OpenSearch_") for version in opensearch_versions
23
- ]
24
-
25
- cache_provider.update_cache("opensearch", supported_versions)
26
-
27
- return supported_versions
28
-
29
- else:
30
- return cache_provider.read_supported_versions_from_cache("opensearch")
31
-
32
- # TODO - cache provider instantiated here rather than via dependancy injection since it will likely only be used in the get_supported_opensearch_versions method.
33
- # If another method is added which needs a CacheProvider, it should be injected into the constructor instead.
34
- @staticmethod
35
- def __get_cache_provider():
36
- return CacheProvider()
@@ -1,107 +0,0 @@
1
- import os
2
- from pathlib import Path
3
-
4
- from dbt_platform_helper.constants import PLATFORM_HELPER_VERSION_FILE
5
- from dbt_platform_helper.providers.config import ConfigProvider
6
- from dbt_platform_helper.providers.files import FileProvider
7
- from dbt_platform_helper.providers.io import ClickIOProvider
8
- from dbt_platform_helper.providers.semantic_version import (
9
- IncompatibleMajorVersionException,
10
- )
11
- from dbt_platform_helper.providers.semantic_version import (
12
- IncompatibleMinorVersionException,
13
- )
14
- from dbt_platform_helper.providers.semantic_version import PlatformHelperVersionStatus
15
- from dbt_platform_helper.providers.semantic_version import SemanticVersion
16
- from dbt_platform_helper.providers.version import LocalVersionProvider
17
- from dbt_platform_helper.providers.version import LocalVersionProviderException
18
- from dbt_platform_helper.providers.version import PyPiVersionProvider
19
- from dbt_platform_helper.providers.yaml_file import FileProviderException
20
- from dbt_platform_helper.providers.yaml_file import YamlFileProvider
21
- from dbt_platform_helper.utils.files import running_as_installed_package
22
-
23
-
24
- class PlatformHelperVersioning:
25
- def __init__(
26
- self,
27
- io: ClickIOProvider = ClickIOProvider(),
28
- file_provider: FileProvider = YamlFileProvider,
29
- config_provider: ConfigProvider = ConfigProvider(),
30
- pypi_provider: PyPiVersionProvider = PyPiVersionProvider,
31
- local_version_provider: LocalVersionProvider = LocalVersionProvider(),
32
- ):
33
- self.io = io
34
- self.file_provider = file_provider
35
- self.config_provider = config_provider
36
- self.pypi_provider = pypi_provider
37
- self.local_version_provider = local_version_provider
38
-
39
- def get_status(
40
- self,
41
- include_project_versions: bool = True,
42
- ) -> PlatformHelperVersionStatus:
43
- try:
44
- locally_installed_version = self.local_version_provider.get_installed_tool_version(
45
- "dbt-platform-helper"
46
- )
47
- except LocalVersionProviderException:
48
- locally_installed_version = None
49
-
50
- latest_release = self.pypi_provider.get_latest_version("dbt-platform-helper")
51
-
52
- if not include_project_versions:
53
- return PlatformHelperVersionStatus(
54
- local=locally_installed_version,
55
- latest=latest_release,
56
- )
57
-
58
- deprecated_version_file = Path(PLATFORM_HELPER_VERSION_FILE)
59
- try:
60
- loaded_version = self.file_provider.load(deprecated_version_file)
61
- version_from_file = SemanticVersion.from_string(loaded_version)
62
- except FileProviderException:
63
- version_from_file = None
64
-
65
- platform_config_default, pipeline_overrides = None, {}
66
-
67
- platform_config = self.config_provider.load_unvalidated_config_file()
68
-
69
- if platform_config:
70
- platform_config_default = SemanticVersion.from_string(
71
- platform_config.get("default_versions", {}).get("platform-helper")
72
- )
73
-
74
- pipeline_overrides = {
75
- name: pipeline.get("versions", {}).get("platform-helper")
76
- for name, pipeline in platform_config.get("environment_pipelines", {}).items()
77
- if pipeline.get("versions", {}).get("platform-helper")
78
- }
79
-
80
- out = PlatformHelperVersionStatus(
81
- local=locally_installed_version,
82
- latest=latest_release,
83
- deprecated_version_file=version_from_file,
84
- platform_config_default=platform_config_default,
85
- pipeline_overrides=pipeline_overrides,
86
- )
87
-
88
- return out
89
-
90
- def check_if_needs_update(self):
91
- if not running_as_installed_package() or "PLATFORM_TOOLS_SKIP_VERSION_CHECK" in os.environ:
92
- return
93
-
94
- version_status = self.get_status(include_project_versions=False)
95
-
96
- message = (
97
- f"You are running platform-helper v{version_status.local}, upgrade to "
98
- f"v{version_status.latest} by running run `pip install "
99
- "--upgrade dbt-platform-helper`."
100
- )
101
-
102
- try:
103
- version_status.local.validate_compatibility_with(version_status.latest)
104
- except IncompatibleMajorVersionException:
105
- self.io.error(message)
106
- except IncompatibleMinorVersionException:
107
- self.io.warn(message)
@@ -1,34 +0,0 @@
1
- from dbt_platform_helper.providers.cache import CacheProvider
2
-
3
-
4
- class RedisProvider:
5
- def __init__(self, elasticache_client):
6
- self.elasticache_client = elasticache_client
7
-
8
- def get_supported_redis_versions(self):
9
-
10
- cache_provider = self.__get_cache_provider()
11
-
12
- if cache_provider.cache_refresh_required("redis"):
13
-
14
- supported_versions_response = self.elasticache_client.describe_cache_engine_versions(
15
- Engine="redis"
16
- )
17
-
18
- supported_versions = [
19
- version["EngineVersion"]
20
- for version in supported_versions_response["CacheEngineVersions"]
21
- ]
22
-
23
- cache_provider.update_cache("redis", supported_versions)
24
-
25
- return supported_versions
26
-
27
- else:
28
- return cache_provider.read_supported_versions_from_cache("redis")
29
-
30
- # TODO - cache provider instantiated here rather than via dependancy injection since it will likely only be used in the get_supported_redis_versions method.
31
- # If another method is added which needs a CacheProvider, it should be injected into the constructor instead.
32
- @staticmethod
33
- def __get_cache_provider():
34
- return CacheProvider()
@@ -1,69 +0,0 @@
1
- # {% version_info %}
2
- # The manifest for the "{{ name }}" service.
3
- # Read the full specification for the "Backend Service" type at:
4
- # https://aws.github.io/copilot-cli/docs/manifest/backend-service/
5
-
6
- # Your service name will be used in naming your resources like log groups, ECS services, etc.
7
- name: {{ name }}
8
- type: Backend Service
9
-
10
- # Your service does not allow any traffic.
11
-
12
- # Configuration for your containers and service.
13
- image:
14
- location: {{ image_location }}
15
- # Your task should have a health check.
16
- # Celery example: https://github.com/uktrade/copilot-python?tab=readme-ov-file#celery-health-check
17
- healthcheck:
18
- command: [ "CMD-SHELL", "launcher bash -c 'echo \"Dummy health check - please replace\"'" ]
19
- interval: 10s
20
- timeout: 5s
21
- retries: 2
22
- start_period: 10s
23
-
24
- cpu: 256 # Number of CPU units for the task.
25
- memory: 512 # Amount of memory in MiB used by the task.
26
- count: # See https://aws.github.io/copilot-cli/docs/manifest/lb-web-service/#count
27
- range: 2-10
28
- cooldown:
29
- in: 120s
30
- out: 60s
31
- cpu_percentage: 50
32
- exec: true # Enable running commands in your container.
33
- network:
34
- connect: true # Enable Service Connect for intra-environment traffic between services.
35
- vpc:
36
- placement: 'private'
37
-
38
- storage:
39
- readonly_fs: true # Limit to read-only access to mounted root filesystems.
40
-
41
- variables: # Pass environment variables as key value pairs.
42
- PORT: 8080 # The bootstrap container requires a $PORT env var
43
- {%- for envvar, value in env_vars.items() %}
44
- {{ envvar }}: {{ value }}
45
- {%- endfor %}
46
-
47
- {% if secrets %}
48
- secrets: # Pass secrets from AWS Systems Manager (SSM) Parameter Store.
49
- {%- for secret, value in secrets.items() %}
50
- {{ secret }}: /copilot/${COPILOT_APPLICATION_NAME}/${COPILOT_ENVIRONMENT_NAME}/secrets/{{ value }}{% endfor -%}
51
- {% else %}
52
- # secrets: # Pass secrets from AWS Systems Manager (SSM) Parameter Store.
53
- {% endif %}
54
-
55
-
56
- # You can override any of the values defined above by environment.
57
- environments:
58
- {%- for env_name, env in environments.items() %}
59
- {{ env_name }}:
60
- {%- if env.memory %}
61
- memory: {{ env.memory }}
62
- {%- endif %}
63
- {%- if env.count and env.count is mapping %}
64
- count: # For options see https://aws.github.io/copilot-cli/docs/manifest/lb-web-service/#count
65
- {{ env.count | to_yaml | indent(6) | trim }}
66
- {%- elif env.count %}
67
- count: {{ env.count }} # For options see https://aws.github.io/copilot-cli/docs/manifest/lb-web-service/#count
68
- {%- endif %}
69
- {%- endfor %}