dbt-platform-helper 12.5.0__tar.gz → 12.6.0__tar.gz

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 (108) hide show
  1. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/PKG-INFO +2 -2
  2. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/COMMANDS.md +39 -38
  3. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/commands/codebase.py +5 -8
  4. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/commands/conduit.py +2 -2
  5. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/commands/config.py +1 -1
  6. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/commands/copilot.py +4 -2
  7. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/commands/environment.py +40 -24
  8. dbt_platform_helper-12.6.0/dbt_platform_helper/commands/pipeline.py +57 -0
  9. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/constants.py +1 -0
  10. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/domain/codebase.py +20 -23
  11. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/domain/conduit.py +10 -12
  12. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/domain/config_validator.py +40 -7
  13. dbt_platform_helper-12.6.0/dbt_platform_helper/domain/copilot_environment.py +208 -0
  14. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/domain/database_copy.py +45 -42
  15. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/domain/maintenance_page.py +220 -183
  16. dbt_platform_helper-12.6.0/dbt_platform_helper/domain/pipelines.py +212 -0
  17. dbt_platform_helper-12.6.0/dbt_platform_helper/domain/terraform_environment.py +86 -0
  18. dbt_platform_helper-12.6.0/dbt_platform_helper/domain/test_platform_terraform_manifest_generator.py +100 -0
  19. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/providers/cache.py +1 -2
  20. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/providers/cloudformation.py +12 -1
  21. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/providers/config.py +21 -13
  22. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/providers/copilot.py +2 -0
  23. dbt_platform_helper-12.6.0/dbt_platform_helper/providers/files.py +26 -0
  24. dbt_platform_helper-12.6.0/dbt_platform_helper/providers/io.py +31 -0
  25. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/providers/load_balancers.py +29 -3
  26. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/providers/platform_config_schema.py +10 -7
  27. dbt_platform_helper-12.6.0/dbt_platform_helper/providers/vpc.py +106 -0
  28. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/providers/yaml_file.py +3 -14
  29. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/templates/COMMANDS.md.jinja +5 -3
  30. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/templates/pipelines/codebase/overrides/package-lock.json +819 -623
  31. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/utils/application.py +32 -34
  32. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/utils/aws.py +0 -50
  33. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/utils/files.py +8 -23
  34. dbt_platform_helper-12.6.0/dbt_platform_helper/utils/messages.py +5 -0
  35. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/utils/platform_config.py +0 -7
  36. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/utils/versioning.py +12 -0
  37. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/pyproject.toml +2 -2
  38. dbt_platform_helper-12.5.0/dbt_platform_helper/commands/pipeline.py +0 -222
  39. dbt_platform_helper-12.5.0/dbt_platform_helper/domain/copilot_environment.py +0 -204
  40. dbt_platform_helper-12.5.0/dbt_platform_helper/domain/terraform_environment.py +0 -53
  41. dbt_platform_helper-12.5.0/dbt_platform_helper/utils/messages.py +0 -6
  42. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/LICENSE +0 -0
  43. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/README.md +0 -0
  44. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/__init__.py +0 -0
  45. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/addon-plans.yml +0 -0
  46. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/commands/__init__.py +0 -0
  47. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/commands/application.py +0 -0
  48. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/commands/database.py +0 -0
  49. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/commands/generate.py +0 -0
  50. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/commands/notify.py +0 -0
  51. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/commands/secrets.py +0 -0
  52. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/commands/version.py +0 -0
  53. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/default-extensions.yml +0 -0
  54. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/domain/__init__.py +0 -0
  55. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/jinja2_tags.py +0 -0
  56. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/platform_exception.py +0 -0
  57. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/providers/__init__.py +0 -0
  58. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/providers/aws.py +0 -0
  59. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/providers/ecs.py +0 -0
  60. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/providers/opensearch.py +0 -0
  61. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/providers/redis.py +0 -0
  62. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/providers/secrets.py +0 -0
  63. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/providers/validation.py +0 -0
  64. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/templates/.copilot/config.yml +0 -0
  65. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/templates/.copilot/image_build_run.sh +0 -0
  66. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/templates/.copilot/phases/build.sh +0 -0
  67. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/templates/.copilot/phases/install.sh +0 -0
  68. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/templates/.copilot/phases/post_build.sh +0 -0
  69. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/templates/.copilot/phases/pre_build.sh +0 -0
  70. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/templates/addon-instructions.txt +0 -0
  71. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/templates/addons/README.md +0 -0
  72. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/templates/addons/svc/appconfig-ipfilter.yml +0 -0
  73. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/templates/addons/svc/prometheus-policy.yml +0 -0
  74. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/templates/addons/svc/s3-cross-account-policy.yml +0 -0
  75. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/templates/addons/svc/s3-policy.yml +0 -0
  76. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/templates/addons/svc/subscription-filter.yml +0 -0
  77. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/templates/ci-codebuild-role-policy.json +0 -0
  78. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/templates/create-codebuild-role.json +0 -0
  79. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/templates/custom-codebuild-role-policy.json +0 -0
  80. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/templates/env/manifest.yml +0 -0
  81. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/templates/env/terraform-overrides/cfn.patches.yml +0 -0
  82. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/templates/environment-pipelines/main.tf +0 -0
  83. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/templates/environments/main.tf +0 -0
  84. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/templates/pipelines/codebase/manifest.yml +0 -0
  85. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/templates/pipelines/codebase/overrides/.gitignore +0 -0
  86. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/templates/pipelines/codebase/overrides/bin/override.ts +0 -0
  87. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/templates/pipelines/codebase/overrides/buildspec.deploy.yml +0 -0
  88. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/templates/pipelines/codebase/overrides/buildspec.image.yml +0 -0
  89. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/templates/pipelines/codebase/overrides/cdk.json +0 -0
  90. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/templates/pipelines/codebase/overrides/package.json +0 -0
  91. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/templates/pipelines/codebase/overrides/stack.ts +0 -0
  92. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/templates/pipelines/codebase/overrides/tsconfig.json +0 -0
  93. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/templates/pipelines/codebase/overrides/types.ts +0 -0
  94. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/templates/svc/maintenance_pages/default.html +0 -0
  95. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/templates/svc/maintenance_pages/dmas-migration.html +0 -0
  96. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/templates/svc/maintenance_pages/migration.html +0 -0
  97. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/templates/svc/manifest-backend.yml +0 -0
  98. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/templates/svc/manifest-public.yml +0 -0
  99. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/templates/svc/overrides/cfn.patches.yml +0 -0
  100. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/utils/__init__.py +0 -0
  101. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/utils/arn_parser.py +0 -0
  102. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/utils/click.py +0 -0
  103. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/utils/cloudfoundry.py +0 -0
  104. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/utils/git.py +0 -0
  105. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/utils/manifests.py +0 -0
  106. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/utils/template.py +0 -0
  107. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/dbt_platform_helper/utils/validation.py +0 -0
  108. {dbt_platform_helper-12.5.0 → dbt_platform_helper-12.6.0}/platform_helper.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: dbt-platform-helper
