dbt-platform-helper 15.4.1__tar.gz → 15.5.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 (107) hide show
  1. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/PKG-INFO +1 -1
  2. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/commands/conduit.py +1 -1
  3. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/domain/database_copy.py +1 -1
  4. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/entities/platform_config_schema.py +6 -0
  5. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/utils/application.py +52 -19
  6. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/pyproject.toml +1 -1
  7. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/LICENSE +0 -0
  8. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/COMMANDS.md +0 -0
  9. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/README.md +0 -0
  10. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/__init__.py +0 -0
  11. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/commands/__init__.py +0 -0
  12. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/commands/application.py +0 -0
  13. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/commands/codebase.py +0 -0
  14. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/commands/config.py +0 -0
  15. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/commands/copilot.py +0 -0
  16. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/commands/database.py +0 -0
  17. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/commands/environment.py +0 -0
  18. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/commands/generate.py +0 -0
  19. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/commands/notify.py +0 -0
  20. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/commands/pipeline.py +0 -0
  21. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/commands/secrets.py +0 -0
  22. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/commands/version.py +0 -0
  23. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/constants.py +0 -0
  24. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/default-extensions.yml +0 -0
  25. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/domain/__init__.py +0 -0
  26. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/domain/codebase.py +0 -0
  27. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/domain/conduit.py +0 -0
  28. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/domain/config.py +0 -0
  29. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/domain/copilot.py +0 -0
  30. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/domain/copilot_environment.py +0 -0
  31. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/domain/maintenance_page.py +0 -0
  32. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/domain/notify.py +0 -0
  33. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/domain/pipelines.py +0 -0
  34. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/domain/plans.py +0 -0
  35. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/domain/terraform_environment.py +0 -0
  36. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/domain/versioning.py +0 -0
  37. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/entities/semantic_version.py +0 -0
  38. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/jinja2_tags.py +0 -0
  39. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/platform_exception.py +0 -0
  40. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/providers/__init__.py +0 -0
  41. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/providers/aws/__init__.py +0 -0
  42. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/providers/aws/exceptions.py +0 -0
  43. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/providers/aws/interfaces.py +0 -0
  44. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/providers/aws/opensearch.py +0 -0
  45. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/providers/aws/redis.py +0 -0
  46. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/providers/aws/sso_auth.py +0 -0
  47. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/providers/cache.py +0 -0
  48. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/providers/cloudformation.py +0 -0
  49. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/providers/config.py +0 -0
  50. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/providers/config_validator.py +0 -0
  51. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/providers/copilot.py +0 -0
  52. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/providers/ecr.py +0 -0
  53. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/providers/ecs.py +0 -0
  54. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/providers/environment_variable.py +0 -0
  55. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/providers/files.py +0 -0
  56. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/providers/io.py +0 -0
  57. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/providers/kms.py +0 -0
  58. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/providers/load_balancers.py +0 -0
  59. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/providers/parameter_store.py +0 -0
  60. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/providers/schema_migrations/__init__.py +0 -0
  61. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/providers/schema_migrations/schema_v0_to_v1_migration.py +0 -0
  62. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/providers/schema_migrator.py +0 -0
  63. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/providers/secrets.py +0 -0
  64. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/providers/slack_channel_notifier.py +0 -0
  65. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/providers/terraform_manifest.py +0 -0
  66. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/providers/validation.py +0 -0
  67. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/providers/version.py +0 -0
  68. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/providers/version_status.py +0 -0
  69. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/providers/vpc.py +0 -0
  70. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/providers/yaml_file.py +0 -0
  71. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/templates/.copilot/config.yml +0 -0
  72. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/templates/.copilot/image_build_run.sh +0 -0
  73. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/templates/.copilot/phases/build.sh +0 -0
  74. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/templates/.copilot/phases/install.sh +0 -0
  75. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/templates/.copilot/phases/post_build.sh +0 -0
  76. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/templates/.copilot/phases/pre_build.sh +0 -0
  77. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/templates/COMMANDS.md.jinja +0 -0
  78. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/templates/addon-instructions.txt +0 -0
  79. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/templates/addons/README.md +0 -0
  80. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/templates/addons/svc/appconfig-ipfilter.yml +0 -0
  81. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/templates/addons/svc/prometheus-policy.yml +0 -0
  82. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/templates/addons/svc/s3-cross-account-policy.yml +0 -0
  83. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/templates/addons/svc/s3-policy.yml +0 -0
  84. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/templates/addons/svc/subscription-filter.yml +0 -0
  85. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/templates/ci-codebuild-role-policy.json +0 -0
  86. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/templates/create-codebuild-role.json +0 -0
  87. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/templates/custom-codebuild-role-policy.json +0 -0
  88. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/templates/env/manifest.yml +0 -0
  89. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/templates/env/terraform-overrides/cfn.patches.yml +0 -0
  90. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/templates/environment-pipelines/main.tf +0 -0
  91. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/templates/svc/maintenance_pages/default.html +0 -0
  92. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/templates/svc/maintenance_pages/dmas-migration.html +0 -0
  93. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/templates/svc/maintenance_pages/migration.html +0 -0
  94. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/templates/svc/overrides/cfn.patches.yml +0 -0
  95. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/utilities/decorators.py +0 -0
  96. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/utils/__init__.py +0 -0
  97. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/utils/arn_parser.py +0 -0
  98. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/utils/aws.py +0 -0
  99. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/utils/click.py +0 -0
  100. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/utils/git.py +0 -0
  101. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/utils/messages.py +0 -0
  102. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/utils/template.py +0 -0
  103. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/dbt_platform_helper/utils/validation.py +0 -0
  104. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/platform_helper.py +0 -0
  105. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/terraform/elasticache-redis/plans.yml +0 -0
  106. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/terraform/opensearch/plans.yml +0 -0
  107. {dbt_platform_helper-15.4.1 → dbt_platform_helper-15.5.0}/terraform/postgres/plans.yml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: dbt-platform-helper
