dbt-platform-helper 12.5.1__py3-none-any.whl → 12.6.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.md +38 -35
- dbt_platform_helper/commands/codebase.py +5 -8
- dbt_platform_helper/commands/conduit.py +2 -2
- dbt_platform_helper/commands/config.py +1 -1
- dbt_platform_helper/commands/environment.py +32 -18
- dbt_platform_helper/commands/pipeline.py +0 -3
- dbt_platform_helper/domain/codebase.py +13 -20
- dbt_platform_helper/domain/conduit.py +10 -12
- dbt_platform_helper/domain/config_validator.py +40 -7
- dbt_platform_helper/domain/copilot_environment.py +133 -129
- dbt_platform_helper/domain/database_copy.py +38 -37
- dbt_platform_helper/domain/maintenance_page.py +206 -193
- dbt_platform_helper/domain/pipelines.py +10 -11
- dbt_platform_helper/domain/terraform_environment.py +3 -3
- dbt_platform_helper/providers/cloudformation.py +12 -1
- dbt_platform_helper/providers/config.py +10 -12
- dbt_platform_helper/providers/io.py +31 -0
- dbt_platform_helper/providers/load_balancers.py +29 -3
- dbt_platform_helper/providers/platform_config_schema.py +10 -7
- dbt_platform_helper/providers/vpc.py +81 -32
- dbt_platform_helper/templates/COMMANDS.md.jinja +5 -3
- dbt_platform_helper/templates/pipelines/codebase/overrides/package-lock.json +819 -623
- dbt_platform_helper/utils/messages.py +2 -3
- {dbt_platform_helper-12.5.1.dist-info → dbt_platform_helper-12.6.0.dist-info}/METADATA +2 -2
- {dbt_platform_helper-12.5.1.dist-info → dbt_platform_helper-12.6.0.dist-info}/RECORD +28 -27
- {dbt_platform_helper-12.5.1.dist-info → dbt_platform_helper-12.6.0.dist-info}/LICENSE +0 -0
- {dbt_platform_helper-12.5.1.dist-info → dbt_platform_helper-12.6.0.dist-info}/WHEEL +0 -0
- {dbt_platform_helper-12.5.1.dist-info → dbt_platform_helper-12.6.0.dist-info}/entry_points.txt +0 -0
dbt_platform_helper/COMMANDS.md
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
# Commands Reference
|
|
2
2
|
|
|
3
3
|
- [platform-helper](#platform-helper)
|
|
4
|
-
- [platform-helper application](#platform-helper-application)
|
|
5
|
-
- [platform-helper application container-stats](#platform-helper-application-container-stats)
|
|
6
|
-
- [platform-helper application task-stats](#platform-helper-application-task-stats)
|
|
7
|
-
- [platform-helper codebase](#platform-helper-codebase)
|
|
8
|
-
- [platform-helper codebase prepare](#platform-helper-codebase-prepare)
|
|
9
|
-
- [platform-helper codebase list](#platform-helper-codebase-list)
|
|
10
|
-
- [platform-helper codebase build](#platform-helper-codebase-build)
|
|
11
|
-
- [platform-helper codebase deploy](#platform-helper-codebase-deploy)
|
|
12
|
-
- [platform-helper conduit](#platform-helper-conduit)
|
|
13
|
-
- [platform-helper config](#platform-helper-config)
|
|
14
|
-
- [platform-helper config validate](#platform-helper-config-validate)
|
|
15
|
-
- [platform-helper config aws](#platform-helper-config-aws)
|
|
16
|
-
- [platform-helper copilot](#platform-helper-copilot)
|
|
17
|
-
- [platform-helper copilot make-addons](#platform-helper-copilot-make-addons)
|
|
18
|
-
- [platform-helper environment](#platform-helper-environment)
|
|
19
|
-
- [platform-helper environment offline](#platform-helper-environment-offline)
|
|
20
|
-
- [platform-helper environment online](#platform-helper-environment-online)
|
|
21
|
-
- [platform-helper environment generate](#platform-helper-environment-generate)
|
|
22
|
-
- [platform-helper environment generate-terraform](#platform-helper-environment-generate-terraform)
|
|
23
|
-
- [platform-helper generate](#platform-helper-generate)
|
|
24
|
-
- [platform-helper pipeline](#platform-helper-pipeline)
|
|
25
|
-
- [platform-helper pipeline generate](#platform-helper-pipeline-generate)
|
|
26
|
-
- [platform-helper secrets](#platform-helper-secrets)
|
|
27
|
-
- [platform-helper secrets copy](#platform-helper-secrets-copy)
|
|
28
|
-
- [platform-helper secrets list](#platform-helper-secrets-list)
|
|
29
|
-
- [platform-helper notify](#platform-helper-notify)
|
|
30
|
-
- [platform-helper notify environment-progress](#platform-helper-notify-environment-progress)
|
|
31
|
-
- [platform-helper notify add-comment](#platform-helper-notify-add-comment)
|
|
32
|
-
- [platform-helper database](#platform-helper-database)
|
|
33
|
-
- [platform-helper database dump](#platform-helper-database-dump)
|
|
34
|
-
- [platform-helper database load](#platform-helper-database-load)
|
|
35
|
-
- [platform-helper database copy](#platform-helper-database-copy)
|
|
36
|
-
- [platform-helper version](#platform-helper-version)
|
|
37
|
-
- [platform-helper version get-platform-helper-for-project](#platform-helper-version-get-platform-helper-for-project)
|
|
4
|
+
- [platform-helper application](#platform-helper-application)
|
|
5
|
+
- [platform-helper application container-stats](#platform-helper-application-container-stats)
|
|
6
|
+
- [platform-helper application task-stats](#platform-helper-application-task-stats)
|
|
7
|
+
- [platform-helper codebase](#platform-helper-codebase)
|
|
8
|
+
- [platform-helper codebase prepare](#platform-helper-codebase-prepare)
|
|
9
|
+
- [platform-helper codebase list](#platform-helper-codebase-list)
|
|
10
|
+
- [platform-helper codebase build](#platform-helper-codebase-build)
|
|
11
|
+
- [platform-helper codebase deploy](#platform-helper-codebase-deploy)
|
|
12
|
+
- [platform-helper conduit](#platform-helper-conduit)
|
|
13
|
+
- [platform-helper config](#platform-helper-config)
|
|
14
|
+
- [platform-helper config validate](#platform-helper-config-validate)
|
|
15
|
+
- [platform-helper config aws](#platform-helper-config-aws)
|
|
16
|
+
- [platform-helper copilot](#platform-helper-copilot)
|
|
17
|
+
- [platform-helper copilot make-addons](#platform-helper-copilot-make-addons)
|
|
18
|
+
- [platform-helper environment](#platform-helper-environment)
|
|
19
|
+
- [platform-helper environment offline](#platform-helper-environment-offline)
|
|
20
|
+
- [platform-helper environment online](#platform-helper-environment-online)
|
|
21
|
+
- [platform-helper environment generate](#platform-helper-environment-generate)
|
|
22
|
+
- [platform-helper environment generate-terraform](#platform-helper-environment-generate-terraform)
|
|
23
|
+
- [platform-helper generate](#platform-helper-generate)
|
|
24
|
+
- [platform-helper pipeline](#platform-helper-pipeline)
|
|
25
|
+
- [platform-helper pipeline generate](#platform-helper-pipeline-generate)
|
|
26
|
+
- [platform-helper secrets](#platform-helper-secrets)
|
|
27
|
+
- [platform-helper secrets copy](#platform-helper-secrets-copy)
|
|
28
|
+
- [platform-helper secrets list](#platform-helper-secrets-list)
|
|
29
|
+
- [platform-helper notify](#platform-helper-notify)
|
|
30
|
+
- [platform-helper notify environment-progress](#platform-helper-notify-environment-progress)
|
|
31
|
+
- [platform-helper notify add-comment](#platform-helper-notify-add-comment)
|
|
32
|
+
- [platform-helper database](#platform-helper-database)
|
|
33
|
+
- [platform-helper database dump](#platform-helper-database-dump)
|
|
34
|
+
- [platform-helper database load](#platform-helper-database-load)
|
|
35
|
+
- [platform-helper database copy](#platform-helper-database-copy)
|
|
36
|
+
- [platform-helper version](#platform-helper-version)
|
|
37
|
+
- [platform-helper version get-platform-helper-for-project](#platform-helper-version-get-platform-helper-for-project)
|
|
38
38
|
|
|
39
39
|
# platform-helper
|
|
40
40
|
|
|
@@ -457,6 +457,9 @@ platform-helper environment online --app <application> --env <environment>
|
|
|
457
457
|
|
|
458
458
|
[↩ Parent](#platform-helper-environment)
|
|
459
459
|
|
|
460
|
+
Gathers various IDs and ARNs from AWS and generates the AWS Copilot
|
|
461
|
+
environment manifest at copilot/environments/<environment>/manifest.yml.
|
|
462
|
+
|
|
460
463
|
## Usage
|
|
461
464
|
|
|
462
465
|
```
|
|
@@ -467,7 +470,7 @@ platform-helper environment generate --name <name>
|
|
|
467
470
|
|
|
468
471
|
- `--name
|
|
469
472
|
-n <text>`
|
|
470
|
-
|
|
473
|
+
- The name of the environment to generate a copilot manifest for.
|
|
471
474
|
- `--help <boolean>` _Defaults to False._
|
|
472
475
|
- Show this message and exit.
|
|
473
476
|
|
|
@@ -2,6 +2,7 @@ import click
|
|
|
2
2
|
|
|
3
3
|
from dbt_platform_helper.domain.codebase import Codebase
|
|
4
4
|
from dbt_platform_helper.platform_exception import PlatformException
|
|
5
|
+
from dbt_platform_helper.providers.io import ClickIOProvider
|
|
5
6
|
from dbt_platform_helper.utils.click import ClickDocOptGroup
|
|
6
7
|
from dbt_platform_helper.utils.versioning import (
|
|
7
8
|
check_platform_helper_version_needs_update,
|
|
@@ -20,8 +21,7 @@ def prepare():
|
|
|
20
21
|
try:
|
|
21
22
|
Codebase().prepare()
|
|
22
23
|
except PlatformException as err:
|
|
23
|
-
|
|
24
|
-
raise click.Abort
|
|
24
|
+
ClickIOProvider().abort_with_error(str(err))
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
@codebase.command()
|
|
@@ -37,8 +37,7 @@ def list(app, with_images):
|
|
|
37
37
|
try:
|
|
38
38
|
Codebase().list(app, with_images)
|
|
39
39
|
except PlatformException as err:
|
|
40
|
-
|
|
41
|
-
raise click.Abort
|
|
40
|
+
ClickIOProvider().abort_with_error(str(err))
|
|
42
41
|
|
|
43
42
|
|
|
44
43
|
@codebase.command()
|
|
@@ -54,8 +53,7 @@ def build(app, codebase, commit):
|
|
|
54
53
|
try:
|
|
55
54
|
Codebase().build(app, codebase, commit)
|
|
56
55
|
except PlatformException as err:
|
|
57
|
-
|
|
58
|
-
raise click.Abort
|
|
56
|
+
ClickIOProvider().abort_with_error(str(err))
|
|
59
57
|
|
|
60
58
|
|
|
61
59
|
@codebase.command()
|
|
@@ -71,5 +69,4 @@ def deploy(app, env, codebase, commit):
|
|
|
71
69
|
try:
|
|
72
70
|
Codebase().deploy(app, env, codebase, commit)
|
|
73
71
|
except PlatformException as err:
|
|
74
|
-
|
|
75
|
-
raise click.Abort
|
|
72
|
+
ClickIOProvider().abort_with_error(str(err))
|
|
@@ -4,6 +4,7 @@ from dbt_platform_helper.domain.conduit import Conduit
|
|
|
4
4
|
from dbt_platform_helper.platform_exception import PlatformException
|
|
5
5
|
from dbt_platform_helper.providers.cloudformation import CloudFormation
|
|
6
6
|
from dbt_platform_helper.providers.ecs import ECS
|
|
7
|
+
from dbt_platform_helper.providers.io import ClickIOProvider
|
|
7
8
|
from dbt_platform_helper.providers.secrets import Secrets
|
|
8
9
|
from dbt_platform_helper.utils.application import load_application
|
|
9
10
|
from dbt_platform_helper.utils.click import ClickDocOptCommand
|
|
@@ -54,5 +55,4 @@ def conduit(addon_name: str, app: str, env: str, access: str):
|
|
|
54
55
|
env, addon_name, access
|
|
55
56
|
)
|
|
56
57
|
except PlatformException as err:
|
|
57
|
-
|
|
58
|
-
raise click.Abort
|
|
58
|
+
ClickIOProvider().abort_with_error(str(err))
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import click
|
|
2
|
-
from schema import SchemaError
|
|
3
2
|
|
|
4
3
|
from dbt_platform_helper.constants import DEFAULT_TERRAFORM_PLATFORM_MODULES_VERSION
|
|
5
|
-
from dbt_platform_helper.constants import PLATFORM_CONFIG_FILE
|
|
6
4
|
from dbt_platform_helper.domain.config_validator import ConfigValidator
|
|
7
5
|
from dbt_platform_helper.domain.copilot_environment import CopilotEnvironment
|
|
8
6
|
from dbt_platform_helper.domain.maintenance_page import MaintenancePage
|
|
9
7
|
from dbt_platform_helper.domain.terraform_environment import TerraformEnvironment
|
|
10
8
|
from dbt_platform_helper.platform_exception import PlatformException
|
|
9
|
+
from dbt_platform_helper.providers.cloudformation import CloudFormation
|
|
11
10
|
from dbt_platform_helper.providers.config import ConfigProvider
|
|
11
|
+
from dbt_platform_helper.providers.io import ClickIOProvider
|
|
12
|
+
from dbt_platform_helper.providers.vpc import VpcProvider
|
|
13
|
+
from dbt_platform_helper.utils.application import load_application
|
|
14
|
+
from dbt_platform_helper.utils.aws import get_aws_session_or_abort
|
|
12
15
|
from dbt_platform_helper.utils.click import ClickDocOptGroup
|
|
13
16
|
from dbt_platform_helper.utils.versioning import (
|
|
14
17
|
check_platform_helper_version_needs_update,
|
|
@@ -36,11 +39,12 @@ def environment():
|
|
|
36
39
|
@click.option("--vpc", type=str)
|
|
37
40
|
def offline(app, env, svc, template, vpc):
|
|
38
41
|
"""Take load-balanced web services offline with a maintenance page."""
|
|
42
|
+
|
|
39
43
|
try:
|
|
40
|
-
|
|
44
|
+
application = load_application(app)
|
|
45
|
+
MaintenancePage(application).activate(env, svc, template, vpc)
|
|
41
46
|
except PlatformException as err:
|
|
42
|
-
|
|
43
|
-
raise click.Abort
|
|
47
|
+
ClickIOProvider().abort_with_error(str(err))
|
|
44
48
|
|
|
45
49
|
|
|
46
50
|
@environment.command()
|
|
@@ -48,26 +52,37 @@ def offline(app, env, svc, template, vpc):
|
|
|
48
52
|
@click.option("--env", type=str, required=True)
|
|
49
53
|
def online(app, env):
|
|
50
54
|
"""Remove a maintenance page from an environment."""
|
|
55
|
+
|
|
51
56
|
try:
|
|
52
|
-
|
|
57
|
+
application = load_application(app)
|
|
58
|
+
MaintenancePage(application).deactivate(env)
|
|
53
59
|
except PlatformException as err:
|
|
54
|
-
|
|
55
|
-
raise click.Abort
|
|
60
|
+
ClickIOProvider().abort_with_error(str(err))
|
|
56
61
|
|
|
57
62
|
|
|
58
63
|
@environment.command()
|
|
59
|
-
@click.option(
|
|
64
|
+
@click.option(
|
|
65
|
+
"--name",
|
|
66
|
+
"-n",
|
|
67
|
+
required=True,
|
|
68
|
+
help="The name of the environment to generate a copilot manifest for.",
|
|
69
|
+
)
|
|
60
70
|
def generate(name):
|
|
71
|
+
"""Gathers various IDs and ARNs from AWS and generates the AWS Copilot
|
|
72
|
+
environment manifest at copilot/environments/<environment>/manifest.yml."""
|
|
73
|
+
|
|
74
|
+
click_io = ClickIOProvider()
|
|
61
75
|
try:
|
|
76
|
+
session = get_aws_session_or_abort()
|
|
62
77
|
config_provider = ConfigProvider(ConfigValidator())
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
78
|
+
vpc_provider = VpcProvider(session)
|
|
79
|
+
cloudformation_provider = CloudFormation(session.client("cloudformation"))
|
|
80
|
+
|
|
81
|
+
CopilotEnvironment(
|
|
82
|
+
config_provider, vpc_provider, cloudformation_provider, session
|
|
83
|
+
).generate(name)
|
|
68
84
|
except PlatformException as err:
|
|
69
|
-
|
|
70
|
-
raise click.Abort
|
|
85
|
+
click_io.abort_with_error(str(err))
|
|
71
86
|
|
|
72
87
|
|
|
73
88
|
@environment.command(help="Generate terraform manifest for the specified environment.")
|
|
@@ -84,5 +99,4 @@ def generate_terraform(name, terraform_platform_modules_version):
|
|
|
84
99
|
config_provider = ConfigProvider(ConfigValidator())
|
|
85
100
|
TerraformEnvironment(config_provider).generate(name, terraform_platform_modules_version)
|
|
86
101
|
except PlatformException as err:
|
|
87
|
-
|
|
88
|
-
raise click.Abort
|
|
102
|
+
ClickIOProvider().abort_with_error(str(err))
|
|
@@ -9,7 +9,6 @@ from dbt_platform_helper.providers.config import ConfigProvider
|
|
|
9
9
|
from dbt_platform_helper.utils.aws import get_codestar_connection_arn
|
|
10
10
|
from dbt_platform_helper.utils.click import ClickDocOptGroup
|
|
11
11
|
from dbt_platform_helper.utils.git import git_remote
|
|
12
|
-
from dbt_platform_helper.utils.messages import abort_with_error
|
|
13
12
|
from dbt_platform_helper.utils.versioning import (
|
|
14
13
|
check_platform_helper_version_needs_update,
|
|
15
14
|
)
|
|
@@ -52,8 +51,6 @@ def generate(terraform_platform_modules_version, deploy_branch):
|
|
|
52
51
|
"""
|
|
53
52
|
pipelines = Pipelines(
|
|
54
53
|
ConfigProvider(ConfigValidator()),
|
|
55
|
-
click.secho,
|
|
56
|
-
abort_with_error,
|
|
57
54
|
git_remote,
|
|
58
55
|
get_codestar_connection_arn,
|
|
59
56
|
)
|
|
@@ -4,13 +4,13 @@ import subprocess
|
|
|
4
4
|
from collections.abc import Callable
|
|
5
5
|
from pathlib import Path
|
|
6
6
|
|
|
7
|
-
import click
|
|
8
7
|
import requests
|
|
9
8
|
import yaml
|
|
10
9
|
from boto3 import Session
|
|
11
10
|
|
|
12
11
|
from dbt_platform_helper.platform_exception import PlatformException
|
|
13
12
|
from dbt_platform_helper.providers.files import FileProvider
|
|
13
|
+
from dbt_platform_helper.providers.io import ClickIOProvider
|
|
14
14
|
from dbt_platform_helper.utils.application import Application
|
|
15
15
|
from dbt_platform_helper.utils.application import ApplicationException
|
|
16
16
|
from dbt_platform_helper.utils.application import load_application
|
|
@@ -27,9 +27,7 @@ from dbt_platform_helper.utils.template import setup_templates
|
|
|
27
27
|
class Codebase:
|
|
28
28
|
def __init__(
|
|
29
29
|
self,
|
|
30
|
-
|
|
31
|
-
echo: Callable[[str], str] = click.secho,
|
|
32
|
-
confirm: Callable[[str], bool] = click.confirm,
|
|
30
|
+
io: ClickIOProvider = ClickIOProvider(),
|
|
33
31
|
load_application: Callable[[str], Application] = load_application,
|
|
34
32
|
get_aws_session_or_abort: Callable[[str], Session] = get_aws_session_or_abort,
|
|
35
33
|
check_codebase_exists: Callable[[str], str] = check_codebase_exists,
|
|
@@ -40,9 +38,7 @@ class Codebase:
|
|
|
40
38
|
check_if_commit_exists: Callable[[str], str] = check_if_commit_exists,
|
|
41
39
|
run_subprocess: Callable[[str], str] = subprocess.run,
|
|
42
40
|
):
|
|
43
|
-
self.
|
|
44
|
-
self.echo = echo
|
|
45
|
-
self.confirm = confirm
|
|
41
|
+
self.io = io
|
|
46
42
|
self.load_application = load_application
|
|
47
43
|
self.get_aws_session_or_abort = get_aws_session_or_abort
|
|
48
44
|
self.check_codebase_exists = check_codebase_exists
|
|
@@ -91,7 +87,7 @@ class Codebase:
|
|
|
91
87
|
config_contents = templates.get_template(f".copilot/config.yml").render(
|
|
92
88
|
repository=repository, builder_version=builder_version
|
|
93
89
|
)
|
|
94
|
-
self.
|
|
90
|
+
self.io.info(
|
|
95
91
|
FileProvider.mkfile(
|
|
96
92
|
Path("."), ".copilot/image_build_run.sh", image_build_run_contents, overwrite=True
|
|
97
93
|
)
|
|
@@ -100,14 +96,14 @@ class Codebase:
|
|
|
100
96
|
image_build_run_file = Path(".copilot/image_build_run.sh")
|
|
101
97
|
image_build_run_file.chmod(image_build_run_file.stat().st_mode | stat.S_IEXEC)
|
|
102
98
|
|
|
103
|
-
self.
|
|
99
|
+
self.io.info(
|
|
104
100
|
FileProvider.mkfile(Path("."), ".copilot/config.yml", config_contents, overwrite=True)
|
|
105
101
|
)
|
|
106
102
|
|
|
107
103
|
for phase in ["build", "install", "post_build", "pre_build"]:
|
|
108
104
|
phase_contents = templates.get_template(f".copilot/phases/{phase}.sh").render()
|
|
109
105
|
|
|
110
|
-
self.
|
|
106
|
+
self.io.info(
|
|
111
107
|
FileProvider.mkfile(
|
|
112
108
|
Path("./.copilot"), f"phases/{phase}.sh", phase_contents, overwrite=True
|
|
113
109
|
)
|
|
@@ -122,7 +118,6 @@ class Codebase:
|
|
|
122
118
|
|
|
123
119
|
codebuild_client = session.client("codebuild")
|
|
124
120
|
build_url = self.__start_build_with_confirmation(
|
|
125
|
-
self.confirm,
|
|
126
121
|
codebuild_client,
|
|
127
122
|
self.get_build_url_from_arn,
|
|
128
123
|
f'You are about to build "{app}" for "{codebase}" with commit "{commit}". Do you want to continue?',
|
|
@@ -134,7 +129,7 @@ class Codebase:
|
|
|
134
129
|
)
|
|
135
130
|
|
|
136
131
|
if build_url:
|
|
137
|
-
return self.
|
|
132
|
+
return self.io.info(
|
|
138
133
|
f"Your build has been triggered. Check your build progress in the AWS Console: {build_url}"
|
|
139
134
|
)
|
|
140
135
|
|
|
@@ -154,7 +149,6 @@ class Codebase:
|
|
|
154
149
|
|
|
155
150
|
codebuild_client = session.client("codebuild")
|
|
156
151
|
build_url = self.__start_build_with_confirmation(
|
|
157
|
-
self.confirm,
|
|
158
152
|
codebuild_client,
|
|
159
153
|
self.get_build_url_from_arn,
|
|
160
154
|
f'You are about to deploy "{app}" for "{codebase}" with commit "{commit}" to the "{env}" environment. Do you want to continue?',
|
|
@@ -170,7 +164,7 @@ class Codebase:
|
|
|
170
164
|
)
|
|
171
165
|
|
|
172
166
|
if build_url:
|
|
173
|
-
return self.
|
|
167
|
+
return self.io.info(
|
|
174
168
|
"Your deployment has been triggered. Check your build progress in the AWS Console: "
|
|
175
169
|
f"{build_url}",
|
|
176
170
|
)
|
|
@@ -185,19 +179,19 @@ class Codebase:
|
|
|
185
179
|
ecr_client = session.client("ecr")
|
|
186
180
|
codebases = self.__get_codebases(application, ssm_client)
|
|
187
181
|
|
|
188
|
-
self.
|
|
182
|
+
self.io.info("The following codebases are available:")
|
|
189
183
|
|
|
190
184
|
for codebase in codebases:
|
|
191
|
-
self.
|
|
185
|
+
self.io.info(f"- {codebase['name']} (https://github.com/{codebase['repository']})")
|
|
192
186
|
if with_images:
|
|
193
187
|
self.list_latest_images(
|
|
194
188
|
ecr_client,
|
|
195
189
|
f"{application.name}/{codebase['name']}",
|
|
196
190
|
codebase["repository"],
|
|
197
|
-
self.
|
|
191
|
+
self.io.info,
|
|
198
192
|
)
|
|
199
193
|
|
|
200
|
-
self.
|
|
194
|
+
self.io.info("")
|
|
201
195
|
|
|
202
196
|
def __get_codebases(self, application, ssm_client):
|
|
203
197
|
parameters = ssm_client.get_parameters_by_path(
|
|
@@ -213,13 +207,12 @@ class Codebase:
|
|
|
213
207
|
|
|
214
208
|
def __start_build_with_confirmation(
|
|
215
209
|
self,
|
|
216
|
-
confirm,
|
|
217
210
|
codebuild_client,
|
|
218
211
|
get_build_url_from_arn,
|
|
219
212
|
confirmation_message,
|
|
220
213
|
build_options,
|
|
221
214
|
):
|
|
222
|
-
if confirm(confirmation_message):
|
|
215
|
+
if self.io.confirm(confirmation_message):
|
|
223
216
|
build_arn = self.start_build_extraction(codebuild_client, build_options)
|
|
224
217
|
return get_build_url_from_arn(build_arn)
|
|
225
218
|
return None
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import subprocess
|
|
2
|
-
from collections.abc import Callable
|
|
3
|
-
|
|
4
|
-
import click
|
|
5
2
|
|
|
6
3
|
from dbt_platform_helper.providers.cloudformation import CloudFormation
|
|
7
4
|
from dbt_platform_helper.providers.copilot import connect_to_addon_client_task
|
|
8
5
|
from dbt_platform_helper.providers.copilot import create_addon_client_task
|
|
9
6
|
from dbt_platform_helper.providers.ecs import ECS
|
|
7
|
+
from dbt_platform_helper.providers.io import ClickIOProvider
|
|
10
8
|
from dbt_platform_helper.providers.secrets import Secrets
|
|
11
9
|
from dbt_platform_helper.utils.application import Application
|
|
12
10
|
|
|
@@ -18,7 +16,7 @@ class Conduit:
|
|
|
18
16
|
secrets_provider: Secrets,
|
|
19
17
|
cloudformation_provider: CloudFormation,
|
|
20
18
|
ecs_provider: ECS,
|
|
21
|
-
|
|
19
|
+
io: ClickIOProvider = ClickIOProvider(),
|
|
22
20
|
subprocess: subprocess = subprocess,
|
|
23
21
|
connect_to_addon_client_task=connect_to_addon_client_task,
|
|
24
22
|
create_addon_client_task=create_addon_client_task,
|
|
@@ -29,7 +27,7 @@ class Conduit:
|
|
|
29
27
|
self.cloudformation_provider = cloudformation_provider
|
|
30
28
|
self.ecs_provider = ecs_provider
|
|
31
29
|
self.subprocess = subprocess
|
|
32
|
-
self.
|
|
30
|
+
self.io = io
|
|
33
31
|
self.connect_to_addon_client_task = connect_to_addon_client_task
|
|
34
32
|
self.create_addon_client_task = create_addon_client_task
|
|
35
33
|
|
|
@@ -39,10 +37,10 @@ class Conduit:
|
|
|
39
37
|
addon_name, access
|
|
40
38
|
)
|
|
41
39
|
|
|
42
|
-
self.
|
|
40
|
+
self.io.info(f"Checking if a conduit task is already running for {addon_type}")
|
|
43
41
|
task_arns = self.ecs_provider.get_ecs_task_arns(cluster_arn, task_name)
|
|
44
42
|
if not task_arns:
|
|
45
|
-
self.
|
|
43
|
+
self.io.info("Creating conduit task")
|
|
46
44
|
self.create_addon_client_task(
|
|
47
45
|
clients["iam"],
|
|
48
46
|
clients["ssm"],
|
|
@@ -55,7 +53,7 @@ class Conduit:
|
|
|
55
53
|
access,
|
|
56
54
|
)
|
|
57
55
|
|
|
58
|
-
self.
|
|
56
|
+
self.io.info("Updating conduit task")
|
|
59
57
|
self._update_stack_resources(
|
|
60
58
|
self.application.name,
|
|
61
59
|
env,
|
|
@@ -69,13 +67,13 @@ class Conduit:
|
|
|
69
67
|
task_arns = self.ecs_provider.get_ecs_task_arns(cluster_arn, task_name)
|
|
70
68
|
|
|
71
69
|
else:
|
|
72
|
-
self.
|
|
70
|
+
self.io.info("Conduit task already running")
|
|
73
71
|
|
|
74
|
-
self.
|
|
72
|
+
self.io.info(f"Checking if exec is available for conduit task...")
|
|
75
73
|
|
|
76
74
|
self.ecs_provider.ecs_exec_is_available(cluster_arn, task_arns)
|
|
77
75
|
|
|
78
|
-
self.
|
|
76
|
+
self.io.info("Connecting to conduit task")
|
|
79
77
|
self.connect_to_addon_client_task(
|
|
80
78
|
clients["ecs"], self.subprocess, self.application.name, env, cluster_arn, task_name
|
|
81
79
|
)
|
|
@@ -115,7 +113,7 @@ class Conduit:
|
|
|
115
113
|
parameter_name,
|
|
116
114
|
access,
|
|
117
115
|
)
|
|
118
|
-
self.
|
|
116
|
+
self.io.info("Waiting for conduit task update to complete...")
|
|
119
117
|
self.cloudformation_provider.wait_for_cloudformation_to_reach_status(
|
|
120
118
|
"stack_update_complete", stack_name
|
|
121
119
|
)
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
from typing import Callable
|
|
2
2
|
|
|
3
3
|
import boto3
|
|
4
|
-
import click
|
|
5
4
|
|
|
6
5
|
from dbt_platform_helper.constants import CODEBASE_PIPELINES_KEY
|
|
7
6
|
from dbt_platform_helper.constants import ENVIRONMENTS_KEY
|
|
8
7
|
from dbt_platform_helper.constants import PLATFORM_CONFIG_FILE
|
|
8
|
+
from dbt_platform_helper.providers.io import ClickIOProvider
|
|
9
9
|
from dbt_platform_helper.providers.opensearch import OpensearchProvider
|
|
10
10
|
from dbt_platform_helper.providers.redis import RedisProvider
|
|
11
11
|
from dbt_platform_helper.utils.messages import abort_with_error
|
|
@@ -13,7 +13,9 @@ from dbt_platform_helper.utils.messages import abort_with_error
|
|
|
13
13
|
|
|
14
14
|
class ConfigValidator:
|
|
15
15
|
|
|
16
|
-
def __init__(
|
|
16
|
+
def __init__(
|
|
17
|
+
self, validations: Callable[[dict], None] = None, io: ClickIOProvider = ClickIOProvider()
|
|
18
|
+
):
|
|
17
19
|
self.validations = validations or [
|
|
18
20
|
self.validate_supported_redis_versions,
|
|
19
21
|
self.validate_supported_opensearch_versions,
|
|
@@ -21,7 +23,9 @@ class ConfigValidator:
|
|
|
21
23
|
self.validate_codebase_pipelines,
|
|
22
24
|
self.validate_environment_pipelines_triggers,
|
|
23
25
|
self.validate_database_copy_section,
|
|
26
|
+
self.validate_database_migration_input_sources,
|
|
24
27
|
]
|
|
28
|
+
self.io = io
|
|
25
29
|
|
|
26
30
|
def run_validations(self, config: dict):
|
|
27
31
|
for validation in self.validations:
|
|
@@ -48,9 +52,8 @@ class ConfigValidator:
|
|
|
48
52
|
environments = extension.get("environments", {})
|
|
49
53
|
|
|
50
54
|
if not isinstance(environments, dict):
|
|
51
|
-
|
|
52
|
-
f"
|
|
53
|
-
fg="red",
|
|
55
|
+
self.io.error(
|
|
56
|
+
f"{extension_type} extension definition is invalid type, expected dictionary",
|
|
54
57
|
)
|
|
55
58
|
continue
|
|
56
59
|
for environment, env_config in environments.items():
|
|
@@ -64,9 +67,8 @@ class ConfigValidator:
|
|
|
64
67
|
)
|
|
65
68
|
|
|
66
69
|
for version_failure in extensions_with_invalid_version:
|
|
67
|
-
|
|
70
|
+
self.io.error(
|
|
68
71
|
f"{extension_type} version for environment {version_failure['environment']} is not in the list of supported {extension_type} versions: {supported_extension_versions}. Provided Version: {version_failure['version']}",
|
|
69
|
-
fg="red",
|
|
70
72
|
)
|
|
71
73
|
|
|
72
74
|
def validate_supported_redis_versions(self, config):
|
|
@@ -240,3 +242,34 @@ class ConfigValidator:
|
|
|
240
242
|
|
|
241
243
|
if errors:
|
|
242
244
|
abort_with_error("\n".join(errors))
|
|
245
|
+
|
|
246
|
+
def validate_database_migration_input_sources(self, config):
|
|
247
|
+
extensions = config.get("extensions", {})
|
|
248
|
+
if not extensions:
|
|
249
|
+
return
|
|
250
|
+
|
|
251
|
+
s3_extensions = {
|
|
252
|
+
key: ext for key, ext in extensions.items() if ext.get("type", None) == "s3"
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
if not s3_extensions:
|
|
256
|
+
return
|
|
257
|
+
|
|
258
|
+
errors = []
|
|
259
|
+
|
|
260
|
+
for extension_name, extension in s3_extensions.items():
|
|
261
|
+
for env, env_config in extension.get("environments", {}).items():
|
|
262
|
+
if "data_migration" not in env_config:
|
|
263
|
+
continue
|
|
264
|
+
data_migration = env_config.get("data_migration", {})
|
|
265
|
+
if "import" in data_migration and "import_sources" in data_migration:
|
|
266
|
+
errors.append(
|
|
267
|
+
f"Error in '{extension_name}.environments.{env}.data_migration': only the 'import_sources' property is required - 'import' is deprecated."
|
|
268
|
+
)
|
|
269
|
+
if "import" not in data_migration and "import_sources" not in data_migration:
|
|
270
|
+
errors.append(
|
|
271
|
+
f"Error in '{extension_name}.environments.{env}.data_migration': 'import_sources' property is missing."
|
|
272
|
+
)
|
|
273
|
+
|
|
274
|
+
if errors:
|
|
275
|
+
abort_with_error("\n".join(errors))
|