dbt-platform-helper 13.4.0__py3-none-any.whl → 14.0.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 (46) hide show
  1. dbt_platform_helper/COMMANDS.md +26 -57
  2. dbt_platform_helper/commands/config.py +9 -0
  3. dbt_platform_helper/commands/environment.py +3 -7
  4. dbt_platform_helper/commands/notify.py +24 -77
  5. dbt_platform_helper/commands/pipeline.py +6 -12
  6. dbt_platform_helper/commands/secrets.py +1 -1
  7. dbt_platform_helper/constants.py +7 -5
  8. dbt_platform_helper/domain/codebase.py +0 -5
  9. dbt_platform_helper/domain/config.py +16 -9
  10. dbt_platform_helper/domain/copilot_environment.py +3 -3
  11. dbt_platform_helper/domain/database_copy.py +1 -1
  12. dbt_platform_helper/domain/maintenance_page.py +42 -38
  13. dbt_platform_helper/domain/notify.py +64 -0
  14. dbt_platform_helper/domain/pipelines.py +20 -16
  15. dbt_platform_helper/domain/terraform_environment.py +18 -11
  16. dbt_platform_helper/domain/versioning.py +18 -78
  17. dbt_platform_helper/providers/aws/exceptions.py +1 -1
  18. dbt_platform_helper/providers/cloudformation.py +1 -1
  19. dbt_platform_helper/providers/config.py +119 -17
  20. dbt_platform_helper/providers/config_validator.py +4 -31
  21. dbt_platform_helper/providers/copilot.py +3 -3
  22. dbt_platform_helper/providers/io.py +1 -1
  23. dbt_platform_helper/providers/load_balancers.py +6 -6
  24. dbt_platform_helper/providers/platform_config_schema.py +24 -29
  25. dbt_platform_helper/providers/schema_migrations/__init__.py +0 -0
  26. dbt_platform_helper/providers/schema_migrations/schema_v0_to_v1_migration.py +43 -0
  27. dbt_platform_helper/providers/schema_migrator.py +77 -0
  28. dbt_platform_helper/providers/secrets.py +5 -5
  29. dbt_platform_helper/providers/semantic_version.py +6 -1
  30. dbt_platform_helper/providers/slack_channel_notifier.py +62 -0
  31. dbt_platform_helper/providers/terraform_manifest.py +8 -10
  32. dbt_platform_helper/providers/version.py +1 -18
  33. dbt_platform_helper/providers/version_status.py +8 -61
  34. dbt_platform_helper/providers/yaml_file.py +23 -1
  35. dbt_platform_helper/templates/environment-pipelines/main.tf +1 -1
  36. dbt_platform_helper/utils/application.py +1 -1
  37. dbt_platform_helper/utils/aws.py +3 -3
  38. dbt_platform_helper/utils/git.py +0 -15
  39. {dbt_platform_helper-13.4.0.dist-info → dbt_platform_helper-14.0.0.dist-info}/METADATA +4 -4
  40. {dbt_platform_helper-13.4.0.dist-info → dbt_platform_helper-14.0.0.dist-info}/RECORD +44 -41
  41. platform_helper.py +0 -2
  42. dbt_platform_helper/commands/version.py +0 -37
  43. dbt_platform_helper/utils/tool_versioning.py +0 -12
  44. {dbt_platform_helper-13.4.0.dist-info → dbt_platform_helper-14.0.0.dist-info}/LICENSE +0 -0
  45. {dbt_platform_helper-13.4.0.dist-info → dbt_platform_helper-14.0.0.dist-info}/WHEEL +0 -0
  46. {dbt_platform_helper-13.4.0.dist-info → dbt_platform_helper-14.0.0.dist-info}/entry_points.txt +0 -0
