dbt-platform-helper 13.1.0__py3-none-any.whl → 15.16.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.
- dbt_platform_helper/COMMANDS.md +107 -27
- dbt_platform_helper/commands/application.py +5 -6
- dbt_platform_helper/commands/codebase.py +31 -10
- dbt_platform_helper/commands/conduit.py +3 -5
- dbt_platform_helper/commands/config.py +20 -311
- dbt_platform_helper/commands/copilot.py +18 -391
- dbt_platform_helper/commands/database.py +17 -9
- dbt_platform_helper/commands/environment.py +20 -14
- dbt_platform_helper/commands/generate.py +0 -3
- dbt_platform_helper/commands/internal.py +140 -0
- dbt_platform_helper/commands/notify.py +58 -78
- dbt_platform_helper/commands/pipeline.py +23 -19
- dbt_platform_helper/commands/secrets.py +39 -93
- dbt_platform_helper/commands/version.py +7 -12
- dbt_platform_helper/constants.py +52 -7
- dbt_platform_helper/domain/codebase.py +89 -39
- dbt_platform_helper/domain/conduit.py +335 -76
- dbt_platform_helper/domain/config.py +381 -0
- dbt_platform_helper/domain/copilot.py +398 -0
- dbt_platform_helper/domain/copilot_environment.py +8 -8
- dbt_platform_helper/domain/database_copy.py +2 -2
- dbt_platform_helper/domain/maintenance_page.py +254 -430
- dbt_platform_helper/domain/notify.py +64 -0
- dbt_platform_helper/domain/pipelines.py +43 -35
- dbt_platform_helper/domain/plans.py +41 -0
- dbt_platform_helper/domain/secrets.py +279 -0
- dbt_platform_helper/domain/service.py +570 -0
- dbt_platform_helper/domain/terraform_environment.py +14 -13
- dbt_platform_helper/domain/update_alb_rules.py +412 -0
- dbt_platform_helper/domain/versioning.py +249 -0
- dbt_platform_helper/{providers → entities}/platform_config_schema.py +75 -82
- dbt_platform_helper/entities/semantic_version.py +83 -0
- dbt_platform_helper/entities/service.py +339 -0
- dbt_platform_helper/platform_exception.py +4 -0
- dbt_platform_helper/providers/autoscaling.py +24 -0
- dbt_platform_helper/providers/aws/__init__.py +0 -0
- dbt_platform_helper/providers/aws/exceptions.py +70 -0
- dbt_platform_helper/providers/aws/interfaces.py +13 -0
- dbt_platform_helper/providers/aws/opensearch.py +23 -0
- dbt_platform_helper/providers/aws/redis.py +21 -0
- dbt_platform_helper/providers/aws/sso_auth.py +75 -0
- dbt_platform_helper/providers/cache.py +40 -4
- dbt_platform_helper/providers/cloudformation.py +1 -1
- dbt_platform_helper/providers/config.py +137 -19
- dbt_platform_helper/providers/config_validator.py +112 -51
- dbt_platform_helper/providers/copilot.py +24 -16
- dbt_platform_helper/providers/ecr.py +89 -7
- dbt_platform_helper/providers/ecs.py +228 -36
- dbt_platform_helper/providers/environment_variable.py +24 -0
- dbt_platform_helper/providers/files.py +1 -1
- dbt_platform_helper/providers/io.py +36 -4
- dbt_platform_helper/providers/kms.py +22 -0
- dbt_platform_helper/providers/load_balancers.py +402 -42
- dbt_platform_helper/providers/logs.py +72 -0
- dbt_platform_helper/providers/parameter_store.py +134 -0
- dbt_platform_helper/providers/s3.py +21 -0
- dbt_platform_helper/providers/schema_migrations/__init__.py +0 -0
- dbt_platform_helper/providers/schema_migrations/schema_v0_to_v1_migration.py +43 -0
- dbt_platform_helper/providers/schema_migrator.py +77 -0
- dbt_platform_helper/providers/secrets.py +5 -5
- dbt_platform_helper/providers/slack_channel_notifier.py +62 -0
- dbt_platform_helper/providers/terraform_manifest.py +121 -19
- dbt_platform_helper/providers/version.py +106 -23
- dbt_platform_helper/providers/version_status.py +27 -0
- dbt_platform_helper/providers/vpc.py +36 -5
- dbt_platform_helper/providers/yaml_file.py +58 -2
- dbt_platform_helper/templates/environment-pipelines/main.tf +4 -3
- dbt_platform_helper/templates/svc/overrides/cfn.patches.yml +5 -0
- dbt_platform_helper/utilities/decorators.py +103 -0
- dbt_platform_helper/utils/application.py +119 -22
- dbt_platform_helper/utils/aws.py +39 -150
- dbt_platform_helper/utils/deep_merge.py +10 -0
- dbt_platform_helper/utils/git.py +1 -14
- dbt_platform_helper/utils/validation.py +1 -1
- {dbt_platform_helper-13.1.0.dist-info → dbt_platform_helper-15.16.0.dist-info}/METADATA +11 -20
- dbt_platform_helper-15.16.0.dist-info/RECORD +118 -0
- {dbt_platform_helper-13.1.0.dist-info → dbt_platform_helper-15.16.0.dist-info}/WHEEL +1 -1
- platform_helper.py +3 -1
- terraform/elasticache-redis/plans.yml +85 -0
- terraform/opensearch/plans.yml +71 -0
- terraform/postgres/plans.yml +128 -0
- dbt_platform_helper/addon-plans.yml +0 -224
- dbt_platform_helper/providers/aws.py +0 -37
- dbt_platform_helper/providers/opensearch.py +0 -36
- dbt_platform_helper/providers/redis.py +0 -34
- dbt_platform_helper/providers/semantic_version.py +0 -126
- dbt_platform_helper/templates/svc/manifest-backend.yml +0 -69
- dbt_platform_helper/templates/svc/manifest-public.yml +0 -109
- dbt_platform_helper/utils/cloudfoundry.py +0 -14
- dbt_platform_helper/utils/files.py +0 -53
- dbt_platform_helper/utils/manifests.py +0 -18
- dbt_platform_helper/utils/versioning.py +0 -238
- dbt_platform_helper-13.1.0.dist-info/RECORD +0 -96
- {dbt_platform_helper-13.1.0.dist-info → dbt_platform_helper-15.16.0.dist-info}/entry_points.txt +0 -0
- {dbt_platform_helper-13.1.0.dist-info → dbt_platform_helper-15.16.0.dist-info/licenses}/LICENSE +0 -0
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
# {% version_info %}
|
|
2
|
-
# The manifest for the "{{ name }}" service.
|
|
3
|
-
# Read the full specification for the "Load Balanced Web Service" type at:
|
|
4
|
-
# https://aws.github.io/copilot-cli/docs/manifest/lb-web-service/
|
|
5
|
-
|
|
6
|
-
# Your service name will be used in naming your resources like log groups, ECS services, etc.
|
|
7
|
-
name: {{ name }}
|
|
8
|
-
type: Load Balanced Web Service
|
|
9
|
-
|
|
10
|
-
# Distribute traffic to your service.
|
|
11
|
-
http:
|
|
12
|
-
# Requests to this path will be forwarded to your service.
|
|
13
|
-
# To match all requests you can use the "/" path.
|
|
14
|
-
path: '/'
|
|
15
|
-
# You can specify a custom health check path. The default is "/".
|
|
16
|
-
# healthcheck: '/'
|
|
17
|
-
target_container: nginx
|
|
18
|
-
healthcheck:
|
|
19
|
-
path: '/'
|
|
20
|
-
port: 8080
|
|
21
|
-
success_codes: '200,301,302'
|
|
22
|
-
healthy_threshold: 3
|
|
23
|
-
unhealthy_threshold: 2
|
|
24
|
-
grace_period: 180s
|
|
25
|
-
|
|
26
|
-
sidecars:
|
|
27
|
-
nginx:
|
|
28
|
-
port: 443
|
|
29
|
-
image: public.ecr.aws/uktrade/nginx-dbt-platform:latest
|
|
30
|
-
variables:
|
|
31
|
-
SERVER: localhost:8000
|
|
32
|
-
|
|
33
|
-
ipfilter:
|
|
34
|
-
port: 8000
|
|
35
|
-
image: public.ecr.aws/uktrade/ip-filter:latest
|
|
36
|
-
variables:
|
|
37
|
-
PORT: 8000
|
|
38
|
-
SERVER: localhost:8080
|
|
39
|
-
APPCONFIG_PROFILES: ipfilter:default:default
|
|
40
|
-
IPFILTER_ENABLED: {{ ipfilter }}
|
|
41
|
-
EMAIL: sre@digital.trade.gov.uk
|
|
42
|
-
ADDITIONAL_IP_LIST: /${AWS_PROFILE}/EGRESS_IPS
|
|
43
|
-
|
|
44
|
-
appconfig:
|
|
45
|
-
port: 2772
|
|
46
|
-
image: public.ecr.aws/aws-appconfig/aws-appconfig-agent:2.x
|
|
47
|
-
essential: true
|
|
48
|
-
variables:
|
|
49
|
-
ROLE_ARN: arn:aws:iam::763451185160:role/AppConfigIpFilterRole
|
|
50
|
-
|
|
51
|
-
# Configuration for your containers and service.
|
|
52
|
-
image:
|
|
53
|
-
location: {{ image_location }}
|
|
54
|
-
# Port exposed through your container to route traffic to it.
|
|
55
|
-
port: 8080
|
|
56
|
-
|
|
57
|
-
cpu: 256 # Number of CPU units for the task.
|
|
58
|
-
memory: 512 # Amount of memory in MiB used by the task.
|
|
59
|
-
count: # See https://aws.github.io/copilot-cli/docs/manifest/lb-web-service/#count
|
|
60
|
-
range: 2-10
|
|
61
|
-
cooldown:
|
|
62
|
-
in: 120s
|
|
63
|
-
out: 60s
|
|
64
|
-
cpu_percentage: 50
|
|
65
|
-
exec: true # Enable running commands in your container.
|
|
66
|
-
network:
|
|
67
|
-
connect: true # Enable Service Connect for intra-environment traffic between services.
|
|
68
|
-
vpc:
|
|
69
|
-
placement: 'private'
|
|
70
|
-
|
|
71
|
-
# The application currently may not work if the file system is readonly, e.g...
|
|
72
|
-
# FileNotFoundError: [Errno 2] No usable temporary directory found in ['/tmp', '/var/tmp', '/usr/tmp', '/workspace']
|
|
73
|
-
# ...so you may need to comment out the two lines below...
|
|
74
|
-
storage:
|
|
75
|
-
readonly_fs: true # Limit to read-only access to mounted root filesystems.
|
|
76
|
-
|
|
77
|
-
# Optional fields for more advanced use-cases.
|
|
78
|
-
#
|
|
79
|
-
variables: # Pass environment variables as key value pairs.
|
|
80
|
-
PORT: 8080
|
|
81
|
-
{%- for envvar, value in env_vars.items() %}
|
|
82
|
-
{{ envvar }}: {{ value }}
|
|
83
|
-
{%- endfor %}
|
|
84
|
-
|
|
85
|
-
{% if secrets %}
|
|
86
|
-
secrets: # Pass secrets from AWS Systems Manager (SSM) Parameter Store.
|
|
87
|
-
{%- for secret, value in secrets.items() %}
|
|
88
|
-
{{ secret }}: /copilot/${COPILOT_APPLICATION_NAME}/${COPILOT_ENVIRONMENT_NAME}/secrets/{{ value }}{% endfor -%}
|
|
89
|
-
{% else %}
|
|
90
|
-
# secrets: # Pass secrets from AWS Systems Manager (SSM) Parameter Store.
|
|
91
|
-
{% endif %}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
# You can override any of the values defined above by environment.
|
|
95
|
-
environments:
|
|
96
|
-
{%- for env_name, env in environments.items() %}
|
|
97
|
-
{{ env_name }}:
|
|
98
|
-
http:
|
|
99
|
-
alias: {{ env.url }}
|
|
100
|
-
{%- if env.memory %}
|
|
101
|
-
memory: {{ env.memory }}
|
|
102
|
-
{%- endif %}
|
|
103
|
-
{%- if env.count and env.count is mapping %}
|
|
104
|
-
count: # For options see https://aws.github.io/copilot-cli/docs/manifest/lb-web-service/#count
|
|
105
|
-
{{ env.count | to_yaml | indent(6) | trim }}
|
|
106
|
-
{%- elif env.count %}
|
|
107
|
-
count: {{ env.count }} # For options see https://aws.github.io/copilot-cli/docs/manifest/lb-web-service/#count
|
|
108
|
-
{%- endif %}
|
|
109
|
-
{%- endfor %}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import click
|
|
2
|
-
from cloudfoundry_client.client import CloudFoundryClient
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
def get_cloud_foundry_client_or_abort():
|
|
6
|
-
try:
|
|
7
|
-
client = CloudFoundryClient.build_from_cf_config()
|
|
8
|
-
click.secho("Logged in to Cloud Foundry", fg="green")
|
|
9
|
-
return client
|
|
10
|
-
except Exception as ex:
|
|
11
|
-
click.secho("Could not connect to Cloud Foundry: ", fg="red", nl=False)
|
|
12
|
-
click.secho(str(ex))
|
|
13
|
-
click.secho("Please log in with: cf login", fg="yellow")
|
|
14
|
-
exit(1)
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import click
|
|
2
|
-
import yaml
|
|
3
|
-
from jinja2 import Environment
|
|
4
|
-
from jinja2 import FileSystemLoader
|
|
5
|
-
|
|
6
|
-
from dbt_platform_helper.providers.files import FileProvider
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
def to_yaml(value):
|
|
10
|
-
return yaml.dump(value, sort_keys=False)
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
# TODO - extract file provider functionality from this - and figure out what it actually does!
|
|
14
|
-
# Move to the new file provider - or potentially copilot?
|
|
15
|
-
def generate_override_files(base_path, file_path, output_dir):
|
|
16
|
-
def generate_files_for_dir(pattern):
|
|
17
|
-
for file in file_path.glob(pattern):
|
|
18
|
-
if file.is_file():
|
|
19
|
-
contents = file.read_text()
|
|
20
|
-
file_name = str(file).removeprefix(f"{file_path}/")
|
|
21
|
-
click.echo(
|
|
22
|
-
FileProvider.mkfile(
|
|
23
|
-
base_path,
|
|
24
|
-
output_dir / file_name,
|
|
25
|
-
contents,
|
|
26
|
-
overwrite=True,
|
|
27
|
-
)
|
|
28
|
-
)
|
|
29
|
-
|
|
30
|
-
generate_files_for_dir("*")
|
|
31
|
-
generate_files_for_dir("bin/*")
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
def generate_override_files_from_template(base_path, overrides_path, output_dir, template_data={}):
|
|
35
|
-
templates = Environment(
|
|
36
|
-
loader=FileSystemLoader(f"{overrides_path}"), keep_trailing_newline=True
|
|
37
|
-
)
|
|
38
|
-
environments = ",".join([env["name"] for env in template_data["environments"]])
|
|
39
|
-
data = {"environments": environments}
|
|
40
|
-
|
|
41
|
-
def generate_files_for_dir(pattern):
|
|
42
|
-
|
|
43
|
-
for file in overrides_path.glob(pattern):
|
|
44
|
-
if file.is_file():
|
|
45
|
-
file_name = str(file).removeprefix(f"{overrides_path}/")
|
|
46
|
-
contents = templates.get_template(str(file_name)).render(data)
|
|
47
|
-
message = FileProvider.mkfile(
|
|
48
|
-
base_path, output_dir / file_name, contents, overwrite=True
|
|
49
|
-
)
|
|
50
|
-
click.echo(message)
|
|
51
|
-
|
|
52
|
-
generate_files_for_dir("*")
|
|
53
|
-
generate_files_for_dir("bin/*")
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import yaml
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
def get_service_name_from_manifest(manifest_path):
|
|
5
|
-
with open(manifest_path) as manifest:
|
|
6
|
-
document = yaml.safe_load(manifest)
|
|
7
|
-
return document["name"]
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
def get_repository_name_from_manifest(manifest_path):
|
|
11
|
-
with open(manifest_path) as manifest:
|
|
12
|
-
document = yaml.safe_load(manifest)
|
|
13
|
-
image = document["image"]["location"]
|
|
14
|
-
|
|
15
|
-
repository_with_tag = image.split("/", 1)[1]
|
|
16
|
-
repository = repository_with_tag.split(":")[0]
|
|
17
|
-
|
|
18
|
-
return repository
|
|
@@ -1,238 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
import re
|
|
3
|
-
import subprocess
|
|
4
|
-
from importlib.metadata import PackageNotFoundError
|
|
5
|
-
from importlib.metadata import version
|
|
6
|
-
from pathlib import Path
|
|
7
|
-
|
|
8
|
-
from dbt_platform_helper.constants import DEFAULT_TERRAFORM_PLATFORM_MODULES_VERSION
|
|
9
|
-
from dbt_platform_helper.constants import PLATFORM_HELPER_VERSION_FILE
|
|
10
|
-
from dbt_platform_helper.platform_exception import PlatformException
|
|
11
|
-
from dbt_platform_helper.providers.config import ConfigProvider
|
|
12
|
-
from dbt_platform_helper.providers.io import ClickIOProvider
|
|
13
|
-
from dbt_platform_helper.providers.semantic_version import (
|
|
14
|
-
IncompatibleMajorVersionException,
|
|
15
|
-
)
|
|
16
|
-
from dbt_platform_helper.providers.semantic_version import (
|
|
17
|
-
IncompatibleMinorVersionException,
|
|
18
|
-
)
|
|
19
|
-
from dbt_platform_helper.providers.semantic_version import PlatformHelperVersionStatus
|
|
20
|
-
from dbt_platform_helper.providers.semantic_version import SemanticVersion
|
|
21
|
-
from dbt_platform_helper.providers.semantic_version import VersionStatus
|
|
22
|
-
from dbt_platform_helper.providers.validation import ValidationException
|
|
23
|
-
from dbt_platform_helper.providers.version import GithubVersionProvider
|
|
24
|
-
from dbt_platform_helper.providers.version import PyPiVersionProvider
|
|
25
|
-
from dbt_platform_helper.providers.yaml_file import FileProviderException
|
|
26
|
-
from dbt_platform_helper.providers.yaml_file import YamlFileProvider
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
class PlatformHelperVersionNotFoundException(PlatformException):
|
|
30
|
-
def __init__(self):
|
|
31
|
-
super().__init__(f"""Platform helper version could not be resolved.""")
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
class RequiredVersion:
|
|
35
|
-
def __init__(self, io=None):
|
|
36
|
-
self.io = io or ClickIOProvider()
|
|
37
|
-
|
|
38
|
-
def get_required_platform_helper_version(
|
|
39
|
-
self, pipeline: str = None, versions: PlatformHelperVersionStatus = None
|
|
40
|
-
) -> str:
|
|
41
|
-
if not versions:
|
|
42
|
-
versions = get_platform_helper_versions()
|
|
43
|
-
pipeline_version = versions.pipeline_overrides.get(pipeline)
|
|
44
|
-
version_precedence = [
|
|
45
|
-
pipeline_version,
|
|
46
|
-
versions.platform_config_default,
|
|
47
|
-
versions.deprecated_version_file,
|
|
48
|
-
]
|
|
49
|
-
non_null_version_precedence = [
|
|
50
|
-
f"{v}" if isinstance(v, SemanticVersion) else v for v in version_precedence if v
|
|
51
|
-
]
|
|
52
|
-
|
|
53
|
-
out = non_null_version_precedence[0] if non_null_version_precedence else None
|
|
54
|
-
|
|
55
|
-
if not out:
|
|
56
|
-
raise PlatformHelperVersionNotFoundException
|
|
57
|
-
|
|
58
|
-
return out
|
|
59
|
-
|
|
60
|
-
def get_required_version(self, pipeline=None):
|
|
61
|
-
version = self.get_required_platform_helper_version(pipeline)
|
|
62
|
-
self.io.info(version)
|
|
63
|
-
return version
|
|
64
|
-
|
|
65
|
-
# Used in the generate command
|
|
66
|
-
def check_platform_helper_version_mismatch(self):
|
|
67
|
-
if not running_as_installed_package():
|
|
68
|
-
return
|
|
69
|
-
|
|
70
|
-
versions = get_platform_helper_versions()
|
|
71
|
-
platform_helper_file_version = SemanticVersion.from_string(
|
|
72
|
-
self.get_required_platform_helper_version(versions=versions)
|
|
73
|
-
)
|
|
74
|
-
|
|
75
|
-
if not versions.local == platform_helper_file_version:
|
|
76
|
-
message = (
|
|
77
|
-
f"WARNING: You are running platform-helper v{versions.local} against "
|
|
78
|
-
f"v{platform_helper_file_version} specified by {PLATFORM_HELPER_VERSION_FILE}."
|
|
79
|
-
)
|
|
80
|
-
self.io.warn(message)
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
# Resolves all the versions from pypi, config and locally installed version
|
|
84
|
-
# echos warnings if anything is incompatible
|
|
85
|
-
def get_platform_helper_versions(
|
|
86
|
-
include_project_versions=True, yaml_provider=YamlFileProvider
|
|
87
|
-
) -> PlatformHelperVersionStatus:
|
|
88
|
-
try:
|
|
89
|
-
locally_installed_version = SemanticVersion.from_string(version("dbt-platform-helper"))
|
|
90
|
-
except PackageNotFoundError:
|
|
91
|
-
locally_installed_version = None
|
|
92
|
-
|
|
93
|
-
latest_release = PyPiVersionProvider.get_latest_version("dbt-platform-helper")
|
|
94
|
-
|
|
95
|
-
if not include_project_versions:
|
|
96
|
-
return PlatformHelperVersionStatus(
|
|
97
|
-
local=locally_installed_version,
|
|
98
|
-
latest=latest_release,
|
|
99
|
-
)
|
|
100
|
-
|
|
101
|
-
deprecated_version_file = Path(PLATFORM_HELPER_VERSION_FILE)
|
|
102
|
-
try:
|
|
103
|
-
loaded_version = yaml_provider.load(deprecated_version_file)
|
|
104
|
-
version_from_file = SemanticVersion.from_string(loaded_version)
|
|
105
|
-
except FileProviderException:
|
|
106
|
-
version_from_file = None
|
|
107
|
-
|
|
108
|
-
platform_config_default, pipeline_overrides = None, {}
|
|
109
|
-
|
|
110
|
-
config = ConfigProvider()
|
|
111
|
-
platform_config = config.load_unvalidated_config_file()
|
|
112
|
-
|
|
113
|
-
if platform_config:
|
|
114
|
-
platform_config_default = SemanticVersion.from_string(
|
|
115
|
-
platform_config.get("default_versions", {}).get("platform-helper")
|
|
116
|
-
)
|
|
117
|
-
|
|
118
|
-
pipeline_overrides = {
|
|
119
|
-
name: pipeline.get("versions", {}).get("platform-helper")
|
|
120
|
-
for name, pipeline in platform_config.get("environment_pipelines", {}).items()
|
|
121
|
-
if pipeline.get("versions", {}).get("platform-helper")
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
out = PlatformHelperVersionStatus(
|
|
125
|
-
local=locally_installed_version,
|
|
126
|
-
latest=latest_release,
|
|
127
|
-
deprecated_version_file=version_from_file,
|
|
128
|
-
platform_config_default=platform_config_default,
|
|
129
|
-
pipeline_overrides=pipeline_overrides,
|
|
130
|
-
)
|
|
131
|
-
|
|
132
|
-
_process_version_file_warnings(out)
|
|
133
|
-
|
|
134
|
-
return out
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
# Validates the returned PlatformHelperVersionStatus and echos useful warnings
|
|
138
|
-
# Could return ValidationMessages (warnings and errors) which are output elsewhere
|
|
139
|
-
def _process_version_file_warnings(versions: PlatformHelperVersionStatus, io=ClickIOProvider()):
|
|
140
|
-
messages = versions.warn()
|
|
141
|
-
|
|
142
|
-
if messages.get("errors"):
|
|
143
|
-
io.error("\n".join(messages["errors"]))
|
|
144
|
-
|
|
145
|
-
if messages.get("warnings"):
|
|
146
|
-
io.warn("\n".join(messages["warnings"]))
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
# TODO called at the beginning of every command. This is platform-version base functionality
|
|
150
|
-
def check_platform_helper_version_needs_update(io=ClickIOProvider()):
|
|
151
|
-
if not running_as_installed_package() or "PLATFORM_TOOLS_SKIP_VERSION_CHECK" in os.environ:
|
|
152
|
-
return
|
|
153
|
-
versions = get_platform_helper_versions(include_project_versions=False)
|
|
154
|
-
local_version = versions.local
|
|
155
|
-
latest_release = versions.latest
|
|
156
|
-
message = (
|
|
157
|
-
f"You are running platform-helper v{local_version}, upgrade to "
|
|
158
|
-
f"v{latest_release} by running run `pip install "
|
|
159
|
-
"--upgrade dbt-platform-helper`."
|
|
160
|
-
)
|
|
161
|
-
try:
|
|
162
|
-
local_version.validate_compatibility_with(latest_release)
|
|
163
|
-
except IncompatibleMajorVersionException:
|
|
164
|
-
io.error(message)
|
|
165
|
-
except IncompatibleMinorVersionException:
|
|
166
|
-
io.warn(message)
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
# TODO can stay as utility for now
|
|
170
|
-
def running_as_installed_package():
|
|
171
|
-
return "site-packages" in __file__
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
def get_required_terraform_platform_modules_version(
|
|
175
|
-
cli_terraform_platform_modules_version, platform_config_terraform_modules_default_version
|
|
176
|
-
):
|
|
177
|
-
version_preference_order = [
|
|
178
|
-
cli_terraform_platform_modules_version,
|
|
179
|
-
platform_config_terraform_modules_default_version,
|
|
180
|
-
DEFAULT_TERRAFORM_PLATFORM_MODULES_VERSION,
|
|
181
|
-
]
|
|
182
|
-
return [version for version in version_preference_order if version][0]
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
#########################################
|
|
186
|
-
# Only used in Config domain
|
|
187
|
-
# TODO to be relocated along with tests
|
|
188
|
-
#########################################
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
# Getting version from the "Generated by" comment in a file that was generated from a template
|
|
192
|
-
# TODO where does this belong? It sort of belongs to our platform-helper templating
|
|
193
|
-
def get_template_generated_with_version(template_file_path: str) -> SemanticVersion:
|
|
194
|
-
try:
|
|
195
|
-
template_contents = Path(template_file_path).read_text()
|
|
196
|
-
template_version = re.match(
|
|
197
|
-
r"# Generated by platform-helper ([v.\-0-9]+)", template_contents
|
|
198
|
-
).group(1)
|
|
199
|
-
return SemanticVersion.from_string(template_version)
|
|
200
|
-
except (IndexError, AttributeError):
|
|
201
|
-
raise ValidationException(f"Template {template_file_path} has no version information")
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
def validate_template_version(app_version: SemanticVersion, template_file_path: str):
|
|
205
|
-
app_version.validate_compatibility_with(get_template_generated_with_version(template_file_path))
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
# Local version and latest release of tool.
|
|
209
|
-
# Used only in config command.
|
|
210
|
-
# TODO Move to config domain
|
|
211
|
-
def get_copilot_versions() -> VersionStatus:
|
|
212
|
-
copilot_version = None
|
|
213
|
-
|
|
214
|
-
try:
|
|
215
|
-
response = subprocess.run("copilot --version", capture_output=True, shell=True)
|
|
216
|
-
[copilot_version] = re.findall(r"[0-9.]+", response.stdout.decode("utf8"))
|
|
217
|
-
except ValueError:
|
|
218
|
-
pass
|
|
219
|
-
|
|
220
|
-
return VersionStatus(
|
|
221
|
-
SemanticVersion.from_string(copilot_version),
|
|
222
|
-
GithubVersionProvider.get_latest_version("aws/copilot-cli"),
|
|
223
|
-
)
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
# Local version and latest release of tool.
|
|
227
|
-
# Used only in config command.
|
|
228
|
-
# TODO Move to config domain
|
|
229
|
-
def get_aws_versions() -> VersionStatus:
|
|
230
|
-
aws_version = None
|
|
231
|
-
try:
|
|
232
|
-
response = subprocess.run("aws --version", capture_output=True, shell=True)
|
|
233
|
-
matched = re.match(r"aws-cli/([0-9.]+)", response.stdout.decode("utf8"))
|
|
234
|
-
aws_version = SemanticVersion.from_string(matched.group(1))
|
|
235
|
-
except ValueError:
|
|
236
|
-
pass
|
|
237
|
-
|
|
238
|
-
return VersionStatus(aws_version, GithubVersionProvider.get_latest_version("aws/aws-cli", True))
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
dbt_platform_helper/COMMANDS.md,sha256=tBGjnVDw5sXQfCNyHJfFWWu_40LqxbmfIE_SRVhg97g,22644
|
|
2
|
-
dbt_platform_helper/README.md,sha256=B0qN2_u_ASqqgkGDWY2iwNGZt_9tUgMb9XqtaTuzYjw,1530
|
|
3
|
-
dbt_platform_helper/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
-
dbt_platform_helper/addon-plans.yml,sha256=O46a_ODsGG9KXmQY_1XbSGqrpSaHSLDe-SdROzHx8Go,4545
|
|
5
|
-
dbt_platform_helper/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
-
dbt_platform_helper/commands/application.py,sha256=eVwCaYuwBlk0zx0xfA6fW7b-S1pl8gkyT1lHKeeh2R0,10147
|
|
7
|
-
dbt_platform_helper/commands/codebase.py,sha256=y2d2flGXv44KPv0Rj18gVrDG5t862OEzIoQiOK0STqw,2375
|
|
8
|
-
dbt_platform_helper/commands/conduit.py,sha256=QYMOYyCxFPzj_NJaXs3flIL7sHjOv75uAqPpjgh-EPo,2320
|
|
9
|
-
dbt_platform_helper/commands/config.py,sha256=YdwcR6u3qLM3afeZAAcKr8cqTzIgD7-rT0WdE9g2F0c,11548
|
|
10
|
-
dbt_platform_helper/commands/copilot.py,sha256=crnJeL4IcI2ApU7YWG6hBZ1CGjuQD6jBrr0fATJqSrI,13626
|
|
11
|
-
dbt_platform_helper/commands/database.py,sha256=aG3zcMHL5PE96b7LSAu0FGCbgcycQej3AGRcd-bpXUo,4115
|
|
12
|
-
dbt_platform_helper/commands/environment.py,sha256=KzXe4ai9aD-Go4eN2k5K8ZKY48dKVeE7mp84_grpua0,3912
|
|
13
|
-
dbt_platform_helper/commands/generate.py,sha256=gModp-iOR528t631GYCYx4CXXvpcPco1MzIFIB9eQxA,717
|
|
14
|
-
dbt_platform_helper/commands/notify.py,sha256=lCS_JotQeg4NEpF4x145TCoZs0Pnf_LYf0rB1Iz_Tw0,3884
|
|
15
|
-
dbt_platform_helper/commands/pipeline.py,sha256=g7aWzvU6Z_l7N42n12ls9yAz8VqHLENPWFI-zo-J1-w,3003
|
|
16
|
-
dbt_platform_helper/commands/secrets.py,sha256=QjF9xUChioIr_P0fzqwyEcqLvcN-RNZmNFFlaUPVU9o,3994
|
|
17
|
-
dbt_platform_helper/commands/version.py,sha256=P030Z6lcsXxqlMt3ZijyAgfrKD4wq9xKTyFWolqiNJQ,1357
|
|
18
|
-
dbt_platform_helper/constants.py,sha256=DpHGG54lwjw3XGp2TKCEGNmzaz083lAWMGkEabujDrw,1050
|
|
19
|
-
dbt_platform_helper/default-extensions.yml,sha256=SU1ZitskbuEBpvE7efc3s56eAUF11j70brhj_XrNMMo,493
|
|
20
|
-
dbt_platform_helper/domain/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
21
|
-
dbt_platform_helper/domain/codebase.py,sha256=bLlTRqYmIz8J7W4siQczIJIt4Lc5-bjy-Qo46EyovFw,10496
|
|
22
|
-
dbt_platform_helper/domain/conduit.py,sha256=5C5GnF5jssJ1rFFCY6qaKgvLjYUkyytRJE4tHlanYa0,4370
|
|
23
|
-
dbt_platform_helper/domain/copilot_environment.py,sha256=m6FBduekUR5XLIXcqW26lXif9jF4168f03UxCABaKbI,8947
|
|
24
|
-
dbt_platform_helper/domain/database_copy.py,sha256=CKvI9LsHyowg0bPT9jImk07w4TyQLPoInQoU2TUDiJQ,9485
|
|
25
|
-
dbt_platform_helper/domain/maintenance_page.py,sha256=aV1Fv3APyBakIxpMExeWwB6kk33HFc0tJyjeyRalkOA,20349
|
|
26
|
-
dbt_platform_helper/domain/pipelines.py,sha256=d5QF9iayFPEeqLuo6ztiGoAN_gLaMV91ps9JoGiAAUI,6498
|
|
27
|
-
dbt_platform_helper/domain/terraform_environment.py,sha256=pyUWIxvMESbyp4yAq715JXKKHW133tr1vwxi2cMK5MI,1754
|
|
28
|
-
dbt_platform_helper/jinja2_tags.py,sha256=hKG6RS3zlxJHQ-Op9r2U2-MhWp4s3lZir4Ihe24ApJ0,540
|
|
29
|
-
dbt_platform_helper/platform_exception.py,sha256=bheZV9lqGvrCVTNT92349dVntNDEDWTEwciZgC83WzE,187
|
|
30
|
-
dbt_platform_helper/providers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
31
|
-
dbt_platform_helper/providers/aws.py,sha256=mlorH0fni6m8aUpm1x2jQPhaI3T0QsDMWpoGiSURBcI,1387
|
|
32
|
-
dbt_platform_helper/providers/cache.py,sha256=GIFVdpfXVnVgf2POQvBvZDP6pvYeUFjEuAdAQLbhJXs,2563
|
|
33
|
-
dbt_platform_helper/providers/cloudformation.py,sha256=SvCZgEVqxdpKfQMRAG3KzFQ43YeOEDqMm2tKmFGtacY,5347
|
|
34
|
-
dbt_platform_helper/providers/config.py,sha256=nGpL2_-ko94Dd4YM5vDEpME_8IGEhWpFcLQqKkb_h8E,4145
|
|
35
|
-
dbt_platform_helper/providers/config_validator.py,sha256=of2iD4JX69Ekvs1CbAHU-KHsg9aVUgyB5uHkeYsGGlQ,10722
|
|
36
|
-
dbt_platform_helper/providers/copilot.py,sha256=nBbt-PoGXVkmb9njJti6Et8dq1W9GytW3jGBydNNYYU,5317
|
|
37
|
-
dbt_platform_helper/providers/ecr.py,sha256=lmLKGR5OQT8EyGsX-9M7oO0DHIyoMqgchBAVQBeoBZs,639
|
|
38
|
-
dbt_platform_helper/providers/ecs.py,sha256=XlQHYhZiLGrqR-1ZWMagGH2R2Hy7mCP6676eZL3YbNQ,3842
|
|
39
|
-
dbt_platform_helper/providers/files.py,sha256=cJdOV6Eupi-COmGUMxZMF10BZnMi3MCCipTVUnE_NPA,857
|
|
40
|
-
dbt_platform_helper/providers/io.py,sha256=JkWNIMZ_lcYQ6XvdVAuwtTZjoFIPJ-84zbH09nWLMdk,816
|
|
41
|
-
dbt_platform_helper/providers/load_balancers.py,sha256=Q2h4UT4KVA9E7q55Q4HGKxLlvMtpOXdR-KWQJSqTfm0,2746
|
|
42
|
-
dbt_platform_helper/providers/opensearch.py,sha256=tp64jTzHlutleqMpi2h_ZKH1iakZPJnUODebX6i2mfA,1335
|
|
43
|
-
dbt_platform_helper/providers/platform_config_schema.py,sha256=MDZsDi8bSXkjctmXRgZCCvQY3HtaRJAU5shAx3wWxjc,26725
|
|
44
|
-
dbt_platform_helper/providers/redis.py,sha256=aj8pitxG9IKrMkL3fIYayQhcHPPzApdaXq0Uq_0yblg,1217
|
|
45
|
-
dbt_platform_helper/providers/secrets.py,sha256=6cYIR15dLdHmqxtWQpM6R71e0_Xgsg9V291HBG-0LV0,5272
|
|
46
|
-
dbt_platform_helper/providers/semantic_version.py,sha256=r6EWSzzCHswblzKo4_QyBR4rrR_CUo95NF6eialoiIQ,4395
|
|
47
|
-
dbt_platform_helper/providers/terraform_manifest.py,sha256=hrCjkuQIV0Ymt5MPLkh-BfXHtuAScXhWwNkVEp9K5Jg,9354
|
|
48
|
-
dbt_platform_helper/providers/validation.py,sha256=i2g-Mrd4hy_fGIfGa6ZQy4vTJ40OM44Fe_XpEifGWxs,126
|
|
49
|
-
dbt_platform_helper/providers/version.py,sha256=BvQo5dKHlaUVNgXagnYUtbATafkxtvpz2wfDVsNfyno,1335
|
|
50
|
-
dbt_platform_helper/providers/vpc.py,sha256=EIjjD71K1Ry3V1jyaAkAjZwlwu_FSTn-AS7kiJFiipA,2953
|
|
51
|
-
dbt_platform_helper/providers/yaml_file.py,sha256=D4ESXYBdryT4kJ7Jr3koL05c5Lbn6fFv1YReImrYKQo,2180
|
|
52
|
-
dbt_platform_helper/templates/.copilot/config.yml,sha256=J_bA9sCtBdCPBRImpCBRnYvhQd4vpLYIXIU-lq9vbkA,158
|
|
53
|
-
dbt_platform_helper/templates/.copilot/image_build_run.sh,sha256=adYucYXEB-kAgZNjTQo0T6EIAY8sh_xCEvVhWKKQ8mw,164
|
|
54
|
-
dbt_platform_helper/templates/.copilot/phases/build.sh,sha256=umKXePcRvx4XyrRY0fAWIyYFtNjqBI2L8vIJk-V7C60,121
|
|
55
|
-
dbt_platform_helper/templates/.copilot/phases/install.sh,sha256=pNkEnZBnM4-n1MBzLdPC86YG4Sgj3X7yeQt-swwCunc,123
|
|
56
|
-
dbt_platform_helper/templates/.copilot/phases/post_build.sh,sha256=qdfaViaaPpnjHxI2Uap9DffM0OcV-FYXk7slT51b_vU,126
|
|
57
|
-
dbt_platform_helper/templates/.copilot/phases/pre_build.sh,sha256=rzyjyf7Y7LHH7h-Vv_J--QaR7-dTS_5G-R4iE_9mpQI,836
|
|
58
|
-
dbt_platform_helper/templates/COMMANDS.md.jinja,sha256=8ja7ZGuy1lCP_SWlYrWie---oeO5ucyxfLJkkgwEJ_M,1138
|
|
59
|
-
dbt_platform_helper/templates/addon-instructions.txt,sha256=Dhd1xDbFKnX7xjfCz0W52P6PqPI9M8dyoxoSHAY2fao,597
|
|
60
|
-
dbt_platform_helper/templates/addons/README.md,sha256=UdVydY2ocm1OLKecZ8MAiXet3rKsMiq0PpBrmi0Xrns,412
|
|
61
|
-
dbt_platform_helper/templates/addons/svc/appconfig-ipfilter.yml,sha256=nBIXV4um4jIvXs3Q5QycHqVpJODK5yg_M-xJT6AOBKE,977
|
|
62
|
-
dbt_platform_helper/templates/addons/svc/prometheus-policy.yml,sha256=PwkGwri6IUuullXjEu17RZWYdoJR45Eb7BdUb2_AdOA,1074
|
|
63
|
-
dbt_platform_helper/templates/addons/svc/s3-cross-account-policy.yml,sha256=tZQ5XNIMPxv55Ilu0fIcc1I57dzDaQIQImhfsrijpQY,2211
|
|
64
|
-
dbt_platform_helper/templates/addons/svc/s3-policy.yml,sha256=jwTpFNmm8CaP0c6VXXBJvEm_YLA17Nf-S1xyU1ahLJ8,2164
|
|
65
|
-
dbt_platform_helper/templates/addons/svc/subscription-filter.yml,sha256=irD0AjPc38xTRzEday2Ko-KrjK4hPlyLxUFvUITjMkU,914
|
|
66
|
-
dbt_platform_helper/templates/ci-codebuild-role-policy.json,sha256=hNE-wGrraWxsJAWE9ahtL7Bkw7PEz-CXBQnM3DR70vQ,1836
|
|
67
|
-
dbt_platform_helper/templates/create-codebuild-role.json,sha256=THJgIKi8rWwDzhg5ZxT8a0UkXKBfXZ-zsXm8St_ixPg,197
|
|
68
|
-
dbt_platform_helper/templates/custom-codebuild-role-policy.json,sha256=8xyCofilPhV1Yjt3OnQLcI2kZ35mk2c07GcqYrKxuoI,1180
|
|
69
|
-
dbt_platform_helper/templates/env/manifest.yml,sha256=VCEj_y3jdfnPYi6gmyrwiEqzHYjpaJDANbvswmkiLA0,802
|
|
70
|
-
dbt_platform_helper/templates/env/terraform-overrides/cfn.patches.yml,sha256=cFlg69fvi9kzpz13ZAeY1asseZ6TuUex-6s76jG3oL4,259
|
|
71
|
-
dbt_platform_helper/templates/environment-pipelines/main.tf,sha256=qElclUHb0pv-N7yDuIWxryz3jpjoArMn8cuN2_V63xw,1944
|
|
72
|
-
dbt_platform_helper/templates/svc/maintenance_pages/default.html,sha256=OTZ-qwwSXu7PFbsgp4kppdm1lsg_iHK7FCFqhPnvrEs,741
|
|
73
|
-
dbt_platform_helper/templates/svc/maintenance_pages/dmas-migration.html,sha256=qvI6tHuI0UQbMBCuvPgK1a_zLANB6w7KVo9N5d8r-i0,829
|
|
74
|
-
dbt_platform_helper/templates/svc/maintenance_pages/migration.html,sha256=GiQsOiuaMFb7jG5_wU3V7BMcByHBl9fOBgrNf8quYlw,783
|
|
75
|
-
dbt_platform_helper/templates/svc/manifest-backend.yml,sha256=aAD9ndkbXnF7JBAKS21rl6wmCuIQufHaaAO7yqVHgj4,2571
|
|
76
|
-
dbt_platform_helper/templates/svc/manifest-public.yml,sha256=6NHVR_onBu5hbwynLrB6roDRce7JcylSc0qeYvzlPdI,3664
|
|
77
|
-
dbt_platform_helper/templates/svc/overrides/cfn.patches.yml,sha256=W7-d017akuUq9kda64DQxazavcRcCPDjaAik6t1EZqM,742
|
|
78
|
-
dbt_platform_helper/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
79
|
-
dbt_platform_helper/utils/application.py,sha256=sKJG5vjEJyUZJXnqM3NeZS228SKuv9dvK0EGaWpb0sg,4826
|
|
80
|
-
dbt_platform_helper/utils/arn_parser.py,sha256=BaXzIxSOLdFmP_IfAxRq-0j-0Re1iCN7L4j2Zi5-CRQ,1304
|
|
81
|
-
dbt_platform_helper/utils/aws.py,sha256=C18qEs8rekApGpJ39UslPvmpdFKhKX8Pybvz62YslQU,16918
|
|
82
|
-
dbt_platform_helper/utils/click.py,sha256=Fx4y4bbve1zypvog_sgK7tJtCocmzheoEFLBRv1lfdM,2943
|
|
83
|
-
dbt_platform_helper/utils/cloudfoundry.py,sha256=GnQ4fVLnDfOdNSrsJjI6ElZHqpgwINeoPn77cUH2UFY,484
|
|
84
|
-
dbt_platform_helper/utils/files.py,sha256=adQtG2E1IQHDKfeX06l6j1B7UTYukwBuR_uhJHaoi5M,1873
|
|
85
|
-
dbt_platform_helper/utils/git.py,sha256=7JGZMaI8-cU6-GjXIXjOlsYfKu_RppLOGyAicBd4n_8,704
|
|
86
|
-
dbt_platform_helper/utils/manifests.py,sha256=ji3UYHCxq9tTpkm4MlRa2y0-JOYYqq1pWZ2h_zpj0UU,507
|
|
87
|
-
dbt_platform_helper/utils/messages.py,sha256=nWA7BWLb7ND0WH5TejDN4OQUJSKYBxU4tyCzteCrfT0,142
|
|
88
|
-
dbt_platform_helper/utils/template.py,sha256=g-Db-0I6a6diOHkgK1nYA0IxJSO4TRrjqOvlyeOR32o,950
|
|
89
|
-
dbt_platform_helper/utils/validation.py,sha256=coN7WsKW_nPGW9EU23AInBkAuvUl1NfQvc2bjVtgs14,1188
|
|
90
|
-
dbt_platform_helper/utils/versioning.py,sha256=QCvDUizLNNYbt3iLRqcWxgOP_PMfLIZARUZ5dW542fI,9056
|
|
91
|
-
platform_helper.py,sha256=lUGBsVgsGGJSDXxRvtvZCo2ybRAWuJXosbzfTzkIxU8,1892
|
|
92
|
-
dbt_platform_helper-13.1.0.dist-info/LICENSE,sha256=dP79lN73--7LMApnankTGLqDbImXg8iYFqWgnExGkGk,1090
|
|
93
|
-
dbt_platform_helper-13.1.0.dist-info/METADATA,sha256=9dgW1t_rW-kPfCLMFIvVTYzBza_8x829wo3Yw2-QUB0,3212
|
|
94
|
-
dbt_platform_helper-13.1.0.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
|
95
|
-
dbt_platform_helper-13.1.0.dist-info/entry_points.txt,sha256=QhbY8F434A-onsg0-FsdMd2U6HKh6Q7yCFFZrGUh5-M,67
|
|
96
|
-
dbt_platform_helper-13.1.0.dist-info/RECORD,,
|
{dbt_platform_helper-13.1.0.dist-info → dbt_platform_helper-15.16.0.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{dbt_platform_helper-13.1.0.dist-info → dbt_platform_helper-15.16.0.dist-info/licenses}/LICENSE
RENAMED
|
File without changes
|