dbt-platform-helper 15.4.2__py3-none-any.whl → 15.5.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.
- dbt_platform_helper/commands/conduit.py +1 -1
- dbt_platform_helper/domain/database_copy.py +1 -1
- dbt_platform_helper/entities/platform_config_schema.py +6 -0
- dbt_platform_helper/utils/application.py +52 -19
- {dbt_platform_helper-15.4.2.dist-info → dbt_platform_helper-15.5.0.dist-info}/METADATA +1 -1
- {dbt_platform_helper-15.4.2.dist-info → dbt_platform_helper-15.5.0.dist-info}/RECORD +9 -9
- {dbt_platform_helper-15.4.2.dist-info → dbt_platform_helper-15.5.0.dist-info}/LICENSE +0 -0
- {dbt_platform_helper-15.4.2.dist-info → dbt_platform_helper-15.5.0.dist-info}/WHEEL +0 -0
- {dbt_platform_helper-15.4.2.dist-info → dbt_platform_helper-15.5.0.dist-info}/entry_points.txt +0 -0
|
@@ -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"
|
|
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
|
-
|
|
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
|
|
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}"
|
|
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
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: dbt-platform-helper
|
|
3
|
-
Version: 15.
|
|
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
|
|
@@ -4,7 +4,7 @@ dbt_platform_helper/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSu
|
|
|
4
4
|
dbt_platform_helper/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
5
|
dbt_platform_helper/commands/application.py,sha256=OUQsahXXHSEKxmXAmK8fSy_bTLNwM_TdLuv6CvffRPk,10126
|
|
6
6
|
dbt_platform_helper/commands/codebase.py,sha256=oNlZcP2w3XE5YP-JVl0rdqoJuXUrfe1ELZ5xAdgPvBk,3166
|
|
7
|
-
dbt_platform_helper/commands/conduit.py,sha256=
|
|
7
|
+
dbt_platform_helper/commands/conduit.py,sha256=GVDX2QjeGCxgN0otWOPivo0jyoE0CjnBz3VCDx9s-po,2313
|
|
8
8
|
dbt_platform_helper/commands/config.py,sha256=4pgGgaH7Mp93UWdVoqZDc2eAmjsP7Yw1jjsviNWXsks,1442
|
|
9
9
|
dbt_platform_helper/commands/copilot.py,sha256=L9UUuqD62q0aFrTTEUla3A1WJBz-vFBfVi6p455TTgQ,1458
|
|
10
10
|
dbt_platform_helper/commands/database.py,sha256=2RJZEzaSqcNtDG1M2mZw-nB6agAd3GNAJsg2pjFF7vc,4407
|
|
@@ -22,14 +22,14 @@ dbt_platform_helper/domain/conduit.py,sha256=0aX5rhynkkJj8rJUwfyLENyCwlAI67_Vkky
|
|
|
22
22
|
dbt_platform_helper/domain/config.py,sha256=Iyf-lV4YDD6BHH-RRaTvp-7qPS8BYeHM_SkSfeU7si4,13802
|
|
23
23
|
dbt_platform_helper/domain/copilot.py,sha256=g8W2LaskyhOvtNoCoNbwucGTrfdAzj-AJ0J98tgLbhA,15138
|
|
24
24
|
dbt_platform_helper/domain/copilot_environment.py,sha256=fL3XJCOfO0BJRCrCoBPFCcshrQoX1FeSYNTziOEaH4A,9093
|
|
25
|
-
dbt_platform_helper/domain/database_copy.py,sha256=
|
|
25
|
+
dbt_platform_helper/domain/database_copy.py,sha256=4A84xqj3c_VjYlXb81B8Kt8us8IcCQVVF6GyPAAmwyo,9638
|
|
26
26
|
dbt_platform_helper/domain/maintenance_page.py,sha256=0_dgM5uZvjVNBKcqScspjutinMh-7Hdm7jBEgUPujrk,14529
|
|
27
27
|
dbt_platform_helper/domain/notify.py,sha256=_BWj5znDWtrSdJ5xzDBgnao4ukliBA5wiUZGobIDyiI,1894
|
|
28
28
|
dbt_platform_helper/domain/pipelines.py,sha256=rL_NArksFgmpsIUL3K_xVmTWt10tmlw5eCP140j96bc,7832
|
|
29
29
|
dbt_platform_helper/domain/plans.py,sha256=X5-jKGiJDVWn0CRH1k5aV74fTH0E41HqFQcCo5kB4hI,1160
|
|
30
30
|
dbt_platform_helper/domain/terraform_environment.py,sha256=g9PSuZeVXgboGNDXU7OGMiRATd67NU8S92HUGri1fbo,2471
|
|
31
31
|
dbt_platform_helper/domain/versioning.py,sha256=pIL8VPAJHqX5kJBp3QIxII5vmUo4aIYW_U9u_KxUJd0,5494
|
|
32
|
-
dbt_platform_helper/entities/platform_config_schema.py,sha256=
|
|
32
|
+
dbt_platform_helper/entities/platform_config_schema.py,sha256=1T9tKqDV4nsyr-UYhqg6NqRBUF6xgF7SPpdomGGjtMo,26931
|
|
33
33
|
dbt_platform_helper/entities/semantic_version.py,sha256=VgQ6V6OgSaleuVmMB8Kl_yLoakXl2auapJTDbK00mfc,2679
|
|
34
34
|
dbt_platform_helper/jinja2_tags.py,sha256=hKG6RS3zlxJHQ-Op9r2U2-MhWp4s3lZir4Ihe24ApJ0,540
|
|
35
35
|
dbt_platform_helper/platform_exception.py,sha256=HGfCYRD20REsynqMKmyZndTfdkMd5dLSIEB2qGGCeP8,244
|
|
@@ -90,7 +90,7 @@ dbt_platform_helper/templates/svc/maintenance_pages/migration.html,sha256=GiQsOi
|
|
|
90
90
|
dbt_platform_helper/templates/svc/overrides/cfn.patches.yml,sha256=W7-d017akuUq9kda64DQxazavcRcCPDjaAik6t1EZqM,742
|
|
91
91
|
dbt_platform_helper/utilities/decorators.py,sha256=rS6ohsuo0bc6fkZP98Qwaeh0c_v2MDqn9hCvqfoz2w8,3548
|
|
92
92
|
dbt_platform_helper/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
93
|
-
dbt_platform_helper/utils/application.py,sha256=
|
|
93
|
+
dbt_platform_helper/utils/application.py,sha256=414czQmCUMDohoz38cY8FjoitJolCmRxCqc9TMJTsE4,6951
|
|
94
94
|
dbt_platform_helper/utils/arn_parser.py,sha256=BaXzIxSOLdFmP_IfAxRq-0j-0Re1iCN7L4j2Zi5-CRQ,1304
|
|
95
95
|
dbt_platform_helper/utils/aws.py,sha256=O3L5Lg2idq597WYNe0GQiW9gHfoeL5XiQbtJ1r_1K-o,12710
|
|
96
96
|
dbt_platform_helper/utils/click.py,sha256=Fx4y4bbve1zypvog_sgK7tJtCocmzheoEFLBRv1lfdM,2943
|
|
@@ -102,8 +102,8 @@ platform_helper.py,sha256=_YNNGtMkH5BcpC_mQQYJrmlf2mt7lkxTYeH7ZgflPoA,1925
|
|
|
102
102
|
terraform/elasticache-redis/plans.yml,sha256=efJfkLuLC_5TwhLb9DalKHOuZFO79y6iei6Dg_tqKjI,1831
|
|
103
103
|
terraform/opensearch/plans.yml,sha256=lQbUSNMGfvUeDMcGx8mSwzGQhMJU3EZ4J4tPzPKaq6c,1471
|
|
104
104
|
terraform/postgres/plans.yml,sha256=plwCklW1VB_tNJFyUduRMZx9UANgiWH_7TGLWUaUEus,2553
|
|
105
|
-
dbt_platform_helper-15.
|
|
106
|
-
dbt_platform_helper-15.
|
|
107
|
-
dbt_platform_helper-15.
|
|
108
|
-
dbt_platform_helper-15.
|
|
109
|
-
dbt_platform_helper-15.
|
|
105
|
+
dbt_platform_helper-15.5.0.dist-info/LICENSE,sha256=dP79lN73--7LMApnankTGLqDbImXg8iYFqWgnExGkGk,1090
|
|
106
|
+
dbt_platform_helper-15.5.0.dist-info/METADATA,sha256=1RI8g5Z8DCJITAgBzSjUo-8Pf2eTDF1u8oDIj_0yW9I,3293
|
|
107
|
+
dbt_platform_helper-15.5.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
108
|
+
dbt_platform_helper-15.5.0.dist-info/entry_points.txt,sha256=QhbY8F434A-onsg0-FsdMd2U6HKh6Q7yCFFZrGUh5-M,67
|
|
109
|
+
dbt_platform_helper-15.5.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
{dbt_platform_helper-15.4.2.dist-info → dbt_platform_helper-15.5.0.dist-info}/entry_points.txt
RENAMED
|
File without changes
|