dbt-platform-helper 12.4.1__tar.gz → 12.5.1__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-12.4.1 → dbt_platform_helper-12.5.1}/PKG-INFO +2 -2
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/COMMANDS.md +1 -6
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/commands/config.py +2 -2
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/commands/copilot.py +51 -30
- dbt_platform_helper-12.5.1/dbt_platform_helper/commands/environment.py +88 -0
- dbt_platform_helper-12.5.1/dbt_platform_helper/commands/pipeline.py +60 -0
- dbt_platform_helper-12.5.1/dbt_platform_helper/constants.py +28 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/domain/codebase.py +8 -4
- dbt_platform_helper-12.5.1/dbt_platform_helper/domain/config_validator.py +242 -0
- dbt_platform_helper-12.5.1/dbt_platform_helper/domain/copilot_environment.py +204 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/domain/database_copy.py +16 -12
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/domain/maintenance_page.py +44 -20
- dbt_platform_helper-12.5.1/dbt_platform_helper/domain/pipelines.py +213 -0
- dbt_platform_helper-12.5.1/dbt_platform_helper/domain/terraform_environment.py +86 -0
- dbt_platform_helper-12.5.1/dbt_platform_helper/domain/test_platform_terraform_manifest_generator.py +100 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/jinja2_tags.py +1 -1
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/providers/cache.py +14 -21
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/providers/cloudformation.py +0 -1
- dbt_platform_helper-12.5.1/dbt_platform_helper/providers/config.py +100 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/providers/copilot.py +2 -0
- dbt_platform_helper-12.5.1/dbt_platform_helper/providers/files.py +26 -0
- dbt_platform_helper-12.5.1/dbt_platform_helper/providers/opensearch.py +36 -0
- dbt_platform_helper-12.5.1/dbt_platform_helper/providers/platform_config_schema.py +667 -0
- dbt_platform_helper-12.5.1/dbt_platform_helper/providers/redis.py +34 -0
- dbt_platform_helper-12.5.1/dbt_platform_helper/providers/vpc.py +57 -0
- dbt_platform_helper-12.5.1/dbt_platform_helper/providers/yaml_file.py +72 -0
- dbt_platform_helper-12.5.1/dbt_platform_helper/templates/addons/svc/s3-cross-account-policy.yml +67 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/utils/application.py +32 -34
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/utils/aws.py +1 -107
- dbt_platform_helper-12.5.1/dbt_platform_helper/utils/files.py +53 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/utils/platform_config.py +0 -7
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/utils/template.py +10 -0
- dbt_platform_helper-12.5.1/dbt_platform_helper/utils/validation.py +32 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/utils/versioning.py +12 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/pyproject.toml +2 -1
- dbt_platform_helper-12.4.1/dbt_platform_helper/commands/environment.py +0 -248
- dbt_platform_helper-12.4.1/dbt_platform_helper/commands/pipeline.py +0 -223
- dbt_platform_helper-12.4.1/dbt_platform_helper/constants.py +0 -18
- dbt_platform_helper-12.4.1/dbt_platform_helper/providers/platform_config_schema.py +0 -605
- dbt_platform_helper-12.4.1/dbt_platform_helper/utils/files.py +0 -104
- dbt_platform_helper-12.4.1/dbt_platform_helper/utils/validation.py +0 -354
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/LICENSE +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/README.md +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/__init__.py +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/addon-plans.yml +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/commands/__init__.py +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/commands/application.py +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/commands/codebase.py +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/commands/conduit.py +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/commands/database.py +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/commands/generate.py +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/commands/notify.py +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/commands/secrets.py +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/commands/version.py +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/default-extensions.yml +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/domain/__init__.py +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/domain/conduit.py +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/platform_exception.py +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/providers/__init__.py +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/providers/aws.py +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/providers/ecs.py +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/providers/load_balancers.py +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/providers/secrets.py +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/providers/validation.py +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/templates/.copilot/config.yml +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/templates/.copilot/image_build_run.sh +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/templates/.copilot/phases/build.sh +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/templates/.copilot/phases/install.sh +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/templates/.copilot/phases/post_build.sh +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/templates/.copilot/phases/pre_build.sh +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/templates/COMMANDS.md.jinja +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/templates/addon-instructions.txt +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/templates/addons/README.md +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/templates/addons/svc/appconfig-ipfilter.yml +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/templates/addons/svc/prometheus-policy.yml +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/templates/addons/svc/s3-policy.yml +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/templates/addons/svc/subscription-filter.yml +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/templates/ci-codebuild-role-policy.json +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/templates/create-codebuild-role.json +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/templates/custom-codebuild-role-policy.json +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/templates/env/manifest.yml +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/templates/env/terraform-overrides/cfn.patches.yml +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/templates/environment-pipelines/main.tf +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/templates/environments/main.tf +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/templates/pipelines/codebase/manifest.yml +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/templates/pipelines/codebase/overrides/.gitignore +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/templates/pipelines/codebase/overrides/bin/override.ts +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/templates/pipelines/codebase/overrides/buildspec.deploy.yml +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/templates/pipelines/codebase/overrides/buildspec.image.yml +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/templates/pipelines/codebase/overrides/cdk.json +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/templates/pipelines/codebase/overrides/package-lock.json +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/templates/pipelines/codebase/overrides/package.json +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/templates/pipelines/codebase/overrides/stack.ts +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/templates/pipelines/codebase/overrides/tsconfig.json +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/templates/pipelines/codebase/overrides/types.ts +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/templates/svc/maintenance_pages/default.html +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/templates/svc/maintenance_pages/dmas-migration.html +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/templates/svc/maintenance_pages/migration.html +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/templates/svc/manifest-backend.yml +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/templates/svc/manifest-public.yml +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/templates/svc/overrides/cfn.patches.yml +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/utils/__init__.py +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/utils/arn_parser.py +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/utils/click.py +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/utils/cloudfoundry.py +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/utils/git.py +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/utils/manifests.py +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/utils/messages.py +0 -0
- {dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/platform_helper.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
2
|
Name: dbt-platform-helper
|
|
3
|
-
Version: 12.
|
|
3
|
+
Version: 12.5.1
|
|
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
|
|
@@ -460,13 +460,11 @@ platform-helper environment online --app <application> --env <environment>
|
|
|
460
460
|
## Usage
|
|
461
461
|
|
|
462
462
|
```
|
|
463
|
-
platform-helper environment generate --name <name>
|
|
463
|
+
platform-helper environment generate --name <name>
|
|
464
464
|
```
|
|
465
465
|
|
|
466
466
|
## Options
|
|
467
467
|
|
|
468
|
-
- `--vpc-name <text>`
|
|
469
|
-
|
|
470
468
|
- `--name
|
|
471
469
|
-n <text>`
|
|
472
470
|
|
|
@@ -551,9 +549,6 @@ platform-helper pipeline generate
|
|
|
551
549
|
This command does the following in relation to the codebase pipelines:
|
|
552
550
|
- Generates the copilot pipeline manifest.yml for copilot/pipelines/<codebase_pipeline_name>
|
|
553
551
|
|
|
554
|
-
(Deprecated) This command does the following for non terraform projects (legacy AWS Copilot):
|
|
555
|
-
- Generates the copilot manifest.yml for copilot/environments/<environment>
|
|
556
|
-
|
|
557
552
|
## Usage
|
|
558
553
|
|
|
559
554
|
```
|
{dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/commands/config.py
RENAMED
|
@@ -8,11 +8,11 @@ import botocore
|
|
|
8
8
|
import click
|
|
9
9
|
from prettytable import PrettyTable
|
|
10
10
|
|
|
11
|
+
from dbt_platform_helper.providers.config import ConfigProvider
|
|
11
12
|
from dbt_platform_helper.providers.validation import IncompatibleMajorVersionException
|
|
12
13
|
from dbt_platform_helper.providers.validation import ValidationException
|
|
13
14
|
from dbt_platform_helper.utils import versioning
|
|
14
15
|
from dbt_platform_helper.utils.click import ClickDocOptGroup
|
|
15
|
-
from dbt_platform_helper.utils.validation import config_file_check
|
|
16
16
|
from dbt_platform_helper.utils.versioning import get_platform_helper_versions
|
|
17
17
|
|
|
18
18
|
yes = "\033[92m✔\033[0m"
|
|
@@ -98,7 +98,7 @@ def deployment():
|
|
|
98
98
|
|
|
99
99
|
recommendations = {}
|
|
100
100
|
|
|
101
|
-
config_file_check()
|
|
101
|
+
ConfigProvider.config_file_check()
|
|
102
102
|
|
|
103
103
|
for template_file in addons_templates:
|
|
104
104
|
generated_with_version = maybe
|
{dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/commands/copilot.py
RENAMED
|
@@ -7,17 +7,22 @@ from pathlib import PosixPath
|
|
|
7
7
|
|
|
8
8
|
import click
|
|
9
9
|
import yaml
|
|
10
|
+
from schema import SchemaError
|
|
10
11
|
|
|
11
12
|
from dbt_platform_helper.constants import PLATFORM_CONFIG_FILE
|
|
13
|
+
from dbt_platform_helper.domain.config_validator import ConfigValidator
|
|
14
|
+
from dbt_platform_helper.domain.copilot_environment import CopilotTemplating
|
|
15
|
+
from dbt_platform_helper.providers.config import ConfigProvider
|
|
16
|
+
from dbt_platform_helper.providers.files import FileProvider
|
|
12
17
|
from dbt_platform_helper.utils.application import get_application_name
|
|
13
18
|
from dbt_platform_helper.utils.application import load_application
|
|
14
19
|
from dbt_platform_helper.utils.aws import get_aws_session_or_abort
|
|
15
20
|
from dbt_platform_helper.utils.click import ClickDocOptGroup
|
|
16
21
|
from dbt_platform_helper.utils.files import generate_override_files
|
|
17
|
-
from dbt_platform_helper.utils.
|
|
22
|
+
from dbt_platform_helper.utils.messages import abort_with_error
|
|
23
|
+
from dbt_platform_helper.utils.template import ADDON_TEMPLATE_MAP
|
|
18
24
|
from dbt_platform_helper.utils.template import camel_case
|
|
19
25
|
from dbt_platform_helper.utils.template import setup_templates
|
|
20
|
-
from dbt_platform_helper.utils.validation import config_file_check
|
|
21
26
|
from dbt_platform_helper.utils.validation import validate_addons
|
|
22
27
|
from dbt_platform_helper.utils.versioning import (
|
|
23
28
|
check_platform_helper_version_needs_update,
|
|
@@ -35,14 +40,6 @@ SERVICE_TYPES = [
|
|
|
35
40
|
"Worker Service",
|
|
36
41
|
]
|
|
37
42
|
|
|
38
|
-
ADDON_TEMPLATE_MAP = {
|
|
39
|
-
"s3": ["addons/svc/s3-policy.yml"],
|
|
40
|
-
"s3-policy": ["addons/svc/s3-policy.yml"],
|
|
41
|
-
"appconfig-ipfilter": ["addons/svc/appconfig-ipfilter.yml"],
|
|
42
|
-
"subscription-filter": ["addons/svc/subscription-filter.yml"],
|
|
43
|
-
"prometheus-policy": ["addons/svc/prometheus-policy.yml"],
|
|
44
|
-
}
|
|
45
|
-
|
|
46
43
|
|
|
47
44
|
def list_copilot_local_environments():
|
|
48
45
|
return [
|
|
@@ -244,25 +241,42 @@ def _get_s3_kms_alias_arns(session, application_name, config):
|
|
|
244
241
|
return arns
|
|
245
242
|
|
|
246
243
|
|
|
244
|
+
def copilot_provider():
|
|
245
|
+
return CopilotTemplating()
|
|
246
|
+
|
|
247
|
+
|
|
247
248
|
@copilot.command()
|
|
248
249
|
def make_addons():
|
|
249
250
|
"""Generate addons CloudFormation for each environment."""
|
|
250
|
-
|
|
251
|
-
|
|
251
|
+
try:
|
|
252
|
+
config_provider = ConfigProvider(ConfigValidator())
|
|
253
|
+
_make_addons(config_provider)
|
|
254
|
+
except Exception as exc:
|
|
255
|
+
abort_with_error(exc)
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
def _make_addons(config_provider: ConfigProvider):
|
|
259
|
+
config_provider.config_file_check()
|
|
260
|
+
try:
|
|
261
|
+
config = config_provider.load_and_validate_platform_config()
|
|
262
|
+
except SchemaError as ex:
|
|
263
|
+
click.secho(f"Invalid `{PLATFORM_CONFIG_FILE}` file: {str(ex)}", fg="red")
|
|
264
|
+
raise click.Abort
|
|
252
265
|
|
|
253
266
|
templates = setup_templates()
|
|
254
|
-
|
|
267
|
+
extensions = _get_extensions()
|
|
255
268
|
session = get_aws_session_or_abort()
|
|
256
269
|
|
|
257
270
|
application_name = get_application_name()
|
|
258
271
|
|
|
259
272
|
click.echo("\n>>> Generating Terraform compatible addons CloudFormation\n")
|
|
260
273
|
|
|
274
|
+
output_dir = Path(".").absolute()
|
|
261
275
|
env_path = Path(f"copilot/environments/")
|
|
262
276
|
env_addons_path = env_path / "addons"
|
|
263
277
|
env_overrides_path = env_path / "overrides"
|
|
264
278
|
|
|
265
|
-
_cleanup_old_files(
|
|
279
|
+
_cleanup_old_files(extensions, output_dir, env_addons_path, env_overrides_path)
|
|
266
280
|
_generate_env_overrides(output_dir)
|
|
267
281
|
|
|
268
282
|
svc_names = list_copilot_local_services()
|
|
@@ -271,33 +285,33 @@ def make_addons():
|
|
|
271
285
|
_generate_svc_overrides(base_path, templates, svc_name)
|
|
272
286
|
|
|
273
287
|
services = []
|
|
274
|
-
for
|
|
275
|
-
|
|
276
|
-
addon_type =
|
|
277
|
-
environments =
|
|
288
|
+
for ext_name, ext_data in extensions.items():
|
|
289
|
+
extension = {**ext_data}
|
|
290
|
+
addon_type = extension.pop("type")
|
|
291
|
+
environments = extension.pop("environments")
|
|
278
292
|
environment_addon_config = {
|
|
279
293
|
"addon_type": addon_type,
|
|
280
294
|
"environments": environments,
|
|
281
|
-
"name":
|
|
282
|
-
"prefix": camel_case(
|
|
283
|
-
"secret_name":
|
|
284
|
-
**
|
|
295
|
+
"name": extension.get("name", None) or ext_name,
|
|
296
|
+
"prefix": camel_case(ext_name),
|
|
297
|
+
"secret_name": ext_name.upper().replace("-", "_"),
|
|
298
|
+
**extension,
|
|
285
299
|
}
|
|
286
300
|
|
|
287
301
|
services.append(environment_addon_config)
|
|
288
302
|
|
|
289
303
|
service_addon_config = {
|
|
290
304
|
"application_name": application_name,
|
|
291
|
-
"name":
|
|
292
|
-
"prefix": camel_case(
|
|
305
|
+
"name": extension.get("name", None) or ext_name,
|
|
306
|
+
"prefix": camel_case(ext_name),
|
|
293
307
|
"environments": environments,
|
|
294
|
-
**
|
|
308
|
+
**extension,
|
|
295
309
|
}
|
|
296
310
|
|
|
297
311
|
log_destination_arns = get_log_destination_arn()
|
|
298
312
|
|
|
299
313
|
if addon_type in ["s3", "s3-policy"]:
|
|
300
|
-
if
|
|
314
|
+
if extensions[ext_name].get("serve_static_content"):
|
|
301
315
|
continue
|
|
302
316
|
|
|
303
317
|
s3_kms_arns = _get_s3_kms_alias_arns(session, application_name, environments)
|
|
@@ -307,8 +321,8 @@ def make_addons():
|
|
|
307
321
|
)
|
|
308
322
|
|
|
309
323
|
_generate_service_addons(
|
|
310
|
-
|
|
311
|
-
|
|
324
|
+
extension,
|
|
325
|
+
ext_name,
|
|
312
326
|
addon_type,
|
|
313
327
|
output_dir,
|
|
314
328
|
service_addon_config,
|
|
@@ -316,10 +330,15 @@ def make_addons():
|
|
|
316
330
|
log_destination_arns,
|
|
317
331
|
)
|
|
318
332
|
|
|
333
|
+
environments = config_provider.apply_environment_defaults(config)["environments"]
|
|
334
|
+
|
|
335
|
+
provider = copilot_provider()
|
|
336
|
+
provider.generate_cross_account_s3_policies(environments, extensions)
|
|
337
|
+
|
|
319
338
|
click.echo(templates.get_template("addon-instructions.txt").render(services=services))
|
|
320
339
|
|
|
321
340
|
|
|
322
|
-
def
|
|
341
|
+
def _get_extensions():
|
|
323
342
|
config = _validate_and_normalise_extensions_config(PACKAGE_DIR / "default-extensions.yml")
|
|
324
343
|
project_config = _validate_and_normalise_extensions_config(PLATFORM_CONFIG_FILE, "extensions")
|
|
325
344
|
config.update(project_config)
|
|
@@ -360,7 +379,9 @@ def _generate_service_addons(
|
|
|
360
379
|
|
|
361
380
|
(output_dir / service_path).mkdir(parents=True, exist_ok=True)
|
|
362
381
|
click.echo(
|
|
363
|
-
mkfile(
|
|
382
|
+
FileProvider.mkfile(
|
|
383
|
+
output_dir, service_path / f"{addon_name}.yml", contents, overwrite=True
|
|
384
|
+
)
|
|
364
385
|
)
|
|
365
386
|
|
|
366
387
|
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import click
|
|
2
|
+
from schema import SchemaError
|
|
3
|
+
|
|
4
|
+
from dbt_platform_helper.constants import DEFAULT_TERRAFORM_PLATFORM_MODULES_VERSION
|
|
5
|
+
from dbt_platform_helper.constants import PLATFORM_CONFIG_FILE
|
|
6
|
+
from dbt_platform_helper.domain.config_validator import ConfigValidator
|
|
7
|
+
from dbt_platform_helper.domain.copilot_environment import CopilotEnvironment
|
|
8
|
+
from dbt_platform_helper.domain.maintenance_page import MaintenancePage
|
|
9
|
+
from dbt_platform_helper.domain.terraform_environment import TerraformEnvironment
|
|
10
|
+
from dbt_platform_helper.platform_exception import PlatformException
|
|
11
|
+
from dbt_platform_helper.providers.config import ConfigProvider
|
|
12
|
+
from dbt_platform_helper.utils.click import ClickDocOptGroup
|
|
13
|
+
from dbt_platform_helper.utils.versioning import (
|
|
14
|
+
check_platform_helper_version_needs_update,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
AVAILABLE_TEMPLATES = ["default", "migration", "dmas-migration"]
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@click.group(cls=ClickDocOptGroup)
|
|
21
|
+
def environment():
|
|
22
|
+
"""Commands affecting environments."""
|
|
23
|
+
check_platform_helper_version_needs_update()
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@environment.command()
|
|
27
|
+
@click.option("--app", type=str, required=True)
|
|
28
|
+
@click.option("--env", type=str, required=True)
|
|
29
|
+
@click.option("--svc", type=str, required=True, multiple=True, default=["web"])
|
|
30
|
+
@click.option(
|
|
31
|
+
"--template",
|
|
32
|
+
type=click.Choice(AVAILABLE_TEMPLATES),
|
|
33
|
+
default="default",
|
|
34
|
+
help="The maintenance page you wish to put up.",
|
|
35
|
+
)
|
|
36
|
+
@click.option("--vpc", type=str)
|
|
37
|
+
def offline(app, env, svc, template, vpc):
|
|
38
|
+
"""Take load-balanced web services offline with a maintenance page."""
|
|
39
|
+
try:
|
|
40
|
+
MaintenancePage().activate(app, env, svc, template, vpc)
|
|
41
|
+
except PlatformException as err:
|
|
42
|
+
click.secho(str(err), fg="red")
|
|
43
|
+
raise click.Abort
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
@environment.command()
|
|
47
|
+
@click.option("--app", type=str, required=True)
|
|
48
|
+
@click.option("--env", type=str, required=True)
|
|
49
|
+
def online(app, env):
|
|
50
|
+
"""Remove a maintenance page from an environment."""
|
|
51
|
+
try:
|
|
52
|
+
MaintenancePage().deactivate(app, env)
|
|
53
|
+
except PlatformException as err:
|
|
54
|
+
click.secho(str(err), fg="red")
|
|
55
|
+
raise click.Abort
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
@environment.command()
|
|
59
|
+
@click.option("--name", "-n", required=True)
|
|
60
|
+
def generate(name):
|
|
61
|
+
try:
|
|
62
|
+
config_provider = ConfigProvider(ConfigValidator())
|
|
63
|
+
CopilotEnvironment(config_provider).generate(name)
|
|
64
|
+
# TODO this exception will never be caught as the config provider catches schema errors and aborts
|
|
65
|
+
except SchemaError as ex:
|
|
66
|
+
click.secho(f"Invalid `{PLATFORM_CONFIG_FILE}` file: {str(ex)}", fg="red")
|
|
67
|
+
raise click.Abort
|
|
68
|
+
except PlatformException as err:
|
|
69
|
+
click.secho(str(err), fg="red")
|
|
70
|
+
raise click.Abort
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
@environment.command(help="Generate terraform manifest for the specified environment.")
|
|
74
|
+
@click.option(
|
|
75
|
+
"--name", "-n", required=True, help="The name of the environment to generate a manifest for."
|
|
76
|
+
)
|
|
77
|
+
@click.option(
|
|
78
|
+
"--terraform-platform-modules-version",
|
|
79
|
+
help=f"Override the default version of terraform-platform-modules. (Default version is '{DEFAULT_TERRAFORM_PLATFORM_MODULES_VERSION}').",
|
|
80
|
+
)
|
|
81
|
+
def generate_terraform(name, terraform_platform_modules_version):
|
|
82
|
+
|
|
83
|
+
try:
|
|
84
|
+
config_provider = ConfigProvider(ConfigValidator())
|
|
85
|
+
TerraformEnvironment(config_provider).generate(name, terraform_platform_modules_version)
|
|
86
|
+
except PlatformException as err:
|
|
87
|
+
click.secho(str(err), fg="red")
|
|
88
|
+
raise click.Abort
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
|
|
3
|
+
import click
|
|
4
|
+
|
|
5
|
+
from dbt_platform_helper.constants import DEFAULT_TERRAFORM_PLATFORM_MODULES_VERSION
|
|
6
|
+
from dbt_platform_helper.domain.config_validator import ConfigValidator
|
|
7
|
+
from dbt_platform_helper.domain.pipelines import Pipelines
|
|
8
|
+
from dbt_platform_helper.providers.config import ConfigProvider
|
|
9
|
+
from dbt_platform_helper.utils.aws import get_codestar_connection_arn
|
|
10
|
+
from dbt_platform_helper.utils.click import ClickDocOptGroup
|
|
11
|
+
from dbt_platform_helper.utils.git import git_remote
|
|
12
|
+
from dbt_platform_helper.utils.messages import abort_with_error
|
|
13
|
+
from dbt_platform_helper.utils.versioning import (
|
|
14
|
+
check_platform_helper_version_needs_update,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@click.group(chain=True, cls=ClickDocOptGroup)
|
|
19
|
+
def pipeline():
|
|
20
|
+
"""Pipeline commands."""
|
|
21
|
+
check_platform_helper_version_needs_update()
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@pipeline.command()
|
|
25
|
+
@click.option(
|
|
26
|
+
"--terraform-platform-modules-version",
|
|
27
|
+
help=f"""Override the default version of terraform-platform-modules with a specific version or branch.
|
|
28
|
+
Precedence of version used is version supplied via CLI, then the version found in
|
|
29
|
+
platform-config.yml/default_versions/terraform-platform-modules.
|
|
30
|
+
In absence of these inputs, defaults to version '{DEFAULT_TERRAFORM_PLATFORM_MODULES_VERSION}'.""",
|
|
31
|
+
)
|
|
32
|
+
@click.option(
|
|
33
|
+
"--deploy-branch",
|
|
34
|
+
help="""Specify the branch of <application>-deploy used to configure the source stage in the environment-pipeline resource.
|
|
35
|
+
This is generated from the terraform/environments-pipeline/<aws_account>/main.tf file.
|
|
36
|
+
(Default <application>-deploy branch is specified in
|
|
37
|
+
<application>-deploy/platform-config.yml/environment_pipelines/<environment-pipeline>/branch).""",
|
|
38
|
+
default=None,
|
|
39
|
+
)
|
|
40
|
+
def generate(terraform_platform_modules_version, deploy_branch):
|
|
41
|
+
"""
|
|
42
|
+
Given a platform-config.yml file, generate environment and service
|
|
43
|
+
deployment pipelines.
|
|
44
|
+
|
|
45
|
+
This command does the following in relation to the environment pipelines:
|
|
46
|
+
- Reads contents of `platform-config.yml/environment-pipelines` configuration.
|
|
47
|
+
The `terraform/environment-pipelines/<aws_account>/main.tf` file is generated using this configuration.
|
|
48
|
+
The `main.tf` file is then used to generate Terraform for creating an environment pipeline resource.
|
|
49
|
+
|
|
50
|
+
This command does the following in relation to the codebase pipelines:
|
|
51
|
+
- Generates the copilot pipeline manifest.yml for copilot/pipelines/<codebase_pipeline_name>
|
|
52
|
+
"""
|
|
53
|
+
pipelines = Pipelines(
|
|
54
|
+
ConfigProvider(ConfigValidator()),
|
|
55
|
+
click.secho,
|
|
56
|
+
abort_with_error,
|
|
57
|
+
git_remote,
|
|
58
|
+
get_codestar_connection_arn,
|
|
59
|
+
)
|
|
60
|
+
pipelines.generate(terraform_platform_modules_version, deploy_branch)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Todo: Move to Config provider
|
|
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 = "5"
|
|
7
|
+
|
|
8
|
+
# Keys
|
|
9
|
+
CODEBASE_PIPELINES_KEY = "codebase_pipelines"
|
|
10
|
+
ENVIRONMENTS_KEY = "environments"
|
|
11
|
+
ENVIRONMENT_PIPELINES_KEY = "environment_pipelines"
|
|
12
|
+
|
|
13
|
+
# Conduit
|
|
14
|
+
CONDUIT_ADDON_TYPES = [
|
|
15
|
+
"opensearch",
|
|
16
|
+
"postgres",
|
|
17
|
+
"redis",
|
|
18
|
+
]
|
|
19
|
+
CONDUIT_DOCKER_IMAGE_LOCATION = "public.ecr.aws/uktrade/tunnel"
|
|
20
|
+
HYPHENATED_APPLICATION_NAME = "hyphenated-application-name"
|
|
21
|
+
ALPHANUMERIC_ENVIRONMENT_NAME = "alphanumericenvironmentname123"
|
|
22
|
+
ALPHANUMERIC_SERVICE_NAME = "alphanumericservicename123"
|
|
23
|
+
COPILOT_IDENTIFIER = "c0PIlotiD3ntIF3r"
|
|
24
|
+
CLUSTER_NAME_SUFFIX = f"Cluster-{COPILOT_IDENTIFIER}"
|
|
25
|
+
SERVICE_NAME_SUFFIX = f"Service-{COPILOT_IDENTIFIER}"
|
|
26
|
+
REFRESH_TOKEN_MESSAGE = (
|
|
27
|
+
"To refresh this SSO session run `aws sso login` with the corresponding profile"
|
|
28
|
+
)
|
{dbt_platform_helper-12.4.1 → dbt_platform_helper-12.5.1}/dbt_platform_helper/domain/codebase.py
RENAMED
|
@@ -10,6 +10,7 @@ import yaml
|
|
|
10
10
|
from boto3 import Session
|
|
11
11
|
|
|
12
12
|
from dbt_platform_helper.platform_exception import PlatformException
|
|
13
|
+
from dbt_platform_helper.providers.files import FileProvider
|
|
13
14
|
from dbt_platform_helper.utils.application import Application
|
|
14
15
|
from dbt_platform_helper.utils.application import ApplicationException
|
|
15
16
|
from dbt_platform_helper.utils.application import load_application
|
|
@@ -19,7 +20,6 @@ from dbt_platform_helper.utils.aws import get_aws_session_or_abort
|
|
|
19
20
|
from dbt_platform_helper.utils.aws import get_build_url_from_arn
|
|
20
21
|
from dbt_platform_helper.utils.aws import list_latest_images
|
|
21
22
|
from dbt_platform_helper.utils.aws import start_build_extraction
|
|
22
|
-
from dbt_platform_helper.utils.files import mkfile
|
|
23
23
|
from dbt_platform_helper.utils.git import check_if_commit_exists
|
|
24
24
|
from dbt_platform_helper.utils.template import setup_templates
|
|
25
25
|
|
|
@@ -92,7 +92,7 @@ class Codebase:
|
|
|
92
92
|
repository=repository, builder_version=builder_version
|
|
93
93
|
)
|
|
94
94
|
self.echo(
|
|
95
|
-
mkfile(
|
|
95
|
+
FileProvider.mkfile(
|
|
96
96
|
Path("."), ".copilot/image_build_run.sh", image_build_run_contents, overwrite=True
|
|
97
97
|
)
|
|
98
98
|
)
|
|
@@ -100,13 +100,17 @@ class Codebase:
|
|
|
100
100
|
image_build_run_file = Path(".copilot/image_build_run.sh")
|
|
101
101
|
image_build_run_file.chmod(image_build_run_file.stat().st_mode | stat.S_IEXEC)
|
|
102
102
|
|
|
103
|
-
self.echo(
|
|
103
|
+
self.echo(
|
|
104
|
+
FileProvider.mkfile(Path("."), ".copilot/config.yml", config_contents, overwrite=True)
|
|
105
|
+
)
|
|
104
106
|
|
|
105
107
|
for phase in ["build", "install", "post_build", "pre_build"]:
|
|
106
108
|
phase_contents = templates.get_template(f".copilot/phases/{phase}.sh").render()
|
|
107
109
|
|
|
108
110
|
self.echo(
|
|
109
|
-
mkfile(
|
|
111
|
+
FileProvider.mkfile(
|
|
112
|
+
Path("./.copilot"), f"phases/{phase}.sh", phase_contents, overwrite=True
|
|
113
|
+
)
|
|
110
114
|
)
|
|
111
115
|
|
|
112
116
|
def build(self, app: str, codebase: str, commit: str):
|