dbt-platform-helper 13.0.1__tar.gz → 13.0.2__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.
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/PKG-INFO +1 -1
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/COMMANDS.md +2 -2
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/commands/config.py +26 -33
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/commands/generate.py +2 -2
- dbt_platform_helper-13.0.2/dbt_platform_helper/commands/version.py +37 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/domain/config_validator.py +10 -5
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/domain/copilot_environment.py +10 -9
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/domain/maintenance_page.py +32 -7
- dbt_platform_helper-13.0.2/dbt_platform_helper/domain/terraform_environment.py +46 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/providers/config.py +11 -1
- dbt_platform_helper-13.0.2/dbt_platform_helper/providers/files.py +27 -0
- dbt_platform_helper-13.0.2/dbt_platform_helper/providers/semantic_version.py +126 -0
- dbt_platform_helper-13.0.2/dbt_platform_helper/providers/terraform_manifest.py +211 -0
- dbt_platform_helper-13.0.2/dbt_platform_helper/providers/validation.py +5 -0
- dbt_platform_helper-13.0.2/dbt_platform_helper/providers/version.py +36 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/providers/yaml_file.py +5 -3
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/utils/application.py +3 -2
- dbt_platform_helper-13.0.2/dbt_platform_helper/utils/versioning.py +242 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/platform_helper.py +2 -2
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/pyproject.toml +1 -1
- dbt_platform_helper-13.0.1/dbt_platform_helper/commands/version.py +0 -37
- dbt_platform_helper-13.0.1/dbt_platform_helper/domain/terraform_environment.py +0 -90
- dbt_platform_helper-13.0.1/dbt_platform_helper/domain/test_platform_terraform_manifest_generator.py +0 -100
- dbt_platform_helper-13.0.1/dbt_platform_helper/providers/files.py +0 -26
- dbt_platform_helper-13.0.1/dbt_platform_helper/providers/terraform_manifest.py +0 -120
- dbt_platform_helper-13.0.1/dbt_platform_helper/providers/validation.py +0 -19
- dbt_platform_helper-13.0.1/dbt_platform_helper/templates/environments/main.tf +0 -46
- dbt_platform_helper-13.0.1/dbt_platform_helper/utils/platform_config.py +0 -20
- dbt_platform_helper-13.0.1/dbt_platform_helper/utils/versioning.py +0 -311
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/LICENSE +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/README.md +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/__init__.py +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/addon-plans.yml +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/commands/__init__.py +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/commands/application.py +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/commands/codebase.py +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/commands/conduit.py +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/commands/copilot.py +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/commands/database.py +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/commands/environment.py +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/commands/notify.py +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/commands/pipeline.py +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/commands/secrets.py +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/constants.py +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/default-extensions.yml +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/domain/__init__.py +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/domain/codebase.py +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/domain/conduit.py +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/domain/database_copy.py +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/domain/pipelines.py +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/jinja2_tags.py +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/platform_exception.py +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/providers/__init__.py +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/providers/aws.py +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/providers/cache.py +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/providers/cloudformation.py +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/providers/copilot.py +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/providers/ecr.py +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/providers/ecs.py +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/providers/io.py +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/providers/load_balancers.py +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/providers/opensearch.py +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/providers/platform_config_schema.py +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/providers/redis.py +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/providers/secrets.py +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/providers/vpc.py +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/templates/.copilot/config.yml +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/templates/.copilot/image_build_run.sh +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/templates/.copilot/phases/build.sh +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/templates/.copilot/phases/install.sh +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/templates/.copilot/phases/post_build.sh +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/templates/.copilot/phases/pre_build.sh +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/templates/COMMANDS.md.jinja +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/templates/addon-instructions.txt +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/templates/addons/README.md +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/templates/addons/svc/appconfig-ipfilter.yml +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/templates/addons/svc/prometheus-policy.yml +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/templates/addons/svc/s3-cross-account-policy.yml +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/templates/addons/svc/s3-policy.yml +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/templates/addons/svc/subscription-filter.yml +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/templates/ci-codebuild-role-policy.json +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/templates/create-codebuild-role.json +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/templates/custom-codebuild-role-policy.json +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/templates/env/manifest.yml +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/templates/env/terraform-overrides/cfn.patches.yml +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/templates/environment-pipelines/main.tf +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/templates/svc/maintenance_pages/default.html +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/templates/svc/maintenance_pages/dmas-migration.html +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/templates/svc/maintenance_pages/migration.html +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/templates/svc/manifest-backend.yml +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/templates/svc/manifest-public.yml +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/templates/svc/overrides/cfn.patches.yml +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/utils/__init__.py +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/utils/arn_parser.py +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/utils/aws.py +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/utils/click.py +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/utils/cloudfoundry.py +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/utils/files.py +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/utils/git.py +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/utils/manifests.py +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/utils/messages.py +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/utils/template.py +0 -0
- {dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/utils/validation.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: dbt-platform-helper
|
|
3
|
-
Version: 13.0.
|
|
3
|
+
Version: 13.0.2
|
|
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
|
|
@@ -856,8 +856,8 @@ platform-helper database copy --from <from_env> --to <to_env> --database <databa
|
|
|
856
856
|
|
|
857
857
|
[↩ Parent](#platform-helper)
|
|
858
858
|
|
|
859
|
-
Contains subcommands for getting version information about the
|
|
860
|
-
|
|
859
|
+
Contains subcommands for getting version information about the current
|
|
860
|
+
project.
|
|
861
861
|
|
|
862
862
|
## Usage
|
|
863
863
|
|
{dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/commands/config.py
RENAMED
|
@@ -9,7 +9,9 @@ import click
|
|
|
9
9
|
from prettytable import PrettyTable
|
|
10
10
|
|
|
11
11
|
from dbt_platform_helper.providers.config import ConfigProvider
|
|
12
|
-
from dbt_platform_helper.providers.
|
|
12
|
+
from dbt_platform_helper.providers.semantic_version import (
|
|
13
|
+
IncompatibleMajorVersionException,
|
|
14
|
+
)
|
|
13
15
|
from dbt_platform_helper.providers.validation import ValidationException
|
|
14
16
|
from dbt_platform_helper.utils import versioning
|
|
15
17
|
from dbt_platform_helper.utils.click import ClickDocOptGroup
|
|
@@ -79,8 +81,8 @@ def deployment():
|
|
|
79
81
|
_check_tool_versions(platform_helper_versions, copilot_versions, aws_versions)
|
|
80
82
|
click.secho("Checking addons templates versions...", fg="blue")
|
|
81
83
|
|
|
82
|
-
local_version = platform_helper_versions.
|
|
83
|
-
latest_release = platform_helper_versions.
|
|
84
|
+
local_version = platform_helper_versions.local
|
|
85
|
+
latest_release = platform_helper_versions.latest
|
|
84
86
|
addons_templates_table = PrettyTable()
|
|
85
87
|
addons_templates_table.field_names = [
|
|
86
88
|
"Addons Template File",
|
|
@@ -115,7 +117,7 @@ def deployment():
|
|
|
115
117
|
compatible = False
|
|
116
118
|
recommendations["dbt-platform-helper-upgrade"] = RECOMMENDATIONS[
|
|
117
119
|
"dbt-platform-helper-upgrade"
|
|
118
|
-
].format(version=
|
|
120
|
+
].format(version=latest_release)
|
|
119
121
|
recommendations["dbt-platform-helper-upgrade-note"] = RECOMMENDATIONS[
|
|
120
122
|
"dbt-platform-helper-upgrade-note"
|
|
121
123
|
]
|
|
@@ -124,7 +126,7 @@ def deployment():
|
|
|
124
126
|
compatible = False
|
|
125
127
|
recommendations["dbt-platform-helper-upgrade"] = RECOMMENDATIONS[
|
|
126
128
|
"dbt-platform-helper-upgrade"
|
|
127
|
-
].format(version=
|
|
129
|
+
].format(version=latest_release)
|
|
128
130
|
recommendations["dbt-platform-helper-upgrade-note"] = RECOMMENDATIONS[
|
|
129
131
|
"dbt-platform-helper-upgrade-note"
|
|
130
132
|
]
|
|
@@ -144,11 +146,7 @@ def deployment():
|
|
|
144
146
|
addons_templates_table.add_row(
|
|
145
147
|
[
|
|
146
148
|
template_file.relative_to("."),
|
|
147
|
-
(
|
|
148
|
-
maybe
|
|
149
|
-
if latest_compatible_symbol is maybe
|
|
150
|
-
else versioning.string_version(generated_with_version)
|
|
151
|
-
),
|
|
149
|
+
(maybe if latest_compatible_symbol is maybe else str(generated_with_version)),
|
|
152
150
|
local_compatible_symbol,
|
|
153
151
|
latest_compatible_symbol,
|
|
154
152
|
]
|
|
@@ -164,21 +162,16 @@ def _check_tool_versions(platform_helper_versions, copilot_versions, aws_version
|
|
|
164
162
|
click.secho("Checking tooling versions...", fg="blue")
|
|
165
163
|
recommendations = {}
|
|
166
164
|
|
|
167
|
-
local_copilot_version = copilot_versions.
|
|
168
|
-
copilot_latest_release = copilot_versions.
|
|
165
|
+
local_copilot_version = copilot_versions.local
|
|
166
|
+
copilot_latest_release = copilot_versions.latest
|
|
169
167
|
if local_copilot_version is None:
|
|
170
168
|
recommendations["install-copilot"] = (
|
|
171
169
|
"Install AWS Copilot https://aws.github.io/copilot-cli/"
|
|
172
170
|
)
|
|
173
171
|
|
|
174
|
-
|
|
175
|
-
aws_latest_release = aws_versions.latest_release
|
|
176
|
-
if local_aws_version is None:
|
|
172
|
+
if aws_versions.local is None:
|
|
177
173
|
recommendations["install-aws"] = "Install AWS CLI https://aws.amazon.com/cli/"
|
|
178
174
|
|
|
179
|
-
local_version = platform_helper_versions.local_version
|
|
180
|
-
latest_release = platform_helper_versions.latest_release
|
|
181
|
-
|
|
182
175
|
tool_versions_table = PrettyTable()
|
|
183
176
|
tool_versions_table.field_names = [
|
|
184
177
|
"Tool",
|
|
@@ -191,46 +184,46 @@ def _check_tool_versions(platform_helper_versions, copilot_versions, aws_version
|
|
|
191
184
|
tool_versions_table.add_row(
|
|
192
185
|
[
|
|
193
186
|
"aws",
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
no if
|
|
187
|
+
str(aws_versions.local),
|
|
188
|
+
str(aws_versions.latest),
|
|
189
|
+
no if aws_versions.is_outdated() else yes,
|
|
197
190
|
]
|
|
198
191
|
)
|
|
199
192
|
tool_versions_table.add_row(
|
|
200
193
|
[
|
|
201
194
|
"copilot",
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
no if
|
|
195
|
+
str(copilot_versions.local),
|
|
196
|
+
str(copilot_versions.latest),
|
|
197
|
+
no if copilot_versions.is_outdated() else yes,
|
|
205
198
|
]
|
|
206
199
|
)
|
|
207
200
|
tool_versions_table.add_row(
|
|
208
201
|
[
|
|
209
202
|
"dbt-platform-helper",
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
no if
|
|
203
|
+
str(platform_helper_versions.local),
|
|
204
|
+
str(platform_helper_versions.latest),
|
|
205
|
+
no if platform_helper_versions.is_outdated() else yes,
|
|
213
206
|
]
|
|
214
207
|
)
|
|
215
208
|
|
|
216
209
|
click.secho(tool_versions_table)
|
|
217
210
|
|
|
218
|
-
if
|
|
211
|
+
if aws_versions.is_outdated() and "install-aws" not in recommendations:
|
|
219
212
|
recommendations["aws-upgrade"] = RECOMMENDATIONS["generic-tool-upgrade"].format(
|
|
220
213
|
tool="AWS CLI",
|
|
221
|
-
version=
|
|
214
|
+
version=str(aws_versions.latest),
|
|
222
215
|
)
|
|
223
216
|
|
|
224
|
-
if
|
|
217
|
+
if copilot_versions.is_outdated() and "install-copilot" not in recommendations:
|
|
225
218
|
recommendations["copilot-upgrade"] = RECOMMENDATIONS["generic-tool-upgrade"].format(
|
|
226
219
|
tool="AWS Copilot",
|
|
227
|
-
version=
|
|
220
|
+
version=str(copilot_latest_release),
|
|
228
221
|
)
|
|
229
222
|
|
|
230
|
-
if
|
|
223
|
+
if platform_helper_versions.is_outdated():
|
|
231
224
|
recommendations["dbt-platform-helper-upgrade"] = RECOMMENDATIONS[
|
|
232
225
|
"dbt-platform-helper-upgrade"
|
|
233
|
-
].format(version=
|
|
226
|
+
].format(version=str(platform_helper_versions.latest))
|
|
234
227
|
recommendations["dbt-platform-helper-upgrade-note"] = RECOMMENDATIONS[
|
|
235
228
|
"dbt-platform-helper-upgrade-note"
|
|
236
229
|
]
|
{dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/commands/generate.py
RENAMED
|
@@ -4,7 +4,7 @@ import click
|
|
|
4
4
|
from dbt_platform_helper.commands.copilot import make_addons
|
|
5
5
|
from dbt_platform_helper.commands.pipeline import generate as pipeline_generate
|
|
6
6
|
from dbt_platform_helper.utils.click import ClickDocOptCommand
|
|
7
|
-
from dbt_platform_helper.utils.versioning import
|
|
7
|
+
from dbt_platform_helper.utils.versioning import RequiredVersion
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
@click.command(cls=ClickDocOptCommand)
|
|
@@ -17,6 +17,6 @@ def generate(ctx: click.Context):
|
|
|
17
17
|
Wraps pipeline generate and make-addons.
|
|
18
18
|
"""
|
|
19
19
|
|
|
20
|
-
check_platform_helper_version_mismatch()
|
|
20
|
+
RequiredVersion().check_platform_helper_version_mismatch()
|
|
21
21
|
ctx.invoke(pipeline_generate)
|
|
22
22
|
ctx.invoke(make_addons)
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import click
|
|
2
|
+
|
|
3
|
+
from dbt_platform_helper.platform_exception import PlatformException
|
|
4
|
+
from dbt_platform_helper.providers.io import ClickIOProvider
|
|
5
|
+
from dbt_platform_helper.utils.click import ClickDocOptGroup
|
|
6
|
+
from dbt_platform_helper.utils.versioning import RequiredVersion
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@click.group(chain=True, cls=ClickDocOptGroup)
|
|
10
|
+
def version():
|
|
11
|
+
"""Contains subcommands for getting version information about the current
|
|
12
|
+
project."""
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@version.command(help="Print the version of platform-tools required by the current project")
|
|
16
|
+
@click.option(
|
|
17
|
+
"--pipeline",
|
|
18
|
+
required=False,
|
|
19
|
+
type=str,
|
|
20
|
+
help="Take into account platform-tools version overrides in the specified pipeline",
|
|
21
|
+
)
|
|
22
|
+
def get_platform_helper_for_project(pipeline):
|
|
23
|
+
"""
|
|
24
|
+
Version precedence is in this order:
|
|
25
|
+
- if the --pipeline option is supplied, the version in 'platform-config.yml' in:
|
|
26
|
+
environment_pipelines:
|
|
27
|
+
<pipeline>:
|
|
28
|
+
...
|
|
29
|
+
versions:
|
|
30
|
+
platform-helper
|
|
31
|
+
- The version from default_versions/platform-helper in 'platform-config.yml'
|
|
32
|
+
- Fall back on the version in the deprecated '.platform-helper-version' file
|
|
33
|
+
"""
|
|
34
|
+
try:
|
|
35
|
+
RequiredVersion().get_required_version(pipeline)
|
|
36
|
+
except PlatformException as err:
|
|
37
|
+
ClickIOProvider().abort_with_error(str(err))
|
|
@@ -2,11 +2,16 @@ from typing import Callable
|
|
|
2
2
|
|
|
3
3
|
import boto3
|
|
4
4
|
|
|
5
|
+
from dbt_platform_helper.platform_exception import PlatformException
|
|
5
6
|
from dbt_platform_helper.providers.io import ClickIOProvider
|
|
6
7
|
from dbt_platform_helper.providers.opensearch import OpensearchProvider
|
|
7
8
|
from dbt_platform_helper.providers.redis import RedisProvider
|
|
8
9
|
|
|
9
10
|
|
|
11
|
+
class ConfigValidatorError(PlatformException):
|
|
12
|
+
pass
|
|
13
|
+
|
|
14
|
+
|
|
10
15
|
class ConfigValidator:
|
|
11
16
|
|
|
12
17
|
def __init__(
|
|
@@ -110,7 +115,7 @@ class ConfigValidator:
|
|
|
110
115
|
envs = detail["bad_envs"]
|
|
111
116
|
acc = detail["account"]
|
|
112
117
|
message += f" '{pipeline}' - these environments are not in the '{acc}' account: {', '.join(envs)}\n"
|
|
113
|
-
|
|
118
|
+
raise ConfigValidatorError(message)
|
|
114
119
|
|
|
115
120
|
def validate_environment_pipelines_triggers(self, config):
|
|
116
121
|
errors = []
|
|
@@ -134,7 +139,7 @@ class ConfigValidator:
|
|
|
134
139
|
|
|
135
140
|
if errors:
|
|
136
141
|
error_message = "The following pipelines are misconfigured: \n"
|
|
137
|
-
|
|
142
|
+
raise ConfigValidatorError(error_message + "\n ".join(errors))
|
|
138
143
|
|
|
139
144
|
def validate_database_copy_section(self, config):
|
|
140
145
|
extensions = config.get("extensions", {})
|
|
@@ -220,7 +225,7 @@ class ConfigValidator:
|
|
|
220
225
|
)
|
|
221
226
|
|
|
222
227
|
if errors:
|
|
223
|
-
|
|
228
|
+
raise ConfigValidatorError("\n".join(errors))
|
|
224
229
|
|
|
225
230
|
def validate_database_migration_input_sources(self, config: dict):
|
|
226
231
|
extensions = config.get("extensions", {})
|
|
@@ -247,7 +252,7 @@ class ConfigValidator:
|
|
|
247
252
|
)
|
|
248
253
|
if "import" not in data_migration and "import_sources" not in data_migration:
|
|
249
254
|
errors.append(
|
|
250
|
-
f"
|
|
255
|
+
f"'import_sources' property in '{extension_name}.environments.{env}.data_migration' is missing."
|
|
251
256
|
)
|
|
252
257
|
if errors:
|
|
253
|
-
|
|
258
|
+
raise ConfigValidatorError("\n".join(errors))
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
from collections import defaultdict
|
|
2
2
|
from pathlib import Path
|
|
3
|
-
from typing import Callable
|
|
4
3
|
|
|
5
|
-
import click
|
|
6
4
|
from boto3 import Session
|
|
7
5
|
|
|
8
6
|
from dbt_platform_helper.domain.terraform_environment import (
|
|
@@ -11,6 +9,7 @@ from dbt_platform_helper.domain.terraform_environment import (
|
|
|
11
9
|
from dbt_platform_helper.providers.cloudformation import CloudFormation
|
|
12
10
|
from dbt_platform_helper.providers.config import ConfigProvider
|
|
13
11
|
from dbt_platform_helper.providers.files import FileProvider
|
|
12
|
+
from dbt_platform_helper.providers.io import ClickIOProvider
|
|
14
13
|
from dbt_platform_helper.providers.load_balancers import (
|
|
15
14
|
get_https_certificate_for_application,
|
|
16
15
|
)
|
|
@@ -30,14 +29,14 @@ class CopilotEnvironment:
|
|
|
30
29
|
cloudformation_provider: CloudFormation = None,
|
|
31
30
|
session: Session = None, # TODO - this is a temporary fix, will fall away once the Loadbalancer provider is in place.
|
|
32
31
|
copilot_templating=None,
|
|
33
|
-
|
|
32
|
+
io: ClickIOProvider = ClickIOProvider(),
|
|
34
33
|
):
|
|
35
34
|
self.config_provider = config_provider
|
|
36
35
|
self.vpc_provider = vpc_provider
|
|
37
36
|
self.copilot_templating = copilot_templating or CopilotTemplating(
|
|
38
37
|
file_provider=FileProvider(),
|
|
39
38
|
)
|
|
40
|
-
self.
|
|
39
|
+
self.io = io
|
|
41
40
|
self.session = session
|
|
42
41
|
self.cloudformation_provider = cloudformation_provider
|
|
43
42
|
|
|
@@ -53,7 +52,7 @@ class CopilotEnvironment:
|
|
|
53
52
|
env_config = platform_config["environments"][environment_name]
|
|
54
53
|
profile_for_environment = env_config.get("accounts", {}).get("deploy", {}).get("name")
|
|
55
54
|
|
|
56
|
-
self.
|
|
55
|
+
self.io.info(f"Using {profile_for_environment} for this AWS session")
|
|
57
56
|
|
|
58
57
|
app_name = platform_config["application"]
|
|
59
58
|
|
|
@@ -72,7 +71,7 @@ class CopilotEnvironment:
|
|
|
72
71
|
cert_arn=certificate_arn,
|
|
73
72
|
)
|
|
74
73
|
|
|
75
|
-
self.
|
|
74
|
+
self.io.info(
|
|
76
75
|
self.copilot_templating.write_environment_manifest(
|
|
77
76
|
environment_name, copilot_environment_manifest
|
|
78
77
|
)
|
|
@@ -134,11 +133,13 @@ class CopilotTemplating:
|
|
|
134
133
|
def __init__(
|
|
135
134
|
self,
|
|
136
135
|
file_provider: FileProvider = None,
|
|
136
|
+
io: ClickIOProvider = ClickIOProvider(),
|
|
137
137
|
# TODO 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
|
|
141
141
|
self.templates = setup_templates()
|
|
142
|
+
self.io = io
|
|
142
143
|
|
|
143
144
|
def generate_copilot_environment_manifest(
|
|
144
145
|
self, environment_name: str, vpc: Vpc, cert_arn: str
|
|
@@ -193,16 +194,16 @@ class CopilotTemplating:
|
|
|
193
194
|
)
|
|
194
195
|
|
|
195
196
|
if not resource_blocks:
|
|
196
|
-
|
|
197
|
+
self.io.info("\n>>> No cross-environment S3 policies to create.\n")
|
|
197
198
|
return
|
|
198
199
|
|
|
199
200
|
for service in sorted(resource_blocks.keys()):
|
|
200
201
|
resources = resource_blocks[service]
|
|
201
|
-
|
|
202
|
+
self.io.info(f"\n>>> Creating S3 cross account policies for {service}.\n")
|
|
202
203
|
template = self.templates.get_template(S3_CROSS_ACCOUNT_POLICY)
|
|
203
204
|
file_content = template.render({"resources": resources})
|
|
204
205
|
output_dir = Path(".").absolute()
|
|
205
206
|
file_path = f"copilot/{service}/addons/s3-cross-account-policy.yml"
|
|
206
207
|
|
|
207
208
|
self.file_provider.mkfile(output_dir, file_path, file_content, True)
|
|
208
|
-
|
|
209
|
+
self.io.info(f"File {file_path} created")
|
|
@@ -90,7 +90,7 @@ def add_maintenance_page(
|
|
|
90
90
|
app: str,
|
|
91
91
|
env: str,
|
|
92
92
|
services: List[Service],
|
|
93
|
-
allowed_ips:
|
|
93
|
+
allowed_ips: List[str],
|
|
94
94
|
template: str = "default",
|
|
95
95
|
):
|
|
96
96
|
lb_client = session.client("elbv2")
|
|
@@ -98,6 +98,7 @@ def add_maintenance_page(
|
|
|
98
98
|
bypass_value = "".join(random.choices(string.ascii_lowercase + string.digits, k=12))
|
|
99
99
|
|
|
100
100
|
rule_priority = itertools.count(start=1)
|
|
101
|
+
maintenance_page_host_header_conditions = []
|
|
101
102
|
try:
|
|
102
103
|
for svc in services:
|
|
103
104
|
target_group_arn = find_target_group(app, env, svc.name, session)
|
|
@@ -106,6 +107,10 @@ def add_maintenance_page(
|
|
|
106
107
|
if not target_group_arn:
|
|
107
108
|
continue
|
|
108
109
|
|
|
110
|
+
service_conditions = get_host_header_conditions(
|
|
111
|
+
lb_client, listener_arn, target_group_arn
|
|
112
|
+
)
|
|
113
|
+
|
|
109
114
|
for ip in allowed_ips:
|
|
110
115
|
create_header_rule(
|
|
111
116
|
lb_client,
|
|
@@ -115,6 +120,7 @@ def add_maintenance_page(
|
|
|
115
120
|
[ip],
|
|
116
121
|
"AllowedIps",
|
|
117
122
|
next(rule_priority),
|
|
123
|
+
service_conditions,
|
|
118
124
|
)
|
|
119
125
|
create_source_ip_rule(
|
|
120
126
|
lb_client,
|
|
@@ -123,6 +129,7 @@ def add_maintenance_page(
|
|
|
123
129
|
[ip],
|
|
124
130
|
"AllowedSourceIps",
|
|
125
131
|
next(rule_priority),
|
|
132
|
+
service_conditions,
|
|
126
133
|
)
|
|
127
134
|
|
|
128
135
|
create_header_rule(
|
|
@@ -133,8 +140,12 @@ def add_maintenance_page(
|
|
|
133
140
|
[bypass_value],
|
|
134
141
|
"BypassIpFilter",
|
|
135
142
|
next(rule_priority),
|
|
143
|
+
service_conditions,
|
|
136
144
|
)
|
|
137
145
|
|
|
146
|
+
# add to accumilating list of conditions for maintenace page rule
|
|
147
|
+
maintenance_page_host_header_conditions.extend(service_conditions)
|
|
148
|
+
|
|
138
149
|
click.secho(
|
|
139
150
|
f"\nUse a browser plugin to add `Bypass-Key` header with value {bypass_value} to your requests. For more detail, visit https://platform.readme.trade.gov.uk/next-steps/put-a-service-under-maintenance/",
|
|
140
151
|
)
|
|
@@ -146,7 +157,21 @@ def add_maintenance_page(
|
|
|
146
157
|
{
|
|
147
158
|
"Field": "path-pattern",
|
|
148
159
|
"PathPatternConfig": {"Values": ["/*"]},
|
|
149
|
-
}
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"Field": "host-header",
|
|
163
|
+
"HostHeaderConfig": {
|
|
164
|
+
"Values": sorted(
|
|
165
|
+
list(
|
|
166
|
+
{
|
|
167
|
+
value
|
|
168
|
+
for condition in maintenance_page_host_header_conditions
|
|
169
|
+
for value in condition["HostHeaderConfig"]["Values"]
|
|
170
|
+
}
|
|
171
|
+
)
|
|
172
|
+
)
|
|
173
|
+
},
|
|
174
|
+
},
|
|
150
175
|
],
|
|
151
176
|
Actions=[
|
|
152
177
|
{
|
|
@@ -445,9 +470,8 @@ def create_header_rule(
|
|
|
445
470
|
values: list,
|
|
446
471
|
rule_name: str,
|
|
447
472
|
priority: int,
|
|
473
|
+
conditions: list,
|
|
448
474
|
):
|
|
449
|
-
conditions = get_host_conditions(lb_client, listener_arn, target_group_arn)
|
|
450
|
-
|
|
451
475
|
# add new condition to existing conditions
|
|
452
476
|
combined_conditions = [
|
|
453
477
|
{
|
|
@@ -486,9 +510,8 @@ def create_source_ip_rule(
|
|
|
486
510
|
values: list,
|
|
487
511
|
rule_name: str,
|
|
488
512
|
priority: int,
|
|
513
|
+
conditions: list,
|
|
489
514
|
):
|
|
490
|
-
conditions = get_host_conditions(lb_client, listener_arn, target_group_arn)
|
|
491
|
-
|
|
492
515
|
# add new condition to existing conditions
|
|
493
516
|
|
|
494
517
|
combined_conditions = [
|
|
@@ -514,7 +537,9 @@ def create_source_ip_rule(
|
|
|
514
537
|
)
|
|
515
538
|
|
|
516
539
|
|
|
517
|
-
def
|
|
540
|
+
def get_host_header_conditions(
|
|
541
|
+
lb_client: boto3.client, listener_arn: str, target_group_arn: str
|
|
542
|
+
) -> list:
|
|
518
543
|
rules = lb_client.describe_rules(ListenerArn=listener_arn)["Rules"]
|
|
519
544
|
|
|
520
545
|
# Get current set of forwarding conditions for the target group
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
from dbt_platform_helper.platform_exception import PlatformException
|
|
2
|
+
from dbt_platform_helper.providers.io import ClickIOProvider
|
|
3
|
+
from dbt_platform_helper.providers.terraform_manifest import TerraformManifestProvider
|
|
4
|
+
from dbt_platform_helper.utils.versioning import (
|
|
5
|
+
get_required_terraform_platform_modules_version,
|
|
6
|
+
)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class TerraformEnvironmentException(PlatformException):
|
|
10
|
+
pass
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class EnvironmentNotFoundException(TerraformEnvironmentException):
|
|
14
|
+
pass
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class TerraformEnvironment:
|
|
18
|
+
def __init__(
|
|
19
|
+
self,
|
|
20
|
+
config_provider,
|
|
21
|
+
manifest_provider: TerraformManifestProvider = None,
|
|
22
|
+
io: ClickIOProvider = ClickIOProvider(),
|
|
23
|
+
):
|
|
24
|
+
self.io = io
|
|
25
|
+
self.config_provider = config_provider
|
|
26
|
+
self.manifest_provider = manifest_provider or TerraformManifestProvider()
|
|
27
|
+
|
|
28
|
+
def generate(self, environment_name, terraform_platform_modules_version_override=None):
|
|
29
|
+
config = self.config_provider.get_enriched_config()
|
|
30
|
+
|
|
31
|
+
if environment_name not in config.get("environments").keys():
|
|
32
|
+
raise EnvironmentNotFoundException(
|
|
33
|
+
f"cannot generate terraform for environment {environment_name}. It does not exist in your configuration"
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
platform_config_terraform_modules_default_version = config.get("default_versions", {}).get(
|
|
37
|
+
"terraform-platform-modules", ""
|
|
38
|
+
)
|
|
39
|
+
terraform_platform_modules_version = get_required_terraform_platform_modules_version(
|
|
40
|
+
terraform_platform_modules_version_override,
|
|
41
|
+
platform_config_terraform_modules_default_version,
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
self.manifest_provider.generate_environment_config(
|
|
45
|
+
config, environment_name, terraform_platform_modules_version
|
|
46
|
+
)
|
{dbt_platform_helper-13.0.1 → dbt_platform_helper-13.0.2}/dbt_platform_helper/providers/config.py
RENAMED
|
@@ -5,6 +5,7 @@ from schema import SchemaError
|
|
|
5
5
|
|
|
6
6
|
from dbt_platform_helper.constants import PLATFORM_CONFIG_FILE
|
|
7
7
|
from dbt_platform_helper.domain.config_validator import ConfigValidator
|
|
8
|
+
from dbt_platform_helper.domain.config_validator import ConfigValidatorError
|
|
8
9
|
from dbt_platform_helper.providers.io import ClickIOProvider
|
|
9
10
|
from dbt_platform_helper.providers.platform_config_schema import PlatformConfigSchema
|
|
10
11
|
from dbt_platform_helper.providers.yaml_file import FileNotFoundException
|
|
@@ -35,7 +36,10 @@ class ConfigProvider:
|
|
|
35
36
|
# also, we apply defaults but discard that data. Should we just apply
|
|
36
37
|
# defaults to config returned by load_and_validate
|
|
37
38
|
enriched_config = ConfigProvider.apply_environment_defaults(self.config)
|
|
38
|
-
|
|
39
|
+
try:
|
|
40
|
+
self.validator.run_validations(enriched_config)
|
|
41
|
+
except ConfigValidatorError as exc:
|
|
42
|
+
self.io.abort_with_error(f"Config validation has failed.\n{str(exc)}")
|
|
39
43
|
|
|
40
44
|
def load_and_validate_platform_config(self, path=PLATFORM_CONFIG_FILE):
|
|
41
45
|
try:
|
|
@@ -54,6 +58,12 @@ class ConfigProvider:
|
|
|
54
58
|
|
|
55
59
|
return self.config
|
|
56
60
|
|
|
61
|
+
def load_unvalidated_config_file(self, path=PLATFORM_CONFIG_FILE):
|
|
62
|
+
try:
|
|
63
|
+
return self.file_provider.load(path)
|
|
64
|
+
except FileProviderException:
|
|
65
|
+
return {}
|
|
66
|
+
|
|
57
67
|
# TODO this general function should be moved out of ConfigProvider
|
|
58
68
|
def config_file_check(self, path=PLATFORM_CONFIG_FILE):
|
|
59
69
|
if not Path(path).exists():
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class FileProvider:
|
|
5
|
+
|
|
6
|
+
def load(path: str) -> str:
|
|
7
|
+
pass
|
|
8
|
+
|
|
9
|
+
@staticmethod
|
|
10
|
+
def mkfile(base_path: str, file_name: str, contents: str, overwrite=False) -> str:
|
|
11
|
+
file_path = Path(base_path).joinpath(file_name)
|
|
12
|
+
file_exists = file_path.exists()
|
|
13
|
+
if file_exists and not overwrite:
|
|
14
|
+
return f"File {file_path} exists; doing nothing"
|
|
15
|
+
|
|
16
|
+
file_path.parent.mkdir(parents=True, exist_ok=True)
|
|
17
|
+
file_path.write_text(contents)
|
|
18
|
+
|
|
19
|
+
action = "overwritten" if file_exists and overwrite else "created"
|
|
20
|
+
return f"File {file_name} {action}"
|
|
21
|
+
|
|
22
|
+
@staticmethod
|
|
23
|
+
def delete_file(base_path: str, file_name: str):
|
|
24
|
+
file_path = Path(base_path) / file_name
|
|
25
|
+
if file_path.exists():
|
|
26
|
+
file_path.unlink()
|
|
27
|
+
return f"{str(file_path)} has been deleted"
|