dbt-platform-helper 13.2.0__tar.gz → 13.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of dbt-platform-helper might be problematic. Click here for more details.
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/PKG-INFO +2 -2
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/COMMANDS.md +7 -2
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/commands/codebase.py +29 -6
- dbt_platform_helper-13.4.0/dbt_platform_helper/commands/config.py +38 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/commands/copilot.py +10 -6
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/commands/database.py +17 -9
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/commands/environment.py +2 -3
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/domain/codebase.py +68 -25
- dbt_platform_helper-13.4.0/dbt_platform_helper/domain/config.py +345 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/domain/copilot.py +155 -157
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/domain/versioning.py +48 -7
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/providers/aws/exceptions.py +12 -2
- dbt_platform_helper-13.4.0/dbt_platform_helper/providers/aws/sso_auth.py +61 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/providers/config.py +2 -1
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/providers/config_validator.py +15 -13
- dbt_platform_helper-13.4.0/dbt_platform_helper/providers/ecr.py +77 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/providers/io.py +2 -2
- dbt_platform_helper-13.4.0/dbt_platform_helper/providers/parameter_store.py +47 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/providers/platform_config_schema.py +17 -0
- dbt_platform_helper-13.4.0/dbt_platform_helper/providers/semantic_version.py +76 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/providers/terraform_manifest.py +1 -0
- dbt_platform_helper-13.4.0/dbt_platform_helper/providers/version.py +136 -0
- dbt_platform_helper-13.2.0/dbt_platform_helper/providers/semantic_version.py → dbt_platform_helper-13.4.0/dbt_platform_helper/providers/version_status.py +1 -70
- dbt_platform_helper-13.4.0/dbt_platform_helper/utils/__init__.py +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/utils/aws.py +0 -135
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/utils/git.py +3 -1
- dbt_platform_helper-13.4.0/dbt_platform_helper/utils/tool_versioning.py +12 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/platform_helper.py +1 -1
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/pyproject.toml +2 -3
- dbt_platform_helper-13.2.0/dbt_platform_helper/commands/config.py +0 -340
- dbt_platform_helper-13.2.0/dbt_platform_helper/providers/ecr.py +0 -20
- dbt_platform_helper-13.2.0/dbt_platform_helper/providers/version.py +0 -78
- dbt_platform_helper-13.2.0/dbt_platform_helper/templates/svc/manifest-backend.yml +0 -69
- dbt_platform_helper-13.2.0/dbt_platform_helper/templates/svc/manifest-public.yml +0 -109
- dbt_platform_helper-13.2.0/dbt_platform_helper/utils/cloudfoundry.py +0 -14
- dbt_platform_helper-13.2.0/dbt_platform_helper/utils/files.py +0 -53
- dbt_platform_helper-13.2.0/dbt_platform_helper/utils/manifests.py +0 -18
- dbt_platform_helper-13.2.0/dbt_platform_helper/utils/tool_versioning.py +0 -96
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/LICENSE +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/README.md +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/__init__.py +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/addon-plans.yml +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/commands/__init__.py +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/commands/application.py +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/commands/conduit.py +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/commands/generate.py +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/commands/notify.py +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/commands/pipeline.py +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/commands/secrets.py +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/commands/version.py +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/constants.py +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/default-extensions.yml +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/domain/__init__.py +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/domain/conduit.py +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/domain/copilot_environment.py +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/domain/database_copy.py +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/domain/maintenance_page.py +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/domain/pipelines.py +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/domain/terraform_environment.py +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/jinja2_tags.py +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/platform_exception.py +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/providers/__init__.py +0 -0
- {dbt_platform_helper-13.2.0/dbt_platform_helper/utils → dbt_platform_helper-13.4.0/dbt_platform_helper/providers/aws}/__init__.py +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/providers/aws/interfaces.py +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/providers/aws/opensearch.py +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/providers/aws/redis.py +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/providers/cache.py +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/providers/cloudformation.py +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/providers/copilot.py +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/providers/ecs.py +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/providers/files.py +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/providers/kms.py +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/providers/load_balancers.py +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/providers/secrets.py +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/providers/validation.py +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/providers/vpc.py +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/providers/yaml_file.py +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/templates/.copilot/config.yml +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/templates/.copilot/image_build_run.sh +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/templates/.copilot/phases/build.sh +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/templates/.copilot/phases/install.sh +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/templates/.copilot/phases/post_build.sh +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/templates/.copilot/phases/pre_build.sh +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/templates/COMMANDS.md.jinja +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/templates/addon-instructions.txt +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/templates/addons/README.md +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/templates/addons/svc/appconfig-ipfilter.yml +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/templates/addons/svc/prometheus-policy.yml +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/templates/addons/svc/s3-cross-account-policy.yml +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/templates/addons/svc/s3-policy.yml +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/templates/addons/svc/subscription-filter.yml +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/templates/ci-codebuild-role-policy.json +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/templates/create-codebuild-role.json +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/templates/custom-codebuild-role-policy.json +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/templates/env/manifest.yml +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/templates/env/terraform-overrides/cfn.patches.yml +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/templates/environment-pipelines/main.tf +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/templates/svc/maintenance_pages/default.html +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/templates/svc/maintenance_pages/dmas-migration.html +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/templates/svc/maintenance_pages/migration.html +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/templates/svc/overrides/cfn.patches.yml +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/utils/application.py +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/utils/arn_parser.py +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/utils/click.py +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/utils/messages.py +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/utils/template.py +0 -0
- {dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/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.
|
|
3
|
+
Version: 13.4.0
|
|
4
4
|
Summary: Set of tools to help transfer applications/services from GOV.UK PaaS to DBT PaaS augmenting AWS Copilot.
|
|
5
5
|
License: MIT
|
|
6
6
|
Author: Department for Business and Trade Platform Team
|
|
@@ -12,7 +12,7 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.11
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.12
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
-
Requires-Dist: Jinja2 (==3.1.
|
|
15
|
+
Requires-Dist: Jinja2 (==3.1.6)
|
|
16
16
|
Requires-Dist: PyYAML (==6.0.1)
|
|
17
17
|
Requires-Dist: aiohttp (>=3.8.4,<4.0.0)
|
|
18
18
|
Requires-Dist: boto3 (>=1.28.24,<2.0.0)
|
|
@@ -236,7 +236,8 @@ platform-helper codebase build --app <application> --codebase <codebase>
|
|
|
236
236
|
|
|
237
237
|
```
|
|
238
238
|
platform-helper codebase deploy --app <application> --env <environment> --codebase <codebase>
|
|
239
|
-
--
|
|
239
|
+
[--tag <tag>] [--branch <branch>]
|
|
240
|
+
[--commit <commit>]
|
|
240
241
|
```
|
|
241
242
|
|
|
242
243
|
## Options
|
|
@@ -247,8 +248,12 @@ platform-helper codebase deploy --app <application> --env <environment> --codeba
|
|
|
247
248
|
- AWS Copilot environment
|
|
248
249
|
- `--codebase <text>`
|
|
249
250
|
- The codebase name as specified in the platform-config.yml file. This can be run from any directory.
|
|
251
|
+
- `--tag <text>`
|
|
252
|
+
- Git tag that has been built into an image. Typically a semantic version of the form 1.2.3 or v1.2.3.
|
|
253
|
+
- `--branch <text>`
|
|
254
|
+
- Git branch that has been built into an image.
|
|
250
255
|
- `--commit <text>`
|
|
251
|
-
-
|
|
256
|
+
- Git sha hash that has been built into an image.
|
|
252
257
|
- `--help <boolean>` _Defaults to False._
|
|
253
258
|
- Show this message and exit.
|
|
254
259
|
|
{dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/commands/codebase.py
RENAMED
|
@@ -4,6 +4,8 @@ from dbt_platform_helper.domain.codebase import Codebase
|
|
|
4
4
|
from dbt_platform_helper.domain.versioning import PlatformHelperVersioning
|
|
5
5
|
from dbt_platform_helper.platform_exception import PlatformException
|
|
6
6
|
from dbt_platform_helper.providers.io import ClickIOProvider
|
|
7
|
+
from dbt_platform_helper.providers.parameter_store import ParameterStore
|
|
8
|
+
from dbt_platform_helper.utils.aws import get_aws_session_or_abort
|
|
7
9
|
from dbt_platform_helper.utils.click import ClickDocOptGroup
|
|
8
10
|
|
|
9
11
|
|
|
@@ -17,7 +19,7 @@ def codebase():
|
|
|
17
19
|
def prepare():
|
|
18
20
|
"""Sets up an application codebase for use within a DBT platform project."""
|
|
19
21
|
try:
|
|
20
|
-
Codebase().prepare()
|
|
22
|
+
Codebase(ParameterStore(get_aws_session_or_abort().client("ssm"))).prepare()
|
|
21
23
|
except PlatformException as err:
|
|
22
24
|
ClickIOProvider().abort_with_error(str(err))
|
|
23
25
|
|
|
@@ -33,7 +35,7 @@ def prepare():
|
|
|
33
35
|
def list(app, with_images):
|
|
34
36
|
"""List available codebases for the application."""
|
|
35
37
|
try:
|
|
36
|
-
Codebase().list(app, with_images)
|
|
38
|
+
Codebase(ParameterStore(get_aws_session_or_abort().client("ssm"))).list(app, with_images)
|
|
37
39
|
except PlatformException as err:
|
|
38
40
|
ClickIOProvider().abort_with_error(str(err))
|
|
39
41
|
|
|
@@ -49,7 +51,9 @@ def list(app, with_images):
|
|
|
49
51
|
def build(app, codebase, commit):
|
|
50
52
|
"""Trigger a CodePipeline pipeline based build."""
|
|
51
53
|
try:
|
|
52
|
-
Codebase().build(
|
|
54
|
+
Codebase(ParameterStore(get_aws_session_or_abort().client("ssm"))).build(
|
|
55
|
+
app, codebase, commit
|
|
56
|
+
)
|
|
53
57
|
except PlatformException as err:
|
|
54
58
|
ClickIOProvider().abort_with_error(str(err))
|
|
55
59
|
|
|
@@ -62,9 +66,28 @@ def build(app, codebase, commit):
|
|
|
62
66
|
help="The codebase name as specified in the platform-config.yml file. This can be run from any directory.",
|
|
63
67
|
required=True,
|
|
64
68
|
)
|
|
65
|
-
@click.option(
|
|
66
|
-
|
|
69
|
+
@click.option(
|
|
70
|
+
"--tag",
|
|
71
|
+
help="Git tag that has been built into an image. Typically a semantic version of the form 1.2.3 or v1.2.3.",
|
|
72
|
+
required=False,
|
|
73
|
+
)
|
|
74
|
+
@click.option(
|
|
75
|
+
"--branch",
|
|
76
|
+
help="Git branch that has been built into an image.",
|
|
77
|
+
required=False,
|
|
78
|
+
)
|
|
79
|
+
@click.option(
|
|
80
|
+
"--commit",
|
|
81
|
+
help="Git sha hash that has been built into an image.",
|
|
82
|
+
required=False,
|
|
83
|
+
)
|
|
84
|
+
def deploy(
|
|
85
|
+
app: str, env: str, codebase: str, commit: str = None, tag: str = None, branch: str = None
|
|
86
|
+
):
|
|
87
|
+
|
|
67
88
|
try:
|
|
68
|
-
Codebase().deploy(
|
|
89
|
+
Codebase(ParameterStore(get_aws_session_or_abort().client("ssm"))).deploy(
|
|
90
|
+
app, env, codebase, commit, tag, branch
|
|
91
|
+
)
|
|
69
92
|
except PlatformException as err:
|
|
70
93
|
ClickIOProvider().abort_with_error(str(err))
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import click
|
|
2
|
+
|
|
3
|
+
from dbt_platform_helper.domain.config import Config
|
|
4
|
+
from dbt_platform_helper.platform_exception import PlatformException
|
|
5
|
+
from dbt_platform_helper.providers.aws.sso_auth import SSOAuthProvider
|
|
6
|
+
from dbt_platform_helper.providers.io import ClickIOProvider
|
|
7
|
+
from dbt_platform_helper.utils.aws import get_aws_session_or_abort
|
|
8
|
+
from dbt_platform_helper.utils.click import ClickDocOptGroup
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@click.group(cls=ClickDocOptGroup)
|
|
12
|
+
def config():
|
|
13
|
+
"""Perform actions on configuration files."""
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@config.command()
|
|
17
|
+
def validate():
|
|
18
|
+
"""Validate deployment or application configuration."""
|
|
19
|
+
try:
|
|
20
|
+
Config().validate()
|
|
21
|
+
except PlatformException as err:
|
|
22
|
+
ClickIOProvider().abort_with_error(str(err))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
@config.command()
|
|
26
|
+
@click.option("--file-path", "-fp", default="~/.aws/config")
|
|
27
|
+
def aws(file_path):
|
|
28
|
+
"""
|
|
29
|
+
Writes a local config file containing all the AWS profiles to which the
|
|
30
|
+
logged in user has access.
|
|
31
|
+
|
|
32
|
+
If no `--file-path` is specified, defaults to `~/.aws/config`.
|
|
33
|
+
"""
|
|
34
|
+
try:
|
|
35
|
+
session = get_aws_session_or_abort()
|
|
36
|
+
Config(sso=SSOAuthProvider(session)).generate_aws(file_path)
|
|
37
|
+
except PlatformException as err:
|
|
38
|
+
ClickIOProvider().abort_with_error(str(err))
|
{dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/commands/copilot.py
RENAMED
|
@@ -10,13 +10,10 @@ from dbt_platform_helper.providers.config_validator import ConfigValidator
|
|
|
10
10
|
from dbt_platform_helper.providers.files import FileProvider
|
|
11
11
|
from dbt_platform_helper.providers.io import ClickIOProvider
|
|
12
12
|
from dbt_platform_helper.providers.kms import KMSProvider
|
|
13
|
+
from dbt_platform_helper.providers.parameter_store import ParameterStore
|
|
13
14
|
from dbt_platform_helper.utils.aws import get_aws_session_or_abort
|
|
14
15
|
from dbt_platform_helper.utils.click import ClickDocOptGroup
|
|
15
16
|
|
|
16
|
-
# TODOs
|
|
17
|
-
# Figure out a pattern for copilot templating and the new copilot domain - probably a lot of overlap here that really belongs in the copilottemplating domain instead (atleast whatever is concerned with "templating")
|
|
18
|
-
# Check for E2E test coverage.
|
|
19
|
-
|
|
20
17
|
|
|
21
18
|
@click.group(chain=True, cls=ClickDocOptGroup)
|
|
22
19
|
def copilot():
|
|
@@ -28,8 +25,15 @@ def make_addons():
|
|
|
28
25
|
"""Generate addons CloudFormation for each environment."""
|
|
29
26
|
try:
|
|
30
27
|
session = get_aws_session_or_abort()
|
|
28
|
+
parameter_provider = ParameterStore(session.client("ssm"))
|
|
31
29
|
config_provider = ConfigProvider(ConfigValidator())
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
Copilot(
|
|
31
|
+
config_provider,
|
|
32
|
+
parameter_provider,
|
|
33
|
+
FileProvider(),
|
|
34
|
+
CopilotTemplating(),
|
|
35
|
+
KMSProvider,
|
|
36
|
+
session,
|
|
37
|
+
).make_addons()
|
|
34
38
|
except Exception as err:
|
|
35
39
|
ClickIOProvider().abort_with_error(str(err))
|
{dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/commands/database.py
RENAMED
|
@@ -2,6 +2,8 @@ import click
|
|
|
2
2
|
|
|
3
3
|
from dbt_platform_helper.commands.environment import AVAILABLE_TEMPLATES
|
|
4
4
|
from dbt_platform_helper.domain.database_copy import DatabaseCopy
|
|
5
|
+
from dbt_platform_helper.platform_exception import PlatformException
|
|
6
|
+
from dbt_platform_helper.providers.io import ClickIOProvider
|
|
5
7
|
from dbt_platform_helper.utils.click import ClickDocOptGroup
|
|
6
8
|
|
|
7
9
|
|
|
@@ -38,9 +40,11 @@ def database():
|
|
|
38
40
|
)
|
|
39
41
|
def dump(app, from_env, database, from_vpc, filename):
|
|
40
42
|
"""Dump a database into an S3 bucket."""
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
try:
|
|
44
|
+
data_copy = DatabaseCopy(app, database)
|
|
45
|
+
data_copy.dump(from_env, from_vpc, filename)
|
|
46
|
+
except PlatformException as err:
|
|
47
|
+
ClickIOProvider().abort_with_error(str(err))
|
|
44
48
|
|
|
45
49
|
|
|
46
50
|
@database.command(name="load")
|
|
@@ -68,9 +72,11 @@ def dump(app, from_env, database, from_vpc, filename):
|
|
|
68
72
|
)
|
|
69
73
|
def load(app, to_env, database, to_vpc, auto_approve, filename):
|
|
70
74
|
"""Load a database from an S3 bucket."""
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
75
|
+
try:
|
|
76
|
+
data_copy = DatabaseCopy(app, database, auto_approve)
|
|
77
|
+
data_copy.load(to_env, to_vpc, filename)
|
|
78
|
+
except PlatformException as err:
|
|
79
|
+
ClickIOProvider().abort_with_error(str(err))
|
|
74
80
|
|
|
75
81
|
|
|
76
82
|
@database.command(name="copy")
|
|
@@ -120,6 +126,8 @@ def copy(
|
|
|
120
126
|
no_maintenance_page,
|
|
121
127
|
):
|
|
122
128
|
"""Copy a database between environments."""
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
129
|
+
try:
|
|
130
|
+
data_copy = DatabaseCopy(app, database, auto_approve)
|
|
131
|
+
data_copy.copy(from_env, to_env, from_vpc, to_vpc, svc, template, no_maintenance_page)
|
|
132
|
+
except PlatformException as err:
|
|
133
|
+
ClickIOProvider().abort_with_error(str(err))
|
|
@@ -94,9 +94,8 @@ def generate(name):
|
|
|
94
94
|
def generate_terraform(name, terraform_platform_modules_version):
|
|
95
95
|
click_io = ClickIOProvider()
|
|
96
96
|
try:
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
config_provider = ConfigProvider(ConfigValidator())
|
|
97
|
+
session = get_aws_session_or_abort()
|
|
98
|
+
config_provider = ConfigProvider(ConfigValidator(session=session))
|
|
100
99
|
TerraformEnvironment(config_provider).generate(name, terraform_platform_modules_version)
|
|
101
100
|
except PlatformException as err:
|
|
102
101
|
click_io.abort_with_error(str(err))
|
{dbt_platform_helper-13.2.0 → dbt_platform_helper-13.4.0}/dbt_platform_helper/domain/codebase.py
RENAMED
|
@@ -3,20 +3,22 @@ import stat
|
|
|
3
3
|
import subprocess
|
|
4
4
|
from collections.abc import Callable
|
|
5
5
|
from pathlib import Path
|
|
6
|
+
from typing import Tuple
|
|
6
7
|
|
|
7
8
|
import requests
|
|
8
9
|
import yaml
|
|
9
10
|
from boto3 import Session
|
|
10
11
|
|
|
11
12
|
from dbt_platform_helper.platform_exception import PlatformException
|
|
13
|
+
from dbt_platform_helper.providers.ecr import ECRProvider
|
|
12
14
|
from dbt_platform_helper.providers.files import FileProvider
|
|
13
15
|
from dbt_platform_helper.providers.io import ClickIOProvider
|
|
16
|
+
from dbt_platform_helper.providers.parameter_store import ParameterStore
|
|
14
17
|
from dbt_platform_helper.utils.application import Application
|
|
15
18
|
from dbt_platform_helper.utils.application import (
|
|
16
19
|
ApplicationEnvironmentNotFoundException,
|
|
17
20
|
)
|
|
18
21
|
from dbt_platform_helper.utils.application import load_application
|
|
19
|
-
from dbt_platform_helper.utils.aws import check_image_exists
|
|
20
22
|
from dbt_platform_helper.utils.aws import get_aws_session_or_abort
|
|
21
23
|
from dbt_platform_helper.utils.aws import get_build_url_from_arn
|
|
22
24
|
from dbt_platform_helper.utils.aws import get_build_url_from_pipeline_execution_id
|
|
@@ -32,10 +34,11 @@ from dbt_platform_helper.utils.template import setup_templates
|
|
|
32
34
|
class Codebase:
|
|
33
35
|
def __init__(
|
|
34
36
|
self,
|
|
37
|
+
parameter_provider: ParameterStore,
|
|
35
38
|
io: ClickIOProvider = ClickIOProvider(),
|
|
36
39
|
load_application: Callable[[str], Application] = load_application,
|
|
37
40
|
get_aws_session_or_abort: Callable[[str], Session] = get_aws_session_or_abort,
|
|
38
|
-
|
|
41
|
+
ecr_provider: ECRProvider = ECRProvider(),
|
|
39
42
|
get_image_build_project: Callable[[str], str] = get_image_build_project,
|
|
40
43
|
get_manual_release_pipeline: Callable[[str], str] = get_manual_release_pipeline,
|
|
41
44
|
get_build_url_from_arn: Callable[[str], str] = get_build_url_from_arn,
|
|
@@ -50,10 +53,11 @@ class Codebase:
|
|
|
50
53
|
check_if_commit_exists: Callable[[str], str] = check_if_commit_exists,
|
|
51
54
|
run_subprocess: Callable[[str], str] = subprocess.run,
|
|
52
55
|
):
|
|
56
|
+
self.parameter_provider = parameter_provider
|
|
53
57
|
self.io = io
|
|
54
58
|
self.load_application = load_application
|
|
55
59
|
self.get_aws_session_or_abort = get_aws_session_or_abort
|
|
56
|
-
self.
|
|
60
|
+
self.ecr_provider = ecr_provider
|
|
57
61
|
self.get_image_build_project = get_image_build_project
|
|
58
62
|
self.get_manual_release_pipeline = get_manual_release_pipeline
|
|
59
63
|
self.get_build_url_from_arn = get_build_url_from_arn
|
|
@@ -151,31 +155,54 @@ class Codebase:
|
|
|
151
155
|
|
|
152
156
|
raise ApplicationDeploymentNotTriggered(codebase)
|
|
153
157
|
|
|
154
|
-
def deploy(
|
|
158
|
+
def deploy(
|
|
159
|
+
self,
|
|
160
|
+
app: str,
|
|
161
|
+
env: str,
|
|
162
|
+
codebase: str,
|
|
163
|
+
commit: str = None,
|
|
164
|
+
tag: str = None,
|
|
165
|
+
branch: str = None,
|
|
166
|
+
):
|
|
155
167
|
"""Trigger a CodePipeline pipeline based deployment."""
|
|
156
|
-
session = self.get_aws_session_or_abort()
|
|
157
168
|
|
|
158
|
-
|
|
159
|
-
if not application.environments.get(env):
|
|
160
|
-
raise ApplicationEnvironmentNotFoundException(application.name, env)
|
|
169
|
+
self._validate_reference_flags(commit, tag, branch)
|
|
161
170
|
|
|
162
|
-
self.
|
|
171
|
+
application, session = self._populate_application_values(app, env)
|
|
163
172
|
|
|
164
|
-
|
|
173
|
+
image_ref = None
|
|
174
|
+
if commit:
|
|
175
|
+
image_ref = f"commit-{commit[0:7]}"
|
|
176
|
+
elif tag:
|
|
177
|
+
image_ref = f"tag-{tag}"
|
|
178
|
+
elif branch:
|
|
179
|
+
image_ref = f"branch-{branch}"
|
|
180
|
+
image_details = self.ecr_provider.get_image_details(application, codebase, image_ref)
|
|
181
|
+
image_ref = self.ecr_provider.find_commit_tag(image_details, image_ref)
|
|
165
182
|
|
|
183
|
+
codepipeline_client = session.client("codepipeline")
|
|
166
184
|
pipeline_name = self.get_manual_release_pipeline(codepipeline_client, app, codebase)
|
|
167
185
|
|
|
186
|
+
corresponding_to = ""
|
|
187
|
+
if tag:
|
|
188
|
+
corresponding_to = f"(corresponding to tag {tag}) "
|
|
189
|
+
elif branch:
|
|
190
|
+
corresponding_to = f"(corresponding to branch {branch}) "
|
|
191
|
+
|
|
192
|
+
confirmation_message = f'\nYou are about to deploy "{app}" for "{codebase}" with image reference "{image_ref}" {corresponding_to}to the "{env}" environment using the "{pipeline_name}" deployment pipeline. Do you want to continue?'
|
|
193
|
+
build_options = {
|
|
194
|
+
"name": pipeline_name,
|
|
195
|
+
"variables": [
|
|
196
|
+
{"name": "ENVIRONMENT", "value": env},
|
|
197
|
+
{"name": "IMAGE_TAG", "value": image_ref},
|
|
198
|
+
],
|
|
199
|
+
}
|
|
200
|
+
|
|
168
201
|
build_url = self.__start_pipeline_execution_with_confirmation(
|
|
169
202
|
codepipeline_client,
|
|
170
203
|
self.get_build_url_from_pipeline_execution_id,
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
"name": pipeline_name,
|
|
174
|
-
"variables": [
|
|
175
|
-
{"name": "ENVIRONMENT", "value": env},
|
|
176
|
-
{"name": "IMAGE_TAG", "value": f"commit-{commit}"},
|
|
177
|
-
],
|
|
178
|
-
},
|
|
204
|
+
confirmation_message,
|
|
205
|
+
build_options,
|
|
179
206
|
)
|
|
180
207
|
|
|
181
208
|
if build_url:
|
|
@@ -186,13 +213,31 @@ class Codebase:
|
|
|
186
213
|
|
|
187
214
|
raise ApplicationDeploymentNotTriggered(codebase)
|
|
188
215
|
|
|
216
|
+
def _validate_reference_flags(self, commit: str, tag: str, branch: str):
|
|
217
|
+
provided = [ref for ref in [commit, tag, branch] if ref]
|
|
218
|
+
|
|
219
|
+
if len(provided) == 0:
|
|
220
|
+
self.io.abort_with_error(
|
|
221
|
+
"To deploy, you must provide one of the options --commit, --tag or --branch."
|
|
222
|
+
)
|
|
223
|
+
elif len(provided) > 1:
|
|
224
|
+
self.io.abort_with_error(
|
|
225
|
+
"You have provided more than one of the --tag, --branch and --commit options but these are mutually exclusive. Please provide only one of these options."
|
|
226
|
+
)
|
|
227
|
+
|
|
228
|
+
def _populate_application_values(self, app: str, env: str) -> Tuple[Application, Session]:
|
|
229
|
+
session = self.get_aws_session_or_abort()
|
|
230
|
+
application = self.load_application(app, default_session=session)
|
|
231
|
+
if not application.environments.get(env):
|
|
232
|
+
raise ApplicationEnvironmentNotFoundException(application.name, env)
|
|
233
|
+
return application, session
|
|
234
|
+
|
|
189
235
|
def list(self, app: str, with_images: bool):
|
|
190
236
|
"""List available codebases for the application."""
|
|
191
237
|
session = self.get_aws_session_or_abort()
|
|
192
238
|
application = self.load_application(app, session)
|
|
193
|
-
ssm_client = session.client("ssm")
|
|
194
239
|
ecr_client = session.client("ecr")
|
|
195
|
-
codebases = self.__get_codebases(application,
|
|
240
|
+
codebases = self.__get_codebases(application, session.client("ssm"))
|
|
196
241
|
|
|
197
242
|
self.io.info("The following codebases are available:")
|
|
198
243
|
|
|
@@ -209,11 +254,9 @@ class Codebase:
|
|
|
209
254
|
self.io.info("")
|
|
210
255
|
|
|
211
256
|
def __get_codebases(self, application, ssm_client):
|
|
212
|
-
parameters =
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
)["Parameters"]
|
|
216
|
-
|
|
257
|
+
parameters = self.parameter_provider.get_ssm_parameters_by_path(
|
|
258
|
+
f"/copilot/applications/{application.name}/codebases"
|
|
259
|
+
)
|
|
217
260
|
codebases = [json.loads(p["Value"]) for p in parameters]
|
|
218
261
|
|
|
219
262
|
if not codebases:
|