@@ -12,6 +12,7 @@
12
12
  - [platform-helper conduit](#platform-helper-conduit)
13
13
  - [platform-helper config](#platform-helper-config)
14
14
  - [platform-helper config validate](#platform-helper-config-validate)
15
+ - [platform-helper config migrate](#platform-helper-config-migrate)
15
16
  - [platform-helper config aws](#platform-helper-config-aws)
16
17
  - [platform-helper copilot](#platform-helper-copilot)
17
18
  - [platform-helper copilot make-addons](#platform-helper-copilot-make-addons)
@@ -33,8 +34,6 @@
33
34
  - [platform-helper database dump](#platform-helper-database-dump)
34
35
  - [platform-helper database load](#platform-helper-database-load)
35
36
  - [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
37
 
39
38
  # platform-helper
40
39
 
@@ -64,7 +63,6 @@ platform-helper <command> [--version]
64
63
  - [`notify` ↪](#platform-helper-notify)
65
64
  - [`pipeline` ↪](#platform-helper-pipeline)
66
65
  - [`secrets` ↪](#platform-helper-secrets)
67
- - [`version` ↪](#platform-helper-version)
68
66
 
69
67
  # platform-helper application
70
68
 
@@ -295,7 +293,7 @@ platform-helper conduit <addon_name>
295
293
  ## Usage
296
294
 
297
295
  ```
298
- platform-helper config (validate|aws)
296
+ platform-helper config (validate|migrate|aws)
299
297
  ```
300
298
 
301
299
  ## Options
@@ -306,6 +304,7 @@ platform-helper config (validate|aws)
306
304
  ## Commands
307
305
 
308
306
  - [`aws` ↪](#platform-helper-config-aws)
307
+ - [`migrate` ↪](#platform-helper-config-migrate)
309
308
  - [`validate` ↪](#platform-helper-config-validate)
310
309
 
311
310
  # platform-helper config validate
@@ -322,6 +321,23 @@ platform-helper config validate
322
321
 
323
322
  ## Options
324
323
 
324
+ - `--help <boolean>` _Defaults to False._
325
+ - Show this message and exit.
326
+
327
+ # platform-helper config migrate
328
+
329
+ [↩ Parent](#platform-helper-config)
330
+
331
+ Update configuration to match current schema.
332
+
333
+ ## Usage
334
+
335
+ ```
336
+ platform-helper config migrate
337
+ ```
338
+
339
+ ## Options
340
+
325
341
  - `--help <boolean>` _Defaults to False._
326
342
  - Show this message and exit.
327
343
 
@@ -488,7 +504,7 @@ platform-helper environment generate --name <name>
488
504
  ## Usage
489
505
 
490
506
  ```
491
- platform-helper environment generate-terraform --name <name> [--terraform-platform-modules-version <terraform_platform_modules_version>]
507
+ platform-helper environment generate-terraform --name <name>
492
508
  ```
493
509
 
494
510
  ## Options
@@ -496,8 +512,6 @@ platform-helper environment generate-terraform --name <name> [--terraform-platfo
496
512
  - `--name
497
513
  -n <text>`
498
514
  - The name of the environment to generate a manifest for.
499
- - `--terraform-platform-modules-version <text>`
500
- - Override the default version of terraform-platform-modules. (Default version is '7').
501
515
  - `--help <boolean>` _Defaults to False._
502
516
  - Show this message and exit.
503
517
 
@@ -550,27 +564,23 @@ platform-helper pipeline generate
550
564
  deployment pipelines.
551
565
 
552
566
  This command does the following in relation to the environment pipelines:
553
- - Reads contents of `platform-config.yml/environment-pipelines` configuration.
567
+ - Reads contents of `platform-config.yml/environment_pipelines` configuration.
554
568
  The `terraform/environment-pipelines/<aws_account>/main.tf` file is generated using this configuration.
555
569
  The `main.tf` file is then used to generate Terraform for creating an environment pipeline resource.
556
570
 
557
571
  This command does the following in relation to the codebase pipelines:
558
- - Generates the copilot pipeline manifest.yml for copilot/pipelines/<codebase_pipeline_name>
572
+ - Reads contents of `platform-config.yml/codebase_pipelines` configuration.
573
+ The `terraform/codebase-pipelines/main.tf.json` file is generated using this configuration.
574
+ The `main.tf.json` file is then used to generate Terraform for creating a codebase pipeline resource.
559
575
 
560
576
  ## Usage
561
577
 
562
578
  ```
563
- platform-helper pipeline generate [--terraform-platform-modules-version <terraform_platform_modules_version>]
564
- [--deploy-branch <deploy_branch>]
579
+ platform-helper pipeline generate [--deploy-branch <deploy_branch>]
565
580
  ```
566
581
 
567
582
  ## Options
568
583
 
569
- - `--terraform-platform-modules-version <text>`
570
- - Override the default version of terraform-platform-modules with a specific version or branch.
571
- Precedence of version used is version supplied via CLI, then the version found in
572
- platform-config.yml/default_versions/terraform-platform-modules.
573
- In absence of these inputs, defaults to version '7'.
574
584
  - `--deploy-branch <text>`
575
585
  - Specify the branch of <application>-deploy used to configure the source stage in the environment-pipeline resource.
576
586
  This is generated from the terraform/environments-pipeline/<aws_account>/main.tf file.
@@ -856,44 +866,3 @@ platform-helper database copy --from <from_env> --to <to_env> --database <databa
856
866
 
857
867
  - `--help <boolean>` _Defaults to False._
858
868
  - Show this message and exit.
859
-
860
- # platform-helper version
861
-
862
- [↩ Parent](#platform-helper)
863
-
864
- Contains subcommands for getting version information about the current
865
- project.
866
-
867
- ## Usage
868
-
869
- ```
870
- platform-helper version get-platform-helper-for-project
871
- ```
872
-
873
- ## Options
874
-
875
- - `--help <boolean>` _Defaults to False._
876
- - Show this message and exit.
877
-
878
- ## Commands
879
-
880
- - [`get-platform-helper-for-project` ↪](#platform-helper-version-get-platform-helper-for-project)
881
-
882
- # platform-helper version get-platform-helper-for-project
883
-
884
- [↩ Parent](#platform-helper-version)
885
-
886
- Print the version of platform-tools required by the current project
887
-
888
- ## Usage
889
-
890
- ```
891
- platform-helper version get-platform-helper-for-project [--pipeline <pipeline>]
892
- ```
893
-
894
- ## Options
895
-
896
- - `--pipeline <text>`
897
- - Take into account platform-tools version overrides in the specified pipeline
898
- - `--help <boolean>` _Defaults to False._
899
- - Show this message and exit.
@@ -22,6 +22,15 @@ def validate():
22
22
  ClickIOProvider().abort_with_error(str(err))
23
23
 
24
24
 
25
+ @config.command()
26
+ def migrate():
27
+ """Update configuration to match current schema."""
28
+ try:
29
+ Config().migrate()
30
+ except PlatformException as err:
31
+ ClickIOProvider().abort_with_error(str(err))
32
+
33
+
25
34
  @config.command()
26
35
  @click.option("--file-path", "-fp", default="~/.aws/config")
27
36
  def aws(file_path):
@@ -1,6 +1,5 @@
1
1
  import click
2
2
 
3
- from dbt_platform_helper.constants import DEFAULT_TERRAFORM_PLATFORM_MODULES_VERSION
4
3
  from dbt_platform_helper.domain.copilot_environment import CopilotEnvironment
5
4
  from dbt_platform_helper.domain.maintenance_page import MaintenancePage
6
5
  from dbt_platform_helper.domain.terraform_environment import TerraformEnvironment
@@ -87,15 +86,12 @@ def generate(name):
87
86
  @click.option(
88
87
  "--name", "-n", required=True, help="The name of the environment to generate a manifest for."
89
88
  )
90
- @click.option(
91
- "--terraform-platform-modules-version",
92
- help=f"Override the default version of terraform-platform-modules. (Default version is '{DEFAULT_TERRAFORM_PLATFORM_MODULES_VERSION}').",
93
- )
94
- def generate_terraform(name, terraform_platform_modules_version):
89
+ def generate_terraform(name):
95
90
  click_io = ClickIOProvider()
96
91
  try:
97
92
  session = get_aws_session_or_abort()
98
93
  config_provider = ConfigProvider(ConfigValidator(session=session))
99
- TerraformEnvironment(config_provider).generate(name, terraform_platform_modules_version)
94
+ TerraformEnvironment(config_provider).generate(name)
95
+
100
96
  except PlatformException as err:
101
97
  click_io.abort_with_error(str(err))
@@ -1,9 +1,10 @@
1
1
  import click
2
- from slack_sdk import WebClient
3
- from slack_sdk.models import blocks
4
2
 
3
+ from dbt_platform_helper.domain.notify import Notify
5
4
  from dbt_platform_helper.domain.versioning import PlatformHelperVersioning
6
- from dbt_platform_helper.utils.arn_parser import ARN
5
+ from dbt_platform_helper.platform_exception import PlatformException
6
+ from dbt_platform_helper.providers.io import ClickIOProvider
7
+ from dbt_platform_helper.providers.slack_channel_notifier import SlackChannelNotifier
7
8
  from dbt_platform_helper.utils.click import ClickDocOptGroup
8
9
 
9
10
 
@@ -31,56 +32,20 @@ def environment_progress(
31
32
  commit_sha: str,
32
33
  slack_ref: str,
33
34
  ):
34
- args = _get_slack_args(build_arn, commit_sha, message, repository, slack_channel_id)
35
- slack = _get_slack_client(slack_token)
36
-
37
- if slack_ref:
38
- response = slack.chat_update(ts=slack_ref, **args)
39
- else:
40
- response = slack.chat_postMessage(ts=slack_ref, **args)
41
-
42
- print(response["ts"])
43
-
44
-
45
- def _get_slack_args(
46
- build_arn: str, commit_sha: str, message: str, repository: str, slack_channel_id: str
47
- ):
48
- context_elements = []
49
- if repository:
50
- context_elements.append(f"*Repository*: <https://github.com/{repository}|{repository}>")
51
- if commit_sha:
52
- context_elements.append(
53
- f"*Revision*: <https://github.com/{repository}/commit/{commit_sha}|{commit_sha}>"
54
- )
55
- if build_arn:
56
- context_elements.append(f"<{get_build_url(build_arn)}|Build Logs>")
57
- message_blocks = [
58
- blocks.SectionBlock(
59
- text=blocks.TextObject(type="mrkdwn", text=message),
60
- ),
61
- ]
62
-
63
- if context_elements:
64
- message_blocks.append(
65
- blocks.ContextBlock(
66
- elements=[
67
- blocks.TextObject(type="mrkdwn", text=element) for element in context_elements
68
- ]
69
- )
35
+ try:
36
+ io = ClickIOProvider()
37
+ slack_notifier = SlackChannelNotifier(slack_token, slack_channel_id)
38
+ result = Notify(slack_notifier).environment_progress(
39
+ original_message_ref=slack_ref,
40
+ message=message,
41
+ build_arn=build_arn,
42
+ repository=repository,
43
+ commit_sha=commit_sha,
70
44
  )
71
45
 
72
- args = {
73
- "channel": slack_channel_id,
74
- "blocks": message_blocks,
75
- "text": message,
76
- "unfurl_links": False,
77
- "unfurl_media": False,
78
- }
79
- return args
80
-
81
-
82
- def _get_slack_client(token: str):
83
- return WebClient(token=token)
46
+ io.info(result)
47
+ except PlatformException as err:
48
+ io.abort_with_error(str(err))
84
49
 
85
50
 
86
51
  @notify.command(help="Add a comment to an existing Slack message")
@@ -98,31 +63,13 @@ def add_comment(
98
63
  title: str,
99
64
  send_to_main_channel: bool,
100
65
  ):
101
- slack = _get_slack_client(slack_token)
102
-
103
- slack.chat_postMessage(
104
- channel=slack_channel_id,
105
- blocks=[blocks.SectionBlock(text=blocks.TextObject(type="mrkdwn", text=message))],
106
- text=title if title else message,
107
- reply_broadcast=send_to_main_channel,
108
- unfurl_links=False,
109
- unfurl_media=False,
110
- thread_ts=slack_ref,
111
- )
112
-
113
-
114
- def get_build_url(build_arn: str):
115
66
  try:
116
- arn = ARN(build_arn)
117
- url = (
118
- "https://{region}.console.aws.amazon.com/codesuite/codebuild/{account}/projects/{"
119
- "project}/build/{project}%3A{build_id}"
120
- )
121
- return url.format(
122
- region=arn.region,
123
- account=arn.account_id,
124
- project=arn.project.replace("build/", ""),
125
- build_id=arn.build_id,
67
+ slack_notifier = SlackChannelNotifier(slack_token, slack_channel_id)
68
+ Notify(slack_notifier).add_comment(
69
+ message=message,
70
+ title=title,
71
+ reply_broadcast=send_to_main_channel,
72
+ original_message_ref=slack_ref,
126
73
  )
127
- except ValueError:
128
- return ""
74
+ except PlatformException as err:
75
+ ClickIOProvider().abort_with_error(str(err))
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env python
2
2
  import click
3
3
 
4
- from dbt_platform_helper.constants import DEFAULT_TERRAFORM_PLATFORM_MODULES_VERSION
5
4
  from dbt_platform_helper.domain.pipelines import Pipelines
6
5
  from dbt_platform_helper.domain.versioning import PlatformHelperVersioning
7
6
  from dbt_platform_helper.providers.config import ConfigProvider
@@ -21,13 +20,6 @@ def pipeline():
21
20
 
22
21
 
23
22
  @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
23
  @click.option(
32
24
  "--deploy-branch",
33
25
  help="""Specify the branch of <application>-deploy used to configure the source stage in the environment-pipeline resource.
@@ -36,18 +28,20 @@ def pipeline():
36
28
  <application>-deploy/platform-config.yml/environment_pipelines/<environment-pipeline>/branch).""",
37
29
  default=None,
38
30
  )
39
- def generate(terraform_platform_modules_version: str, deploy_branch: str):
31
+ def generate(deploy_branch: str):
40
32
  """
41
33
  Given a platform-config.yml file, generate environment and service
42
34
  deployment pipelines.
43
35
 
44
36
  This command does the following in relation to the environment pipelines:
45
- - Reads contents of `platform-config.yml/environment-pipelines` configuration.
37
+ - Reads contents of `platform-config.yml/environment_pipelines` configuration.
46
38
  The `terraform/environment-pipelines/<aws_account>/main.tf` file is generated using this configuration.
47
39
  The `main.tf` file is then used to generate Terraform for creating an environment pipeline resource.
48
40
 
49
41
  This command does the following in relation to the codebase pipelines:
50
- - Generates the copilot pipeline manifest.yml for copilot/pipelines/<codebase_pipeline_name>
42
+ - Reads contents of `platform-config.yml/codebase_pipelines` configuration.
43
+ The `terraform/codebase-pipelines/main.tf.json` file is generated using this configuration.
44
+ The `main.tf.json` file is then used to generate Terraform for creating a codebase pipeline resource.
51
45
  """
52
46
  io = ClickIOProvider()
53
47
  try:
@@ -59,6 +53,6 @@ def generate(terraform_platform_modules_version: str, deploy_branch: str):
59
53
  get_codestar_connection_arn,
60
54
  io,
61
55
  )
62
- pipelines.generate(terraform_platform_modules_version, deploy_branch)
56
+ pipelines.generate(deploy_branch)
63
57
  except Exception as exc:
64
58
  io.abort_with_error(str(exc))
@@ -111,7 +111,7 @@ def list(app, env):
111
111
  else:
112
112
  break
113
113
 
114
- # Todo: When we refactor this, the above could probably just use dbt_platform_helper.utils.aws.get_ssm_secret_names so we would end up with print("\n".join(get_ssm_secret_names(app, env)))
114
+ # TODO: DBTP-1953: When we refactor this, the above could probably just use dbt_platform_helper.utils.aws.get_ssm_secret_names so we would end up with print("\n".join(get_ssm_secret_names(app, env)))
115
115
  print("\n".join(sorted(secrets)))
116
116
 
117
117
 
@@ -1,11 +1,13 @@
1
- # Todo: Move to Config provider
1
+ # TODO: DBTP-1888: Move to Config provider
2
2
  PLATFORM_CONFIG_FILE = "platform-config.yml"
3
- # Todo: Can we get rid of this yet?
4
- PLATFORM_HELPER_VERSION_FILE = ".platform-helper-version"
5
- # Todo: Move to ???
6
- DEFAULT_TERRAFORM_PLATFORM_MODULES_VERSION = "7"
3
+ PLATFORM_HELPER_VERSION_OVERRIDE_KEY = "PLATFORM_HELPER_VERSION_OVERRIDE"
4
+ PLATFORM_HELPER_PACKAGE_NAME = "dbt-platform-helper"
7
5
  SUPPORTED_TERRAFORM_VERSION = "~> 1.8"
8
6
  SUPPORTED_AWS_PROVIDER_VERSION = "~> 5"
7
+ FIRST_UPGRADABLE_PLATFORM_HELPER_MAJOR_VERSION = 13
8
+
9
+ MERGED_TPM_PLATFORM_HELPER_VERSION = 14
10
+ PLATFORM_CONFIG_SCHEMA_VERSION = 1
9
11
 
10
12
  # Keys
11
13
  CODEBASE_PIPELINES_KEY = "codebase_pipelines"
@@ -27,7 +27,6 @@ from dbt_platform_helper.utils.aws import get_manual_release_pipeline
27
27
  from dbt_platform_helper.utils.aws import list_latest_images
28
28
  from dbt_platform_helper.utils.aws import start_build_extraction
29
29
  from dbt_platform_helper.utils.aws import start_pipeline_and_return_execution_id
30
- from dbt_platform_helper.utils.git import check_if_commit_exists
31
30
  from dbt_platform_helper.utils.template import setup_templates
32
31
 
33
32
 
@@ -50,7 +49,6 @@ class Codebase:
50
49
  start_pipeline_and_return_execution_id: Callable[
51
50
  [str], str
52
51
  ] = start_pipeline_and_return_execution_id,
53
- check_if_commit_exists: Callable[[str], str] = check_if_commit_exists,
54
52
  run_subprocess: Callable[[str], str] = subprocess.run,
55
53
  ):
56
54
  self.parameter_provider = parameter_provider
@@ -65,7 +63,6 @@ class Codebase:
65
63
  self.list_latest_images = list_latest_images
66
64
  self.start_build_extraction = start_build_extraction
67
65
  self.start_pipeline_and_return_execution_id = start_pipeline_and_return_execution_id
68
- self.check_if_commit_exists = check_if_commit_exists
69
66
  self.run_subprocess = run_subprocess
70
67
 
71
68
  def prepare(self):
@@ -133,8 +130,6 @@ class Codebase:
133
130
  session = self.get_aws_session_or_abort()
134
131
  self.load_application(app, default_session=session)
135
132
 
136
- self.check_if_commit_exists(commit)
137
-
138
133
  codebuild_client = session.client("codebuild")
139
134
  project_name = self.get_image_build_project(codebuild_client, app, codebase)
140
135
  build_url = self.__start_build_with_confirmation(
@@ -12,13 +12,15 @@ from dbt_platform_helper.domain.versioning import CopilotVersioning
12
12
  from dbt_platform_helper.domain.versioning import PlatformHelperVersioning
13
13
  from dbt_platform_helper.platform_exception import PlatformException
14
14
  from dbt_platform_helper.providers.aws.sso_auth import SSOAuthProvider
15
+ from dbt_platform_helper.providers.config import ConfigProvider
15
16
  from dbt_platform_helper.providers.io import ClickIOProvider
17
+ from dbt_platform_helper.providers.schema_migrator import ALL_MIGRATIONS
18
+ from dbt_platform_helper.providers.schema_migrator import Migrator
16
19
  from dbt_platform_helper.providers.semantic_version import (
17
20
  IncompatibleMajorVersionException,
18
21
  )
19
22
  from dbt_platform_helper.providers.semantic_version import SemanticVersion
20
23
  from dbt_platform_helper.providers.validation import ValidationException
21
- from dbt_platform_helper.providers.version_status import PlatformHelperVersionStatus
22
24
  from dbt_platform_helper.providers.version_status import VersionStatus
23
25
 
24
26
  yes = "\033[92m✔\033[0m"
@@ -61,7 +63,7 @@ class NoDeploymentRepoConfigException(PlatformException):
61
63
  super().__init__("Could not find a deployment repository, no checks to run.")
62
64
 
63
65
 
64
- # TODO move to generic location so it can be reused
66
+ # TODO: DBTP-1993: move to generic location so it can be reused
65
67
  class NoPlatformConfigException(PlatformException):
66
68
  def __init__(self):
67
69
  super().__init__(
@@ -71,7 +73,6 @@ class NoPlatformConfigException(PlatformException):
71
73
 
72
74
 
73
75
  class Config:
74
-
75
76
  def __init__(
76
77
  self,
77
78
  io: ClickIOProvider = ClickIOProvider(),
@@ -79,6 +80,8 @@ class Config:
79
80
  aws_versioning: AWSVersioning = AWSVersioning(),
80
81
  copilot_versioning: CopilotVersioning = CopilotVersioning(),
81
82
  sso: SSOAuthProvider = None,
83
+ config_provider: ConfigProvider = ConfigProvider(),
84
+ migrator: Migrator = Migrator(ALL_MIGRATIONS, io_provider=ClickIOProvider()),
82
85
  ):
83
86
  self.oidc_app = None
84
87
  self.io = io
@@ -87,6 +90,8 @@ class Config:
87
90
  self.copilot_versioning = copilot_versioning
88
91
  self.sso = sso or SSOAuthProvider()
89
92
  self.SSO_START_URL = "https://uktrade.awsapps.com/start"
93
+ self.config_provider = config_provider
94
+ self.migrator = migrator
90
95
 
91
96
  def validate(self):
92
97
  if not Path("copilot").exists():
@@ -95,10 +100,7 @@ class Config:
95
100
  raise NoPlatformConfigException()
96
101
 
97
102
  self.io.debug("\nDetected a deployment repository\n")
98
- platform_helper_version_status = self.platform_helper_versioning._get_version_status(
99
- include_project_versions=True
100
- )
101
- self.io.process_messages(platform_helper_version_status.validate())
103
+ platform_helper_version_status = self.platform_helper_versioning.get_version_status()
102
104
  aws_version_status = self.aws_versioning.get_version_status()
103
105
  copilot_version_status = self.copilot_versioning.get_version_status()
104
106
 
@@ -110,6 +112,11 @@ class Config:
110
112
 
111
113
  exit(0 if compatible else 1)
112
114
 
115
+ def migrate(self):
116
+ platform_config = self.config_provider.load_unvalidated_config_file()
117
+ new_platform_config = self.migrator.migrate(platform_config)
118
+ self.config_provider.write_platform_config(new_platform_config)
119
+
113
120
  def generate_aws(self, file_path):
114
121
  self.oidc_app = self._create_oidc_application()
115
122
  verification_url, device_code = self._get_device_code(self.oidc_app)
@@ -184,7 +191,7 @@ class Config:
184
191
 
185
192
  def _check_tool_versions(
186
193
  self,
187
- platform_helper_version_status: PlatformHelperVersionStatus,
194
+ platform_helper_version_status: VersionStatus,
188
195
  aws_version_status: VersionStatus,
189
196
  copilot_version_status: VersionStatus,
190
197
  ):
@@ -237,7 +244,7 @@ class Config:
237
244
 
238
245
  self._render_recommendations(recommendations)
239
246
 
240
- def _check_addon_versions(self, platform_helper_versions: PlatformHelperVersionStatus) -> bool:
247
+ def _check_addon_versions(self, platform_helper_versions: VersionStatus) -> bool:
241
248
 
242
249
  self.io.debug("Checking addons templates versions...")
243
250
 
@@ -25,7 +25,7 @@ class CopilotEnvironment:
25
25
  config_provider: ConfigProvider,
26
26
  vpc_provider: VpcProvider = None,
27
27
  cloudformation_provider: CloudFormation = None,
28
- session: Session = None, # TODO - this is a temporary fix, will fall away once _get_environment_vpc is updated.
28
+ session: Session = None, # TODO: DBTP-1954: - this is a temporary fix, will fall away once _get_environment_vpc is updated.
29
29
  copilot_templating=None,
30
30
  io: ClickIOProvider = ClickIOProvider(),
31
31
  load_balancer_provider: LoadBalancerProvider = LoadBalancerProvider,
@@ -77,7 +77,7 @@ class CopilotEnvironment:
77
77
  )
78
78
  )
79
79
 
80
- # TODO: There should always be a vpc_name as defaults have been applied to the config. This function can
80
+ # TODO: DBTP-1954: There should always be a vpc_name as defaults have been applied to the config. This function can
81
81
  # probably fall away. We shouldn't need to check 3 different names (vpc_name, session.profile_name, {session.profile_name}-{env_name})
82
82
  # To be checked.
83
83
  def _get_environment_vpc(self, session: Session, app_name, env_name: str, vpc_name: str) -> Vpc:
@@ -134,7 +134,7 @@ class CopilotTemplating:
134
134
  self,
135
135
  file_provider: FileProvider = FileProvider(),
136
136
  io: ClickIOProvider = ClickIOProvider(),
137
- # TODO file_provider can be moved up a layer. File writing can be the responsibility of CopilotEnvironment generate
137
+ # TODO: DBTP-1958: file_provider can be moved up a layer. File writing can be the responsibility of CopilotEnvironment generate
138
138
  # Or we align with PlatformTerraformManifestGenerator and rename from Templating to reflect the file writing responsibility
139
139
  ):
140
140
  self.file_provider = file_provider
@@ -28,7 +28,7 @@ class DatabaseCopy:
28
28
  database: str,
29
29
  auto_approve: bool = False,
30
30
  load_application: Callable[[str], Application] = load_application,
31
- # TODO We inject VpcProvider as a callable here so that it can be instantiated within the method. To be improved
31
+ # TODO: DBTP-1960: We inject VpcProvider as a callable here so that it can be instantiated within the method. To be improved
32
32
  vpc_provider: Callable[[Session], VpcProvider] = VpcProvider,
33
33
  db_connection_string: Callable[
34
34
  [Session, str, str, str, Callable], str