3
- Version: 12.5.0
3
+ Version: 12.6.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
@@ -13,7 +13,7 @@ Classifier: Programming Language :: Python :: 3.10
13
13
  Classifier: Programming Language :: Python :: 3.11
14
14
  Classifier: Programming Language :: Python :: 3.12
15
15
  Classifier: Programming Language :: Python :: 3.13
16
- Requires-Dist: Jinja2 (==3.1.4)
16
+ Requires-Dist: Jinja2 (==3.1.5)
17
17
  Requires-Dist: PyYAML (==6.0.1)
18
18
  Requires-Dist: aiohttp (>=3.8.4,<4.0.0)
19
19
  Requires-Dist: boto3 (>=1.28.24,<2.0.0)
@@ -1,40 +1,40 @@
1
1
  # Commands Reference
2
2
 
3
3
  - [platform-helper](#platform-helper)
4
- - [platform-helper application](#platform-helper-application)
5
- - [platform-helper application container-stats](#platform-helper-application-container-stats)
6
- - [platform-helper application task-stats](#platform-helper-application-task-stats)
7
- - [platform-helper codebase](#platform-helper-codebase)
8
- - [platform-helper codebase prepare](#platform-helper-codebase-prepare)
9
- - [platform-helper codebase list](#platform-helper-codebase-list)
10
- - [platform-helper codebase build](#platform-helper-codebase-build)
11
- - [platform-helper codebase deploy](#platform-helper-codebase-deploy)
12
- - [platform-helper conduit](#platform-helper-conduit)
13
- - [platform-helper config](#platform-helper-config)
14
- - [platform-helper config validate](#platform-helper-config-validate)
15
- - [platform-helper config aws](#platform-helper-config-aws)
16
- - [platform-helper copilot](#platform-helper-copilot)
17
- - [platform-helper copilot make-addons](#platform-helper-copilot-make-addons)
18
- - [platform-helper environment](#platform-helper-environment)
19
- - [platform-helper environment offline](#platform-helper-environment-offline)
20
- - [platform-helper environment online](#platform-helper-environment-online)
21
- - [platform-helper environment generate](#platform-helper-environment-generate)
22
- - [platform-helper environment generate-terraform](#platform-helper-environment-generate-terraform)
23
- - [platform-helper generate](#platform-helper-generate)
24
- - [platform-helper pipeline](#platform-helper-pipeline)
25
- - [platform-helper pipeline generate](#platform-helper-pipeline-generate)
26
- - [platform-helper secrets](#platform-helper-secrets)
27
- - [platform-helper secrets copy](#platform-helper-secrets-copy)
28
- - [platform-helper secrets list](#platform-helper-secrets-list)
29
- - [platform-helper notify](#platform-helper-notify)
30
- - [platform-helper notify environment-progress](#platform-helper-notify-environment-progress)
31
- - [platform-helper notify add-comment](#platform-helper-notify-add-comment)
32
- - [platform-helper database](#platform-helper-database)
33
- - [platform-helper database dump](#platform-helper-database-dump)
34
- - [platform-helper database load](#platform-helper-database-load)
35
- - [platform-helper database copy](#platform-helper-database-copy)
36
- - [platform-helper version](#platform-helper-version)
37
- - [platform-helper version get-platform-helper-for-project](#platform-helper-version-get-platform-helper-for-project)
4
+ - [platform-helper application](#platform-helper-application)
5
+ - [platform-helper application container-stats](#platform-helper-application-container-stats)
6
+ - [platform-helper application task-stats](#platform-helper-application-task-stats)
7
+ - [platform-helper codebase](#platform-helper-codebase)
8
+ - [platform-helper codebase prepare](#platform-helper-codebase-prepare)
9
+ - [platform-helper codebase list](#platform-helper-codebase-list)
10
+ - [platform-helper codebase build](#platform-helper-codebase-build)
11
+ - [platform-helper codebase deploy](#platform-helper-codebase-deploy)
12
+ - [platform-helper conduit](#platform-helper-conduit)
13
+ - [platform-helper config](#platform-helper-config)
14
+ - [platform-helper config validate](#platform-helper-config-validate)
15
+ - [platform-helper config aws](#platform-helper-config-aws)
16
+ - [platform-helper copilot](#platform-helper-copilot)
17
+ - [platform-helper copilot make-addons](#platform-helper-copilot-make-addons)
18
+ - [platform-helper environment](#platform-helper-environment)
19
+ - [platform-helper environment offline](#platform-helper-environment-offline)
20
+ - [platform-helper environment online](#platform-helper-environment-online)
21
+ - [platform-helper environment generate](#platform-helper-environment-generate)
22
+ - [platform-helper environment generate-terraform](#platform-helper-environment-generate-terraform)
23
+ - [platform-helper generate](#platform-helper-generate)
24
+ - [platform-helper pipeline](#platform-helper-pipeline)
25
+ - [platform-helper pipeline generate](#platform-helper-pipeline-generate)
26
+ - [platform-helper secrets](#platform-helper-secrets)
27
+ - [platform-helper secrets copy](#platform-helper-secrets-copy)
28
+ - [platform-helper secrets list](#platform-helper-secrets-list)
29
+ - [platform-helper notify](#platform-helper-notify)
30
+ - [platform-helper notify environment-progress](#platform-helper-notify-environment-progress)
31
+ - [platform-helper notify add-comment](#platform-helper-notify-add-comment)
32
+ - [platform-helper database](#platform-helper-database)
33
+ - [platform-helper database dump](#platform-helper-database-dump)
34
+ - [platform-helper database load](#platform-helper-database-load)
35
+ - [platform-helper database copy](#platform-helper-database-copy)
36
+ - [platform-helper version](#platform-helper-version)
37
+ - [platform-helper version get-platform-helper-for-project](#platform-helper-version-get-platform-helper-for-project)
38
38
 
39
39
  # platform-helper
40
40
 
@@ -457,19 +457,20 @@ platform-helper environment online --app <application> --env <environment>
457
457
 
458
458
  [↩ Parent](#platform-helper-environment)
459
459
 
460
+ Gathers various IDs and ARNs from AWS and generates the AWS Copilot
461
+ environment manifest at copilot/environments/<environment>/manifest.yml.
462
+
460
463
  ## Usage
461
464
 
462
465
  ```
463
- platform-helper environment generate --name <name> [--vpc-name <vpc_name>]
466
+ platform-helper environment generate --name <name>
464
467
  ```
465
468
 
466
469
  ## Options
467
470
 
468
- - `--vpc-name <text>`
469
-
470
471
  - `--name
471
472
  -n <text>`
472
-
473
+ - The name of the environment to generate a copilot manifest for.
473
474
  - `--help <boolean>` _Defaults to False._
474
475
  - Show this message and exit.
475
476
 
@@ -2,6 +2,7 @@ import click
2
2
 
3
3
  from dbt_platform_helper.domain.codebase import Codebase
4
4
  from dbt_platform_helper.platform_exception import PlatformException
5
+ from dbt_platform_helper.providers.io import ClickIOProvider
5
6
  from dbt_platform_helper.utils.click import ClickDocOptGroup
6
7
  from dbt_platform_helper.utils.versioning import (
7
8
  check_platform_helper_version_needs_update,
@@ -20,8 +21,7 @@ def prepare():
20
21
  try:
21
22
  Codebase().prepare()
22
23
  except PlatformException as err:
23
- click.secho(str(err), fg="red")
24
- raise click.Abort
24
+ ClickIOProvider().abort_with_error(str(err))
25
25
 
26
26
 
27
27
  @codebase.command()
@@ -37,8 +37,7 @@ def list(app, with_images):
37
37
  try:
38
38
  Codebase().list(app, with_images)
39
39
  except PlatformException as err:
40
- click.secho(str(err), fg="red")
41
- raise click.Abort
40
+ ClickIOProvider().abort_with_error(str(err))
42
41
 
43
42
 
44
43
  @codebase.command()
@@ -54,8 +53,7 @@ def build(app, codebase, commit):
54
53
  try:
55
54
  Codebase().build(app, codebase, commit)
56
55
  except PlatformException as err:
57
- click.secho(str(err), fg="red")
58
- raise click.Abort
56
+ ClickIOProvider().abort_with_error(str(err))
59
57
 
60
58
 
61
59
  @codebase.command()
@@ -71,5 +69,4 @@ def deploy(app, env, codebase, commit):
71
69
  try:
72
70
  Codebase().deploy(app, env, codebase, commit)
73
71
  except PlatformException as err:
74
- click.secho(str(err), fg="red")
75
- raise click.Abort
72
+ ClickIOProvider().abort_with_error(str(err))
@@ -4,6 +4,7 @@ from dbt_platform_helper.domain.conduit import Conduit
4
4
  from dbt_platform_helper.platform_exception import PlatformException
5
5
  from dbt_platform_helper.providers.cloudformation import CloudFormation
6
6
  from dbt_platform_helper.providers.ecs import ECS
7
+ from dbt_platform_helper.providers.io import ClickIOProvider
7
8
  from dbt_platform_helper.providers.secrets import Secrets
8
9
  from dbt_platform_helper.utils.application import load_application
9
10
  from dbt_platform_helper.utils.click import ClickDocOptCommand
@@ -54,5 +55,4 @@ def conduit(addon_name: str, app: str, env: str, access: str):
54
55
  env, addon_name, access
55
56
  )
56
57
  except PlatformException as err:
57
- click.secho(str(err), fg="red")
58
- raise click.Abort
58
+ ClickIOProvider().abort_with_error(str(err))
@@ -98,7 +98,7 @@ def deployment():
98
98
 
99
99
  recommendations = {}
100
100
 
101
- ConfigProvider.config_file_check()
101
+ ConfigProvider().config_file_check()
102
102
 
103
103
  for template_file in addons_templates:
104
104
  generated_with_version = maybe
@@ -13,12 +13,12 @@ from dbt_platform_helper.constants import PLATFORM_CONFIG_FILE
13
13
  from dbt_platform_helper.domain.config_validator import ConfigValidator
14
14
  from dbt_platform_helper.domain.copilot_environment import CopilotTemplating
15
15
  from dbt_platform_helper.providers.config import ConfigProvider
16
+ from dbt_platform_helper.providers.files import FileProvider
16
17
  from dbt_platform_helper.utils.application import get_application_name
17
18
  from dbt_platform_helper.utils.application import load_application
18
19
  from dbt_platform_helper.utils.aws import get_aws_session_or_abort
19
20
  from dbt_platform_helper.utils.click import ClickDocOptGroup
20
21
  from dbt_platform_helper.utils.files import generate_override_files
21
- from dbt_platform_helper.utils.files import mkfile
22
22
  from dbt_platform_helper.utils.messages import abort_with_error
23
23
  from dbt_platform_helper.utils.template import ADDON_TEMPLATE_MAP
24
24
  from dbt_platform_helper.utils.template import camel_case
@@ -379,7 +379,9 @@ def _generate_service_addons(
379
379
 
380
380
  (output_dir / service_path).mkdir(parents=True, exist_ok=True)
381
381
  click.echo(
382
- mkfile(output_dir, service_path / f"{addon_name}.yml", contents, overwrite=True)
382
+ FileProvider.mkfile(
383
+ output_dir, service_path / f"{addon_name}.yml", contents, overwrite=True
384
+ )
383
385
  )
384
386
 
385
387
 
@@ -1,14 +1,17 @@
1
1
  import click
2
- from schema import SchemaError
3
2
 
4
3
  from dbt_platform_helper.constants import DEFAULT_TERRAFORM_PLATFORM_MODULES_VERSION
5
- from dbt_platform_helper.constants import PLATFORM_CONFIG_FILE
6
4
  from dbt_platform_helper.domain.config_validator import ConfigValidator
7
5
  from dbt_platform_helper.domain.copilot_environment import CopilotEnvironment
8
- from dbt_platform_helper.domain.maintenance_page import MaintenancePageProvider
6
+ from dbt_platform_helper.domain.maintenance_page import MaintenancePage
9
7
  from dbt_platform_helper.domain.terraform_environment import TerraformEnvironment
10
8
  from dbt_platform_helper.platform_exception import PlatformException
9
+ from dbt_platform_helper.providers.cloudformation import CloudFormation
11
10
  from dbt_platform_helper.providers.config import ConfigProvider
11
+ from dbt_platform_helper.providers.io import ClickIOProvider
12
+ from dbt_platform_helper.providers.vpc import VpcProvider
13
+ from dbt_platform_helper.utils.application import load_application
14
+ from dbt_platform_helper.utils.aws import get_aws_session_or_abort
12
15
  from dbt_platform_helper.utils.click import ClickDocOptGroup
13
16
  from dbt_platform_helper.utils.versioning import (
14
17
  check_platform_helper_version_needs_update,
@@ -36,11 +39,12 @@ def environment():
36
39
  @click.option("--vpc", type=str)
37
40
  def offline(app, env, svc, template, vpc):
38
41
  """Take load-balanced web services offline with a maintenance page."""
42
+
39
43
  try:
40
- MaintenancePageProvider().activate(app, env, svc, template, vpc)
44
+ application = load_application(app)
45
+ MaintenancePage(application).activate(env, svc, template, vpc)
41
46
  except PlatformException as err:
42
- click.secho(str(err), fg="red")
43
- raise click.Abort
47
+ ClickIOProvider().abort_with_error(str(err))
44
48
 
45
49
 
46
50
  @environment.command()
@@ -48,29 +52,37 @@ def offline(app, env, svc, template, vpc):
48
52
  @click.option("--env", type=str, required=True)
49
53
  def online(app, env):
50
54
  """Remove a maintenance page from an environment."""
55
+
51
56
  try:
52
- MaintenancePageProvider().deactivate(app, env)
57
+ application = load_application(app)
58
+ MaintenancePage(application).deactivate(env)
53
59
  except PlatformException as err:
54
- click.secho(str(err), fg="red")
55
- raise click.Abort
60
+ ClickIOProvider().abort_with_error(str(err))
56
61
 
57
62
 
58
63
  @environment.command()
59
- @click.option("--vpc-name", hidden=True)
60
- @click.option("--name", "-n", required=True)
61
- def generate(name, vpc_name):
62
- if vpc_name:
63
- click.secho(
64
- f"This option is deprecated. Please add the VPC name for your envs to {PLATFORM_CONFIG_FILE}",
65
- fg="red",
66
- )
67
- raise click.Abort
64
+ @click.option(
65
+ "--name",
66
+ "-n",
67
+ required=True,
68
+ help="The name of the environment to generate a copilot manifest for.",
69
+ )
70
+ def generate(name):
71
+ """Gathers various IDs and ARNs from AWS and generates the AWS Copilot
72
+ environment manifest at copilot/environments/<environment>/manifest.yml."""
73
+
74
+ click_io = ClickIOProvider()
68
75
  try:
76
+ session = get_aws_session_or_abort()
69
77
  config_provider = ConfigProvider(ConfigValidator())
70
- CopilotEnvironment(config_provider).generate(name)
71
- except SchemaError as ex:
72
- click.secho(f"Invalid `{PLATFORM_CONFIG_FILE}` file: {str(ex)}", fg="red")
73
- raise click.Abort
78
+ vpc_provider = VpcProvider(session)
79
+ cloudformation_provider = CloudFormation(session.client("cloudformation"))
80
+
81
+ CopilotEnvironment(
82
+ config_provider, vpc_provider, cloudformation_provider, session
83
+ ).generate(name)
84
+ except PlatformException as err:
85
+ click_io.abort_with_error(str(err))
74
86
 
75
87
 
76
88
  @environment.command(help="Generate terraform manifest for the specified environment.")
@@ -82,5 +94,9 @@ def generate(name, vpc_name):
82
94
  help=f"Override the default version of terraform-platform-modules. (Default version is '{DEFAULT_TERRAFORM_PLATFORM_MODULES_VERSION}').",
83
95
  )
84
96
  def generate_terraform(name, terraform_platform_modules_version):
85
- config_provider = ConfigProvider(ConfigValidator())
86
- TerraformEnvironment(config_provider).generate(name, terraform_platform_modules_version)
97
+
98
+ try:
99
+ config_provider = ConfigProvider(ConfigValidator())
100
+ TerraformEnvironment(config_provider).generate(name, terraform_platform_modules_version)
101
+ except PlatformException as err:
102
+ ClickIOProvider().abort_with_error(str(err))
@@ -0,0 +1,57 @@
1
+ #!/usr/bin/env python
2
+
3
+ import click
4
+
5
+ from dbt_platform_helper.constants import DEFAULT_TERRAFORM_PLATFORM_MODULES_VERSION
6
+ from dbt_platform_helper.domain.config_validator import ConfigValidator
7
+ from dbt_platform_helper.domain.pipelines import Pipelines
8
+ from dbt_platform_helper.providers.config import ConfigProvider
9
+ from dbt_platform_helper.utils.aws import get_codestar_connection_arn
10
+ from dbt_platform_helper.utils.click import ClickDocOptGroup
11
+ from dbt_platform_helper.utils.git import git_remote
12
+ from dbt_platform_helper.utils.versioning import (
13
+ check_platform_helper_version_needs_update,
14
+ )
15
+
16
+
17
+ @click.group(chain=True, cls=ClickDocOptGroup)
18
+ def pipeline():
19
+ """Pipeline commands."""
20
+ check_platform_helper_version_needs_update()
21
+
22
+
23
+ @pipeline.command()
24
+ @click.option(
25
+ "--terraform-platform-modules-version",
26
+ help=f"""Override the default version of terraform-platform-modules with a specific version or branch.
27
+ Precedence of version used is version supplied via CLI, then the version found in
28
+ platform-config.yml/default_versions/terraform-platform-modules.
29
+ In absence of these inputs, defaults to version '{DEFAULT_TERRAFORM_PLATFORM_MODULES_VERSION}'.""",
30
+ )
31
+ @click.option(
32
+ "--deploy-branch",
33
+ help="""Specify the branch of <application>-deploy used to configure the source stage in the environment-pipeline resource.
34
+ This is generated from the terraform/environments-pipeline/<aws_account>/main.tf file.
35
+ (Default <application>-deploy branch is specified in
36
+ <application>-deploy/platform-config.yml/environment_pipelines/<environment-pipeline>/branch).""",
37
+ default=None,
38
+ )
39
+ def generate(terraform_platform_modules_version, deploy_branch):
40
+ """
41
+ Given a platform-config.yml file, generate environment and service
42
+ deployment pipelines.
43
+
44
+ This command does the following in relation to the environment pipelines:
45
+ - Reads contents of `platform-config.yml/environment-pipelines` configuration.
46
+ The `terraform/environment-pipelines/<aws_account>/main.tf` file is generated using this configuration.
47
+ The `main.tf` file is then used to generate Terraform for creating an environment pipeline resource.
48
+
49
+ This command does the following in relation to the codebase pipelines:
50
+ - Generates the copilot pipeline manifest.yml for copilot/pipelines/<codebase_pipeline_name>
51
+ """
52
+ pipelines = Pipelines(
53
+ ConfigProvider(ConfigValidator()),
54
+ git_remote,
55
+ get_codestar_connection_arn,
56
+ )
57
+ pipelines.generate(terraform_platform_modules_version, deploy_branch)
@@ -8,6 +8,7 @@ DEFAULT_TERRAFORM_PLATFORM_MODULES_VERSION = "5"
8
8
  # Keys
9
9
  CODEBASE_PIPELINES_KEY = "codebase_pipelines"
10
10
  ENVIRONMENTS_KEY = "environments"
11
+ ENVIRONMENT_PIPELINES_KEY = "environment_pipelines"
11
12
 
12
13
  # Conduit
13
14
  CONDUIT_ADDON_TYPES = [
@@ -4,12 +4,13 @@ import subprocess
4
4
  from collections.abc import Callable
5
5
  from pathlib import Path
6
6
 
7
- import click
8
7
  import requests
9
8
  import yaml
10
9
  from boto3 import Session
11
10
 
12
11
  from dbt_platform_helper.platform_exception import PlatformException
12
+ from dbt_platform_helper.providers.files import FileProvider
13
+ from dbt_platform_helper.providers.io import ClickIOProvider
13
14
  from dbt_platform_helper.utils.application import Application
14
15
  from dbt_platform_helper.utils.application import ApplicationException
15
16
  from dbt_platform_helper.utils.application import load_application
@@ -19,7 +20,6 @@ from dbt_platform_helper.utils.aws import get_aws_session_or_abort
19
20
  from dbt_platform_helper.utils.aws import get_build_url_from_arn
20
21
  from dbt_platform_helper.utils.aws import list_latest_images
21
22
  from dbt_platform_helper.utils.aws import start_build_extraction
22
- from dbt_platform_helper.utils.files import mkfile
23
23
  from dbt_platform_helper.utils.git import check_if_commit_exists
24
24
  from dbt_platform_helper.utils.template import setup_templates
25
25
 
@@ -27,9 +27,7 @@ from dbt_platform_helper.utils.template import setup_templates
27
27
  class Codebase:
28
28
  def __init__(
29
29
  self,
30
- input: Callable[[str], str] = click.prompt,
31
- echo: Callable[[str], str] = click.secho,
32
- confirm: Callable[[str], bool] = click.confirm,
30
+ io: ClickIOProvider = ClickIOProvider(),
33
31
  load_application: Callable[[str], Application] = load_application,
34
32
  get_aws_session_or_abort: Callable[[str], Session] = get_aws_session_or_abort,
35
33
  check_codebase_exists: Callable[[str], str] = check_codebase_exists,
@@ -40,9 +38,7 @@ class Codebase:
40
38
  check_if_commit_exists: Callable[[str], str] = check_if_commit_exists,
41
39
  run_subprocess: Callable[[str], str] = subprocess.run,
42
40
  ):
43
- self.input = input
44
- self.echo = echo
45
- self.confirm = confirm
41
+ self.io = io
46
42
  self.load_application = load_application
47
43
  self.get_aws_session_or_abort = get_aws_session_or_abort
48
44
  self.check_codebase_exists = check_codebase_exists
@@ -91,8 +87,8 @@ class Codebase:
91
87
  config_contents = templates.get_template(f".copilot/config.yml").render(
92
88
  repository=repository, builder_version=builder_version
93
89
  )
94
- self.echo(
95
- mkfile(
90
+ self.io.info(
91
+ FileProvider.mkfile(
96
92
  Path("."), ".copilot/image_build_run.sh", image_build_run_contents, overwrite=True
97
93
  )
98
94
  )
@@ -100,13 +96,17 @@ class Codebase:
100
96
  image_build_run_file = Path(".copilot/image_build_run.sh")
101
97
  image_build_run_file.chmod(image_build_run_file.stat().st_mode | stat.S_IEXEC)
102
98
 
103
- self.echo(mkfile(Path("."), ".copilot/config.yml", config_contents, overwrite=True))
99
+ self.io.info(
100
+ FileProvider.mkfile(Path("."), ".copilot/config.yml", config_contents, overwrite=True)
101
+ )
104
102
 
105
103
  for phase in ["build", "install", "post_build", "pre_build"]:
106
104
  phase_contents = templates.get_template(f".copilot/phases/{phase}.sh").render()
107
105
 
108
- self.echo(
109
- mkfile(Path("./.copilot"), f"phases/{phase}.sh", phase_contents, overwrite=True)
106
+ self.io.info(
107
+ FileProvider.mkfile(
108
+ Path("./.copilot"), f"phases/{phase}.sh", phase_contents, overwrite=True
109
+ )
110
110
  )
111
111
 
112
112
  def build(self, app: str, codebase: str, commit: str):
@@ -118,7 +118,6 @@ class Codebase:
118
118
 
119
119
  codebuild_client = session.client("codebuild")
120
120
  build_url = self.__start_build_with_confirmation(
121
- self.confirm,
122
121
  codebuild_client,
123
122
  self.get_build_url_from_arn,
124
123
  f'You are about to build "{app}" for "{codebase}" with commit "{commit}". Do you want to continue?',
@@ -130,7 +129,7 @@ class Codebase:
130
129
  )
131
130
 
132
131
  if build_url:
133
- return self.echo(
132
+ return self.io.info(
134
133
  f"Your build has been triggered. Check your build progress in the AWS Console: {build_url}"
135
134
  )
136
135
 
@@ -150,7 +149,6 @@ class Codebase:
150
149
 
151
150
  codebuild_client = session.client("codebuild")
152
151
  build_url = self.__start_build_with_confirmation(
153
- self.confirm,
154
152
  codebuild_client,
155
153
  self.get_build_url_from_arn,
156
154
  f'You are about to deploy "{app}" for "{codebase}" with commit "{commit}" to the "{env}" environment. Do you want to continue?',
@@ -166,7 +164,7 @@ class Codebase:
166
164
  )
167
165
 
168
166
  if build_url:
169
- return self.echo(
167
+ return self.io.info(
170
168
  "Your deployment has been triggered. Check your build progress in the AWS Console: "
171
169
  f"{build_url}",
172
170
  )
@@ -181,19 +179,19 @@ class Codebase:
181
179
  ecr_client = session.client("ecr")
182
180
  codebases = self.__get_codebases(application, ssm_client)
183
181
 
184
- self.echo("The following codebases are available:")
182
+ self.io.info("The following codebases are available:")
185
183
 
186
184
  for codebase in codebases:
187
- self.echo(f"- {codebase['name']} (https://github.com/{codebase['repository']})")
185
+ self.io.info(f"- {codebase['name']} (https://github.com/{codebase['repository']})")
188
186
  if with_images:
189
187
  self.list_latest_images(
190
188
  ecr_client,
191
189
  f"{application.name}/{codebase['name']}",
192
190
  codebase["repository"],
193
- self.echo,
191
+ self.io.info,
194
192
  )
195
193
 
196
- self.echo("")
194
+ self.io.info("")
197
195
 
198
196
  def __get_codebases(self, application, ssm_client):
199
197
  parameters = ssm_client.get_parameters_by_path(
@@ -209,13 +207,12 @@ class Codebase:
209
207
 
210
208
  def __start_build_with_confirmation(
211
209
  self,
212
- confirm,
213
210
  codebuild_client,
214
211
  get_build_url_from_arn,
215
212
  confirmation_message,
216
213
  build_options,
217
214
  ):
218
- if confirm(confirmation_message):
215
+ if self.io.confirm(confirmation_message):
219
216
  build_arn = self.start_build_extraction(codebuild_client, build_options)
220
217
  return get_build_url_from_arn(build_arn)
221
218
  return None
@@ -1,12 +1,10 @@
1
1
  import subprocess
2
- from collections.abc import Callable
3
-
4
- import click
5
2
 
6
3
  from dbt_platform_helper.providers.cloudformation import CloudFormation
7
4
  from dbt_platform_helper.providers.copilot import connect_to_addon_client_task
8
5
  from dbt_platform_helper.providers.copilot import create_addon_client_task
9
6
  from dbt_platform_helper.providers.ecs import ECS
7
+ from dbt_platform_helper.providers.io import ClickIOProvider
10
8
  from dbt_platform_helper.providers.secrets import Secrets
11
9
  from dbt_platform_helper.utils.application import Application
12
10
 
@@ -18,7 +16,7 @@ class Conduit:
18
16
  secrets_provider: Secrets,
19
17
  cloudformation_provider: CloudFormation,
20
18
  ecs_provider: ECS,
21
- echo: Callable[[str], str] = click.secho,
19
+ io: ClickIOProvider = ClickIOProvider(),
22
20
  subprocess: subprocess = subprocess,
23
21
  connect_to_addon_client_task=connect_to_addon_client_task,
24
22
  create_addon_client_task=create_addon_client_task,
@@ -29,7 +27,7 @@ class Conduit:
29
27
  self.cloudformation_provider = cloudformation_provider
30
28
  self.ecs_provider = ecs_provider
31
29
  self.subprocess = subprocess
32
- self.echo = echo
30
+ self.io = io
33
31
  self.connect_to_addon_client_task = connect_to_addon_client_task
34
32
  self.create_addon_client_task = create_addon_client_task
35
33
 
@@ -39,10 +37,10 @@ class Conduit:
39
37
  addon_name, access
40
38
  )
41
39
 
42
- self.echo(f"Checking if a conduit task is already running for {addon_type}")
40
+ self.io.info(f"Checking if a conduit task is already running for {addon_type}")
43
41
  task_arns = self.ecs_provider.get_ecs_task_arns(cluster_arn, task_name)
44
42
  if not task_arns:
45
- self.echo("Creating conduit task")
43
+ self.io.info("Creating conduit task")
46
44
  self.create_addon_client_task(
47
45
  clients["iam"],
48
46
  clients["ssm"],
@@ -55,7 +53,7 @@ class Conduit:
55
53
  access,
56
54
  )
57
55
 
58
- self.echo("Updating conduit task")
56
+ self.io.info("Updating conduit task")
59
57
  self._update_stack_resources(
60
58
  self.application.name,
61
59
  env,
@@ -69,13 +67,13 @@ class Conduit:
69
67
  task_arns = self.ecs_provider.get_ecs_task_arns(cluster_arn, task_name)
70
68
 
71
69
  else:
72
- self.echo("Conduit task already running")
70
+ self.io.info("Conduit task already running")
73
71
 
74
- self.echo(f"Checking if exec is available for conduit task...")
72
+ self.io.info(f"Checking if exec is available for conduit task...")
75
73
 
76
74
  self.ecs_provider.ecs_exec_is_available(cluster_arn, task_arns)
77
75
 
78
- self.echo("Connecting to conduit task")
76
+ self.io.info("Connecting to conduit task")
79
77
  self.connect_to_addon_client_task(
80
78
  clients["ecs"], self.subprocess, self.application.name, env, cluster_arn, task_name
81
79
  )
@@ -115,7 +113,7 @@ class Conduit:
115
113
  parameter_name,
116
114
  access,
117
115
  )
118
- self.echo("Waiting for conduit task update to complete...")
116
+ self.io.info("Waiting for conduit task update to complete...")
119
117
  self.cloudformation_provider.wait_for_cloudformation_to_reach_status(
120
118
  "stack_update_complete", stack_name
121
119
  )