3
- Version: 15.4.1
3
+ Version: 15.5.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
@@ -27,7 +27,7 @@ def conduit(addon_name: str, app: str, env: str, access: str):
27
27
  """Opens a shell for a given addon_name create a conduit connection to
28
28
  interact with postgres, opensearch or redis."""
29
29
  PlatformHelperVersioning().check_if_needs_update()
30
- application = load_application(app)
30
+ application = load_application(app=app, env=env)
31
31
 
32
32
  try:
33
33
  secrets_provider: Secrets = Secrets(
@@ -68,7 +68,7 @@ class DatabaseCopy:
68
68
  environment = environments.get(env)
69
69
  if not environment:
70
70
  self.io.abort_with_error(
71
- f"No such environment '{env}'. Available environments are: {', '.join(environments.keys())}"
71
+ f"Environment '{env}' cannot be found in your account configuration in parameter store. Available environments are: {', '.join(environments.keys())}. Please check that the Terraform infrastructure for your environment is up to date."
72
72
  )
73
73
 
74
74
  env_session = environment.session
@@ -195,6 +195,12 @@ class PlatformConfigSchema:
195
195
  # TODO: DBTP-1943: requires_approval is no longer relevant since we don't have AWS Copilot manage environment pipelines
196
196
  Optional("requires_approval"): bool,
197
197
  Optional("vpc"): str,
198
+ Optional("service-deployment-mode"): Or(
199
+ "copilot",
200
+ "dual-deploy-copilot-traffic",
201
+ "dual-deploy-platform-traffic",
202
+ "platform",
203
+ ),
198
204
  },
199
205
  )
200
206
  }
@@ -59,23 +59,11 @@ class Application:
59
59
  return str(self) == str(other)
60
60
 
61
61
 
62
- def load_application(app=None, default_session=None) -> Application:
62
+ def load_application(app=None, default_session=None, env=None) -> Application:
63
63
  application = Application(app if app else get_application_name())
64
64
  current_session = default_session if default_session else get_aws_session_or_abort()
65
65
 
66
66
  ssm_client = current_session.client("ssm")
67
-
68
- try:
69
- ssm_client.get_parameter(
70
- Name=f"/copilot/applications/{application.name}",
71
- WithDecryption=False,
72
- )
73
- except ssm_client.exceptions.ParameterNotFound:
74
- raise ApplicationNotFoundException(application.name)
75
-
76
- path = f"/copilot/applications/{application.name}/environments"
77
- secrets = get_ssm_secrets(app, None, current_session, path)
78
-
79
67
  sts_client = current_session.client("sts")
80
68
  account_id = sts_client.get_caller_identity()["Account"]
81
69
  sessions = {account_id: current_session}
@@ -89,16 +77,58 @@ def load_application(app=None, default_session=None) -> Application:
89
77
  - /copilot/applications/test/environments/my_env will match.
90
78
  - /copilot/applications/test/environments/my_env/addons will not match.
91
79
  """
92
- environment_key_regex = r"^/copilot/applications/{}/environments/[^/]*$".format(
80
+ environment_key_regex = r"^/(copilot|platform)/applications/{}/environments/[^/]*$".format(
93
81
  application.name
94
82
  )
95
83
  return bool(re.match(environment_key_regex, name))
96
84
 
97
- environments = {
85
+ environments_data = []
86
+
87
+ # Try to load the new /platform SSM parameter if present
88
+ platform_env_path = f"/platform/applications/{application.name}/environments"
89
+ secrets = get_ssm_secrets(app, None, current_session, platform_env_path)
90
+
91
+ if secrets:
92
+ for name, value in secrets:
93
+ try:
94
+ data = json.loads(value)
95
+ except json.JSONDecodeError:
96
+ continue
97
+
98
+ # New /platform SSM parameter contains data about all environments
99
+ if "allEnvironments" in data:
100
+ environments_data = data["allEnvironments"]
101
+ break # Only need one
102
+ else:
103
+ try:
104
+ # Check that the Copilot application exists
105
+ ssm_client.get_parameter(
106
+ Name=f"/copilot/applications/{application.name}",
107
+ WithDecryption=False,
108
+ )
109
+ secrets = get_ssm_secrets(
110
+ app, None, current_session, f"/copilot/applications/{application.name}/environments"
111
+ )
112
+
113
+ for name, value in secrets:
114
+ try:
115
+ data = json.loads(value)
116
+ except json.JSONDecodeError:
117
+ continue
118
+
119
+ if is_environment_key(name):
120
+ # Legacy /copilot SSM parameter. An individual SSM param is present per environment - looping through all of them is needed to extract necessary data about each env.
121
+ environments_data.append(data)
122
+
123
+ except ssm_client.exceptions.ParameterNotFound:
124
+ raise ApplicationNotFoundException(
125
+ application_name=application.name, environment_name=env
126
+ )
127
+
128
+ application.environments = {
98
129
  env["name"]: Environment(env["name"], env["accountID"], sessions)
99
- for env in [json.loads(s[1]) for s in secrets if is_environment_key(s[0])]
130
+ for env in environments_data
100
131
  }
101
- application.environments = environments
102
132
 
103
133
  response = ssm_client.get_parameters_by_path(
104
134
  Path=f"/copilot/applications/{application.name}/components",
@@ -142,9 +172,12 @@ class ApplicationException(PlatformException):
142
172
 
143
173
 
144
174
  class ApplicationNotFoundException(ApplicationException):
145
- def __init__(self, application_name: str):
175
+ def __init__(self, application_name: str, environment_name: str):
146
176
  super().__init__(
147
- f"""The account "{os.environ.get("AWS_PROFILE")}" does not contain the application "{application_name}"; ensure you have set the environment variable "AWS_PROFILE" correctly."""
177
+ f"""The account "{os.environ.get("AWS_PROFILE")}" does not contain the application "{application_name}".
178
+ Please ensure that the environment variable "AWS_PROFILE" is set correctly. If the issue persists, verify that one of the following AWS SSM parameters exists:
179
+ - /platform/applications/{application_name}/environments/{environment_name}
180
+ - /copilot/applications/{application_name}"""
148
181
  )
149
182
 
150
183
 
@@ -3,7 +3,7 @@ line-length = 100
3
3
 
4
4
  [tool.poetry]
5
5
  name = "dbt-platform-helper"
6
- version = "15.4.1"
6
+ version = "15.5.0"
7
7
  description = "Set of tools to help transfer applications/services from GOV.UK PaaS to DBT PaaS augmenting AWS Copilot."
8
8
  authors = ["Department for Business and Trade Platform Team <sre-team@digital.trade.gov.uk>"]
9
9
  license = "MIT"