dbt-platform-helper 13.0.0__py3-none-any.whl → 13.0.2__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 +2 -2
- dbt_platform_helper/commands/config.py +26 -33
- dbt_platform_helper/commands/generate.py +2 -2
- dbt_platform_helper/commands/version.py +30 -30
- dbt_platform_helper/domain/config_validator.py +10 -5
- dbt_platform_helper/domain/copilot_environment.py +10 -9
- dbt_platform_helper/domain/database_copy.py +6 -3
- dbt_platform_helper/domain/maintenance_page.py +32 -7
- dbt_platform_helper/domain/terraform_environment.py +17 -61
- dbt_platform_helper/providers/config.py +11 -1
- dbt_platform_helper/providers/files.py +13 -12
- dbt_platform_helper/providers/load_balancers.py +4 -2
- dbt_platform_helper/providers/semantic_version.py +126 -0
- dbt_platform_helper/providers/terraform_manifest.py +117 -26
- dbt_platform_helper/providers/validation.py +0 -14
- dbt_platform_helper/providers/version.py +36 -0
- dbt_platform_helper/providers/vpc.py +0 -5
- dbt_platform_helper/providers/yaml_file.py +5 -3
- dbt_platform_helper/utils/application.py +3 -2
- dbt_platform_helper/utils/versioning.py +152 -221
- {dbt_platform_helper-13.0.0.dist-info → dbt_platform_helper-13.0.2.dist-info}/METADATA +1 -1
- {dbt_platform_helper-13.0.0.dist-info → dbt_platform_helper-13.0.2.dist-info}/RECORD +26 -27
- platform_helper.py +2 -2
- dbt_platform_helper/domain/test_platform_terraform_manifest_generator.py +0 -100
- dbt_platform_helper/templates/environments/main.tf +0 -46
- dbt_platform_helper/utils/platform_config.py +0 -20
- {dbt_platform_helper-13.0.0.dist-info → dbt_platform_helper-13.0.2.dist-info}/LICENSE +0 -0
- {dbt_platform_helper-13.0.0.dist-info → dbt_platform_helper-13.0.2.dist-info}/WHEEL +0 -0
- {dbt_platform_helper-13.0.0.dist-info → dbt_platform_helper-13.0.2.dist-info}/entry_points.txt +0 -0
|
@@ -4,142 +4,116 @@ import subprocess
|
|
|
4
4
|
from importlib.metadata import PackageNotFoundError
|
|
5
5
|
from importlib.metadata import version
|
|
6
6
|
from pathlib import Path
|
|
7
|
-
from typing import Optional
|
|
8
|
-
from typing import Tuple
|
|
9
|
-
from typing import Union
|
|
10
7
|
|
|
11
8
|
import click
|
|
12
|
-
import requests
|
|
13
9
|
|
|
14
10
|
from dbt_platform_helper.constants import DEFAULT_TERRAFORM_PLATFORM_MODULES_VERSION
|
|
15
|
-
from dbt_platform_helper.constants import PLATFORM_CONFIG_FILE
|
|
16
11
|
from dbt_platform_helper.constants import PLATFORM_HELPER_VERSION_FILE
|
|
17
|
-
from dbt_platform_helper.
|
|
18
|
-
from dbt_platform_helper.providers.
|
|
12
|
+
from dbt_platform_helper.platform_exception import PlatformException
|
|
13
|
+
from dbt_platform_helper.providers.config import ConfigProvider
|
|
14
|
+
from dbt_platform_helper.providers.io import ClickIOProvider
|
|
15
|
+
from dbt_platform_helper.providers.semantic_version import (
|
|
16
|
+
IncompatibleMajorVersionException,
|
|
17
|
+
)
|
|
18
|
+
from dbt_platform_helper.providers.semantic_version import (
|
|
19
|
+
IncompatibleMinorVersionException,
|
|
20
|
+
)
|
|
21
|
+
from dbt_platform_helper.providers.semantic_version import PlatformHelperVersionStatus
|
|
22
|
+
from dbt_platform_helper.providers.semantic_version import SemanticVersion
|
|
23
|
+
from dbt_platform_helper.providers.semantic_version import VersionStatus
|
|
19
24
|
from dbt_platform_helper.providers.validation import ValidationException
|
|
20
|
-
from dbt_platform_helper.
|
|
25
|
+
from dbt_platform_helper.providers.version import GithubVersionProvider
|
|
26
|
+
from dbt_platform_helper.providers.version import PyPiVersionProvider
|
|
27
|
+
from dbt_platform_helper.providers.yaml_file import FileProviderException
|
|
28
|
+
from dbt_platform_helper.providers.yaml_file import YamlFileProvider
|
|
21
29
|
|
|
22
|
-
VersionTuple = Optional[Tuple[int, int, int]]
|
|
23
30
|
|
|
31
|
+
class PlatformHelperVersionNotFoundException(PlatformException):
|
|
32
|
+
def __init__(self):
|
|
33
|
+
super().__init__(f"""Platform helper version could not be resolved.""")
|
|
24
34
|
|
|
25
|
-
class Versions:
|
|
26
|
-
def __init__(self, local_version: VersionTuple = None, latest_release: VersionTuple = None):
|
|
27
|
-
self.local_version = local_version
|
|
28
|
-
self.latest_release = latest_release
|
|
29
35
|
|
|
36
|
+
class RequiredVersion:
|
|
37
|
+
def __init__(self, io=None):
|
|
38
|
+
self.io = io or ClickIOProvider()
|
|
30
39
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
def get_required_platform_helper_version(
|
|
41
|
+
self, pipeline: str = None, versions: PlatformHelperVersionStatus = None
|
|
42
|
+
) -> str:
|
|
43
|
+
if not versions:
|
|
44
|
+
versions = get_platform_helper_versions()
|
|
45
|
+
pipeline_version = versions.pipeline_overrides.get(pipeline)
|
|
46
|
+
version_precedence = [
|
|
47
|
+
pipeline_version,
|
|
48
|
+
versions.platform_config_default,
|
|
49
|
+
versions.deprecated_version_file,
|
|
50
|
+
]
|
|
51
|
+
non_null_version_precedence = [
|
|
52
|
+
f"{v}" if isinstance(v, SemanticVersion) else v for v in version_precedence if v
|
|
53
|
+
]
|
|
45
54
|
|
|
55
|
+
out = non_null_version_precedence[0] if non_null_version_precedence else None
|
|
46
56
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
return "unknown"
|
|
50
|
-
major, minor, patch = input_version
|
|
51
|
-
return ".".join([str(s) for s in [major, minor, patch]])
|
|
57
|
+
if not out:
|
|
58
|
+
raise PlatformHelperVersionNotFoundException
|
|
52
59
|
|
|
60
|
+
return out
|
|
53
61
|
|
|
54
|
-
def
|
|
55
|
-
|
|
56
|
-
|
|
62
|
+
def get_required_version(self, pipeline=None):
|
|
63
|
+
version = self.get_required_platform_helper_version(pipeline)
|
|
64
|
+
self.io.info(version)
|
|
65
|
+
return version
|
|
57
66
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
return None
|
|
63
|
-
|
|
64
|
-
output_version = [0, 0, 0]
|
|
65
|
-
for index, segment in enumerate(version_segments):
|
|
66
|
-
try:
|
|
67
|
-
output_version[index] = int(segment)
|
|
68
|
-
except ValueError:
|
|
69
|
-
output_version[index] = -1
|
|
70
|
-
return output_version[0], output_version[1], output_version[2]
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
def get_copilot_versions() -> Versions:
|
|
74
|
-
copilot_version = None
|
|
75
|
-
|
|
76
|
-
try:
|
|
77
|
-
response = subprocess.run("copilot --version", capture_output=True, shell=True)
|
|
78
|
-
[copilot_version] = re.findall(r"[0-9.]+", response.stdout.decode("utf8"))
|
|
79
|
-
except ValueError:
|
|
80
|
-
pass
|
|
81
|
-
|
|
82
|
-
return Versions(parse_version(copilot_version), get_github_released_version("aws/copilot-cli"))
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
def get_aws_versions() -> Versions:
|
|
86
|
-
aws_version = None
|
|
87
|
-
try:
|
|
88
|
-
response = subprocess.run("aws --version", capture_output=True, shell=True)
|
|
89
|
-
matched = re.match(r"aws-cli/([0-9.]+)", response.stdout.decode("utf8"))
|
|
90
|
-
aws_version = parse_version(matched.group(1))
|
|
91
|
-
except ValueError:
|
|
92
|
-
pass
|
|
93
|
-
|
|
94
|
-
return Versions(aws_version, get_github_released_version("aws/aws-cli", True))
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
def get_github_released_version(repository: str, tags: bool = False) -> Tuple[int, int, int]:
|
|
98
|
-
if tags:
|
|
99
|
-
tags_list = requests.get(f"https://api.github.com/repos/{repository}/tags").json()
|
|
100
|
-
versions = [parse_version(v["name"]) for v in tags_list]
|
|
101
|
-
versions.sort(reverse=True)
|
|
102
|
-
return versions[0]
|
|
103
|
-
|
|
104
|
-
package_info = requests.get(f"https://api.github.com/repos/{repository}/releases/latest").json()
|
|
105
|
-
return parse_version(package_info["tag_name"])
|
|
67
|
+
# Used in the generate command
|
|
68
|
+
def check_platform_helper_version_mismatch(self):
|
|
69
|
+
if not running_as_installed_package():
|
|
70
|
+
return
|
|
106
71
|
|
|
72
|
+
versions = get_platform_helper_versions()
|
|
73
|
+
platform_helper_file_version = SemanticVersion.from_string(
|
|
74
|
+
self.get_required_platform_helper_version(versions=versions)
|
|
75
|
+
)
|
|
107
76
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
77
|
+
if not versions.local == platform_helper_file_version:
|
|
78
|
+
message = (
|
|
79
|
+
f"WARNING: You are running platform-helper v{versions.local} against "
|
|
80
|
+
f"v{platform_helper_file_version} specified by {PLATFORM_HELPER_VERSION_FILE}."
|
|
81
|
+
)
|
|
82
|
+
self.io.warn(message)
|
|
114
83
|
|
|
115
84
|
|
|
116
|
-
|
|
85
|
+
# Resolves all the versions from pypi, config and locally installed version
|
|
86
|
+
# echos warnings if anything is incompatible
|
|
87
|
+
def get_platform_helper_versions(
|
|
88
|
+
include_project_versions=True, yaml_provider=YamlFileProvider
|
|
89
|
+
) -> PlatformHelperVersionStatus:
|
|
117
90
|
try:
|
|
118
|
-
locally_installed_version =
|
|
91
|
+
locally_installed_version = SemanticVersion.from_string(version("dbt-platform-helper"))
|
|
119
92
|
except PackageNotFoundError:
|
|
120
93
|
locally_installed_version = None
|
|
121
94
|
|
|
122
|
-
latest_release =
|
|
95
|
+
latest_release = PyPiVersionProvider.get_latest_version("dbt-platform-helper")
|
|
123
96
|
|
|
124
97
|
if not include_project_versions:
|
|
125
|
-
return
|
|
126
|
-
|
|
127
|
-
|
|
98
|
+
return PlatformHelperVersionStatus(
|
|
99
|
+
local=locally_installed_version,
|
|
100
|
+
latest=latest_release,
|
|
128
101
|
)
|
|
129
102
|
|
|
130
103
|
deprecated_version_file = Path(PLATFORM_HELPER_VERSION_FILE)
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
104
|
+
try:
|
|
105
|
+
loaded_version = yaml_provider.load(deprecated_version_file)
|
|
106
|
+
version_from_file = SemanticVersion.from_string(loaded_version)
|
|
107
|
+
except FileProviderException:
|
|
108
|
+
version_from_file = None
|
|
136
109
|
|
|
137
110
|
platform_config_default, pipeline_overrides = None, {}
|
|
138
111
|
|
|
139
|
-
|
|
112
|
+
config = ConfigProvider()
|
|
113
|
+
platform_config = config.load_unvalidated_config_file()
|
|
140
114
|
|
|
141
115
|
if platform_config:
|
|
142
|
-
platform_config_default =
|
|
116
|
+
platform_config_default = SemanticVersion.from_string(
|
|
143
117
|
platform_config.get("default_versions", {}).get("platform-helper")
|
|
144
118
|
)
|
|
145
119
|
|
|
@@ -149,10 +123,10 @@ def get_platform_helper_versions(include_project_versions=True) -> PlatformHelpe
|
|
|
149
123
|
if pipeline.get("versions", {}).get("platform-helper")
|
|
150
124
|
}
|
|
151
125
|
|
|
152
|
-
out =
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
126
|
+
out = PlatformHelperVersionStatus(
|
|
127
|
+
local=locally_installed_version,
|
|
128
|
+
latest=latest_release,
|
|
129
|
+
deprecated_version_file=version_from_file,
|
|
156
130
|
platform_config_default=platform_config_default,
|
|
157
131
|
pipeline_overrides=pipeline_overrides,
|
|
158
132
|
)
|
|
@@ -162,144 +136,45 @@ def get_platform_helper_versions(include_project_versions=True) -> PlatformHelpe
|
|
|
162
136
|
return out
|
|
163
137
|
|
|
164
138
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
if versions.platform_config_default and versions.platform_helper_file_version:
|
|
171
|
-
messages.append(deprecation_message)
|
|
172
|
-
|
|
173
|
-
if versions.platform_config_default and not versions.platform_helper_file_version:
|
|
174
|
-
return
|
|
175
|
-
|
|
176
|
-
if not versions.platform_config_default and versions.platform_helper_file_version:
|
|
177
|
-
messages.append(deprecation_message)
|
|
178
|
-
messages.append(
|
|
179
|
-
f"{missing_default_version_message}{string_version(versions.platform_helper_file_version)}\n"
|
|
180
|
-
)
|
|
181
|
-
|
|
182
|
-
if not versions.platform_config_default and not versions.platform_helper_file_version:
|
|
183
|
-
message = f"Cannot get dbt-platform-helper version from '{PLATFORM_CONFIG_FILE}'.\n"
|
|
184
|
-
message += f"{missing_default_version_message}{string_version(versions.local_version)}\n"
|
|
185
|
-
click.secho(message, fg="red")
|
|
186
|
-
|
|
187
|
-
if messages:
|
|
188
|
-
click.secho("\n".join(messages), fg="yellow")
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
def validate_version_compatibility(
|
|
192
|
-
app_version: Tuple[int, int, int], check_version: Tuple[int, int, int]
|
|
193
|
-
):
|
|
194
|
-
app_major, app_minor, app_patch = app_version
|
|
195
|
-
check_major, check_minor, check_patch = check_version
|
|
196
|
-
app_version_as_string = string_version(app_version)
|
|
197
|
-
check_version_as_string = string_version(check_version)
|
|
198
|
-
|
|
199
|
-
if (app_major == 0 and check_major == 0) and (
|
|
200
|
-
app_minor != check_minor or app_patch != check_patch
|
|
201
|
-
):
|
|
202
|
-
raise IncompatibleMajorVersionException(app_version_as_string, check_version_as_string)
|
|
203
|
-
|
|
204
|
-
if app_major != check_major:
|
|
205
|
-
raise IncompatibleMajorVersionException(app_version_as_string, check_version_as_string)
|
|
206
|
-
|
|
207
|
-
if app_minor != check_minor:
|
|
208
|
-
raise IncompatibleMinorVersionException(app_version_as_string, check_version_as_string)
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
def check_version_on_file_compatibility(
|
|
212
|
-
app_version: Tuple[int, int, int], file_version: Tuple[int, int, int]
|
|
213
|
-
):
|
|
214
|
-
app_major, app_minor, app_patch = app_version
|
|
215
|
-
file_major, file_minor, file_patch = file_version
|
|
216
|
-
|
|
217
|
-
return app_major == file_major and app_minor == file_minor and app_patch == file_patch
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
def get_template_generated_with_version(template_file_path: str) -> Tuple[int, int, int]:
|
|
221
|
-
try:
|
|
222
|
-
template_contents = Path(template_file_path).read_text()
|
|
223
|
-
template_version = re.match(
|
|
224
|
-
r"# Generated by platform-helper ([v.\-0-9]+)", template_contents
|
|
225
|
-
).group(1)
|
|
226
|
-
return parse_version(template_version)
|
|
227
|
-
except (IndexError, AttributeError):
|
|
228
|
-
raise ValidationException(f"Template {template_file_path} has no version information")
|
|
139
|
+
# Validates the returned PlatformHelperVersionStatus and echos useful warnings
|
|
140
|
+
# Should use IO provider
|
|
141
|
+
# Could return ValidationMessages (warnings and errors) which are output elsewhere
|
|
142
|
+
def _process_version_file_warnings(versions: PlatformHelperVersionStatus):
|
|
143
|
+
messages = versions.warn()
|
|
229
144
|
|
|
145
|
+
if messages.get("errors"):
|
|
146
|
+
click.secho("\n".join(messages["errors"]), fg="red")
|
|
230
147
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
app_version,
|
|
234
|
-
get_template_generated_with_version(template_file_path),
|
|
235
|
-
)
|
|
148
|
+
if messages.get("warnings"):
|
|
149
|
+
click.secho("\n".join(messages["warnings"]), fg="yellow")
|
|
236
150
|
|
|
237
151
|
|
|
152
|
+
# TODO called at the beginning of every command. This is platform-version base functionality
|
|
238
153
|
def check_platform_helper_version_needs_update():
|
|
239
154
|
if not running_as_installed_package() or "PLATFORM_TOOLS_SKIP_VERSION_CHECK" in os.environ:
|
|
240
155
|
return
|
|
241
156
|
|
|
242
157
|
versions = get_platform_helper_versions(include_project_versions=False)
|
|
243
|
-
local_version = versions.
|
|
244
|
-
latest_release = versions.
|
|
158
|
+
local_version = versions.local
|
|
159
|
+
latest_release = versions.latest
|
|
245
160
|
message = (
|
|
246
|
-
f"You are running platform-helper v{
|
|
247
|
-
f"v{
|
|
161
|
+
f"You are running platform-helper v{local_version}, upgrade to "
|
|
162
|
+
f"v{latest_release} by running run `pip install "
|
|
248
163
|
"--upgrade dbt-platform-helper`."
|
|
249
164
|
)
|
|
250
165
|
try:
|
|
251
|
-
|
|
166
|
+
local_version.validate_compatibility_with(latest_release)
|
|
252
167
|
except IncompatibleMajorVersionException:
|
|
253
168
|
click.secho(message, fg="red")
|
|
254
169
|
except IncompatibleMinorVersionException:
|
|
255
170
|
click.secho(message, fg="yellow")
|
|
256
171
|
|
|
257
172
|
|
|
258
|
-
|
|
259
|
-
if not running_as_installed_package():
|
|
260
|
-
return
|
|
261
|
-
|
|
262
|
-
versions = get_platform_helper_versions()
|
|
263
|
-
local_version = versions.local_version
|
|
264
|
-
platform_helper_file_version = parse_version(
|
|
265
|
-
get_required_platform_helper_version(versions=versions)
|
|
266
|
-
)
|
|
267
|
-
|
|
268
|
-
if not check_version_on_file_compatibility(local_version, platform_helper_file_version):
|
|
269
|
-
message = (
|
|
270
|
-
f"WARNING: You are running platform-helper v{string_version(local_version)} against "
|
|
271
|
-
f"v{string_version(platform_helper_file_version)} specified by {PLATFORM_HELPER_VERSION_FILE}."
|
|
272
|
-
)
|
|
273
|
-
click.secho(message, fg="red")
|
|
274
|
-
|
|
275
|
-
|
|
173
|
+
# TODO can stay as utility for now
|
|
276
174
|
def running_as_installed_package():
|
|
277
175
|
return "site-packages" in __file__
|
|
278
176
|
|
|
279
177
|
|
|
280
|
-
def get_required_platform_helper_version(
|
|
281
|
-
pipeline: str = None, versions: PlatformHelperVersions = None
|
|
282
|
-
) -> str:
|
|
283
|
-
if not versions:
|
|
284
|
-
versions = get_platform_helper_versions()
|
|
285
|
-
pipeline_version = versions.pipeline_overrides.get(pipeline)
|
|
286
|
-
version_precedence = [
|
|
287
|
-
pipeline_version,
|
|
288
|
-
versions.platform_config_default,
|
|
289
|
-
versions.platform_helper_file_version,
|
|
290
|
-
]
|
|
291
|
-
non_null_version_precedence = [
|
|
292
|
-
string_version(v) if isinstance(v, tuple) else v for v in version_precedence if v
|
|
293
|
-
]
|
|
294
|
-
|
|
295
|
-
out = non_null_version_precedence[0] if non_null_version_precedence else None
|
|
296
|
-
|
|
297
|
-
if not out:
|
|
298
|
-
raise SystemExit(1)
|
|
299
|
-
|
|
300
|
-
return out
|
|
301
|
-
|
|
302
|
-
|
|
303
178
|
def get_required_terraform_platform_modules_version(
|
|
304
179
|
cli_terraform_platform_modules_version, platform_config_terraform_modules_default_version
|
|
305
180
|
):
|
|
@@ -309,3 +184,59 @@ def get_required_terraform_platform_modules_version(
|
|
|
309
184
|
DEFAULT_TERRAFORM_PLATFORM_MODULES_VERSION,
|
|
310
185
|
]
|
|
311
186
|
return [version for version in version_preference_order if version][0]
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
#########################################
|
|
190
|
+
# Only used in Config domain
|
|
191
|
+
# TODO to be relocated along with tests
|
|
192
|
+
#########################################
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
# Getting version from the "Generated by" comment in a file that was generated from a template
|
|
196
|
+
# TODO where does this belong? It sort of belongs to our platform-helper templating
|
|
197
|
+
def get_template_generated_with_version(template_file_path: str) -> SemanticVersion:
|
|
198
|
+
try:
|
|
199
|
+
template_contents = Path(template_file_path).read_text()
|
|
200
|
+
template_version = re.match(
|
|
201
|
+
r"# Generated by platform-helper ([v.\-0-9]+)", template_contents
|
|
202
|
+
).group(1)
|
|
203
|
+
return SemanticVersion.from_string(template_version)
|
|
204
|
+
except (IndexError, AttributeError):
|
|
205
|
+
raise ValidationException(f"Template {template_file_path} has no version information")
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
def validate_template_version(app_version: SemanticVersion, template_file_path: str):
|
|
209
|
+
app_version.validate_compatibility_with(get_template_generated_with_version(template_file_path))
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
# Local version and latest release of tool.
|
|
213
|
+
# Used only in config command.
|
|
214
|
+
# TODO Move to config domain
|
|
215
|
+
def get_copilot_versions() -> VersionStatus:
|
|
216
|
+
copilot_version = None
|
|
217
|
+
|
|
218
|
+
try:
|
|
219
|
+
response = subprocess.run("copilot --version", capture_output=True, shell=True)
|
|
220
|
+
[copilot_version] = re.findall(r"[0-9.]+", response.stdout.decode("utf8"))
|
|
221
|
+
except ValueError:
|
|
222
|
+
pass
|
|
223
|
+
|
|
224
|
+
return VersionStatus(
|
|
225
|
+
SemanticVersion.from_string(copilot_version),
|
|
226
|
+
GithubVersionProvider.get_latest_version("aws/copilot-cli"),
|
|
227
|
+
)
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
# Local version and latest release of tool.
|
|
231
|
+
# Used only in config command.
|
|
232
|
+
# TODO Move to config domain
|
|
233
|
+
def get_aws_versions() -> VersionStatus:
|
|
234
|
+
aws_version = None
|
|
235
|
+
try:
|
|
236
|
+
response = subprocess.run("aws --version", capture_output=True, shell=True)
|
|
237
|
+
matched = re.match(r"aws-cli/([0-9.]+)", response.stdout.decode("utf8"))
|
|
238
|
+
aws_version = SemanticVersion.from_string(matched.group(1))
|
|
239
|
+
except ValueError:
|
|
240
|
+
pass
|
|
241
|
+
|
|
242
|
+
return VersionStatus(aws_version, GithubVersionProvider.get_latest_version("aws/aws-cli", True))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: dbt-platform-helper
|
|
3
|
-
Version: 13.0.
|
|
3
|
+
Version: 13.0.2
|
|
4
4
|
Summary: Set of tools to help transfer applications/services from GOV.UK PaaS to DBT PaaS augmenting AWS Copilot.
|
|
5
5
|
License: MIT
|
|
6
6
|
Author: Department for Business and Trade Platform Team
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
dbt_platform_helper/COMMANDS.md,sha256=
|
|
1
|
+
dbt_platform_helper/COMMANDS.md,sha256=tBGjnVDw5sXQfCNyHJfFWWu_40LqxbmfIE_SRVhg97g,22644
|
|
2
2
|
dbt_platform_helper/README.md,sha256=B0qN2_u_ASqqgkGDWY2iwNGZt_9tUgMb9XqtaTuzYjw,1530
|
|
3
3
|
dbt_platform_helper/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
4
|
dbt_platform_helper/addon-plans.yml,sha256=O46a_ODsGG9KXmQY_1XbSGqrpSaHSLDe-SdROzHx8Go,4545
|
|
@@ -6,48 +6,49 @@ dbt_platform_helper/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NM
|
|
|
6
6
|
dbt_platform_helper/commands/application.py,sha256=eVwCaYuwBlk0zx0xfA6fW7b-S1pl8gkyT1lHKeeh2R0,10147
|
|
7
7
|
dbt_platform_helper/commands/codebase.py,sha256=y2d2flGXv44KPv0Rj18gVrDG5t862OEzIoQiOK0STqw,2375
|
|
8
8
|
dbt_platform_helper/commands/conduit.py,sha256=QYMOYyCxFPzj_NJaXs3flIL7sHjOv75uAqPpjgh-EPo,2320
|
|
9
|
-
dbt_platform_helper/commands/config.py,sha256=
|
|
9
|
+
dbt_platform_helper/commands/config.py,sha256=YdwcR6u3qLM3afeZAAcKr8cqTzIgD7-rT0WdE9g2F0c,11548
|
|
10
10
|
dbt_platform_helper/commands/copilot.py,sha256=1CTyAkTQBF_i6zkqYzOIUo5wq9UYWfj-G1W8D2oRjmE,13623
|
|
11
11
|
dbt_platform_helper/commands/database.py,sha256=aG3zcMHL5PE96b7LSAu0FGCbgcycQej3AGRcd-bpXUo,4115
|
|
12
12
|
dbt_platform_helper/commands/environment.py,sha256=WUf5A6MwXAF7qTvW5phX2bH8C07GUs8fDPZs0cQvEg0,3909
|
|
13
|
-
dbt_platform_helper/commands/generate.py,sha256=
|
|
13
|
+
dbt_platform_helper/commands/generate.py,sha256=gModp-iOR528t631GYCYx4CXXvpcPco1MzIFIB9eQxA,717
|
|
14
14
|
dbt_platform_helper/commands/notify.py,sha256=lCS_JotQeg4NEpF4x145TCoZs0Pnf_LYf0rB1Iz_Tw0,3884
|
|
15
15
|
dbt_platform_helper/commands/pipeline.py,sha256=IdiJJJxZY47qI8ooyNNLlQo0gjQGrHebGbT-aIBoKBs,3000
|
|
16
16
|
dbt_platform_helper/commands/secrets.py,sha256=QjF9xUChioIr_P0fzqwyEcqLvcN-RNZmNFFlaUPVU9o,3994
|
|
17
|
-
dbt_platform_helper/commands/version.py,sha256=
|
|
17
|
+
dbt_platform_helper/commands/version.py,sha256=P030Z6lcsXxqlMt3ZijyAgfrKD4wq9xKTyFWolqiNJQ,1357
|
|
18
18
|
dbt_platform_helper/constants.py,sha256=DpHGG54lwjw3XGp2TKCEGNmzaz083lAWMGkEabujDrw,1050
|
|
19
19
|
dbt_platform_helper/default-extensions.yml,sha256=SU1ZitskbuEBpvE7efc3s56eAUF11j70brhj_XrNMMo,493
|
|
20
20
|
dbt_platform_helper/domain/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
21
21
|
dbt_platform_helper/domain/codebase.py,sha256=bLlTRqYmIz8J7W4siQczIJIt4Lc5-bjy-Qo46EyovFw,10496
|
|
22
22
|
dbt_platform_helper/domain/conduit.py,sha256=5C5GnF5jssJ1rFFCY6qaKgvLjYUkyytRJE4tHlanYa0,4370
|
|
23
|
-
dbt_platform_helper/domain/config_validator.py,sha256=
|
|
24
|
-
dbt_platform_helper/domain/copilot_environment.py,sha256=
|
|
25
|
-
dbt_platform_helper/domain/database_copy.py,sha256=
|
|
26
|
-
dbt_platform_helper/domain/maintenance_page.py,sha256=
|
|
23
|
+
dbt_platform_helper/domain/config_validator.py,sha256=of2iD4JX69Ekvs1CbAHU-KHsg9aVUgyB5uHkeYsGGlQ,10722
|
|
24
|
+
dbt_platform_helper/domain/copilot_environment.py,sha256=h63FKD5eo2ACHkKxuQMdc__bgPZ6Bx7iOlVzwXeZ2o4,8937
|
|
25
|
+
dbt_platform_helper/domain/database_copy.py,sha256=XMabpXdk8aEVSupUXkb3WzIjMfWCzms4h7Jchm__CrA,9482
|
|
26
|
+
dbt_platform_helper/domain/maintenance_page.py,sha256=aV1Fv3APyBakIxpMExeWwB6kk33HFc0tJyjeyRalkOA,20349
|
|
27
27
|
dbt_platform_helper/domain/pipelines.py,sha256=ey1tXNcfkkWJ88xRZewWF9iZvy1_hWxhrZdk83D-6k8,5649
|
|
28
|
-
dbt_platform_helper/domain/terraform_environment.py,sha256=
|
|
29
|
-
dbt_platform_helper/domain/test_platform_terraform_manifest_generator.py,sha256=DvDlTeLGJfiAJKshBJKe9SZm4uMSOR7MMUPy37rUwKE,4325
|
|
28
|
+
dbt_platform_helper/domain/terraform_environment.py,sha256=pyUWIxvMESbyp4yAq715JXKKHW133tr1vwxi2cMK5MI,1754
|
|
30
29
|
dbt_platform_helper/jinja2_tags.py,sha256=hKG6RS3zlxJHQ-Op9r2U2-MhWp4s3lZir4Ihe24ApJ0,540
|
|
31
30
|
dbt_platform_helper/platform_exception.py,sha256=bheZV9lqGvrCVTNT92349dVntNDEDWTEwciZgC83WzE,187
|
|
32
31
|
dbt_platform_helper/providers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
33
32
|
dbt_platform_helper/providers/aws.py,sha256=mlorH0fni6m8aUpm1x2jQPhaI3T0QsDMWpoGiSURBcI,1387
|
|
34
33
|
dbt_platform_helper/providers/cache.py,sha256=GIFVdpfXVnVgf2POQvBvZDP6pvYeUFjEuAdAQLbhJXs,2563
|
|
35
34
|
dbt_platform_helper/providers/cloudformation.py,sha256=SvCZgEVqxdpKfQMRAG3KzFQ43YeOEDqMm2tKmFGtacY,5347
|
|
36
|
-
dbt_platform_helper/providers/config.py,sha256=
|
|
35
|
+
dbt_platform_helper/providers/config.py,sha256=J83Iklq7M32_8666qr68phDbb_grc7TkyaKMPlCvhXg,4139
|
|
37
36
|
dbt_platform_helper/providers/copilot.py,sha256=nBbt-PoGXVkmb9njJti6Et8dq1W9GytW3jGBydNNYYU,5317
|
|
38
37
|
dbt_platform_helper/providers/ecr.py,sha256=lmLKGR5OQT8EyGsX-9M7oO0DHIyoMqgchBAVQBeoBZs,639
|
|
39
38
|
dbt_platform_helper/providers/ecs.py,sha256=XlQHYhZiLGrqR-1ZWMagGH2R2Hy7mCP6676eZL3YbNQ,3842
|
|
40
|
-
dbt_platform_helper/providers/files.py,sha256=
|
|
39
|
+
dbt_platform_helper/providers/files.py,sha256=cJdOV6Eupi-COmGUMxZMF10BZnMi3MCCipTVUnE_NPA,857
|
|
41
40
|
dbt_platform_helper/providers/io.py,sha256=JkWNIMZ_lcYQ6XvdVAuwtTZjoFIPJ-84zbH09nWLMdk,816
|
|
42
|
-
dbt_platform_helper/providers/load_balancers.py,sha256=
|
|
41
|
+
dbt_platform_helper/providers/load_balancers.py,sha256=Q2h4UT4KVA9E7q55Q4HGKxLlvMtpOXdR-KWQJSqTfm0,2746
|
|
43
42
|
dbt_platform_helper/providers/opensearch.py,sha256=tp64jTzHlutleqMpi2h_ZKH1iakZPJnUODebX6i2mfA,1335
|
|
44
43
|
dbt_platform_helper/providers/platform_config_schema.py,sha256=UKF3w9JGwWb8ZpkYHsglpabCTRtbx2gX-vs9gvfOyCg,26586
|
|
45
44
|
dbt_platform_helper/providers/redis.py,sha256=aj8pitxG9IKrMkL3fIYayQhcHPPzApdaXq0Uq_0yblg,1217
|
|
46
45
|
dbt_platform_helper/providers/secrets.py,sha256=6cYIR15dLdHmqxtWQpM6R71e0_Xgsg9V291HBG-0LV0,5272
|
|
47
|
-
dbt_platform_helper/providers/
|
|
48
|
-
dbt_platform_helper/providers/
|
|
49
|
-
dbt_platform_helper/providers/
|
|
50
|
-
dbt_platform_helper/providers/
|
|
46
|
+
dbt_platform_helper/providers/semantic_version.py,sha256=r6EWSzzCHswblzKo4_QyBR4rrR_CUo95NF6eialoiIQ,4395
|
|
47
|
+
dbt_platform_helper/providers/terraform_manifest.py,sha256=jQo5WSST1Ce13DC_h13P0wT9FfeeQV8gfAEDdZQ8z2U,9167
|
|
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
|
|
51
52
|
dbt_platform_helper/templates/.copilot/config.yml,sha256=J_bA9sCtBdCPBRImpCBRnYvhQd4vpLYIXIU-lq9vbkA,158
|
|
52
53
|
dbt_platform_helper/templates/.copilot/image_build_run.sh,sha256=adYucYXEB-kAgZNjTQo0T6EIAY8sh_xCEvVhWKKQ8mw,164
|
|
53
54
|
dbt_platform_helper/templates/.copilot/phases/build.sh,sha256=umKXePcRvx4XyrRY0fAWIyYFtNjqBI2L8vIJk-V7C60,121
|
|
@@ -68,7 +69,6 @@ dbt_platform_helper/templates/custom-codebuild-role-policy.json,sha256=8xyCofilP
|
|
|
68
69
|
dbt_platform_helper/templates/env/manifest.yml,sha256=VCEj_y3jdfnPYi6gmyrwiEqzHYjpaJDANbvswmkiLA0,802
|
|
69
70
|
dbt_platform_helper/templates/env/terraform-overrides/cfn.patches.yml,sha256=cFlg69fvi9kzpz13ZAeY1asseZ6TuUex-6s76jG3oL4,259
|
|
70
71
|
dbt_platform_helper/templates/environment-pipelines/main.tf,sha256=alycy6gYWvtOEVQPH5JxtHS7iGv0FTU-RQgBTe0kdts,1953
|
|
71
|
-
dbt_platform_helper/templates/environments/main.tf,sha256=0Zqi42IoqB25kWEbnBwoyxDM6-N4xRp2EYWgVJJSCWw,1537
|
|
72
72
|
dbt_platform_helper/templates/svc/maintenance_pages/default.html,sha256=OTZ-qwwSXu7PFbsgp4kppdm1lsg_iHK7FCFqhPnvrEs,741
|
|
73
73
|
dbt_platform_helper/templates/svc/maintenance_pages/dmas-migration.html,sha256=qvI6tHuI0UQbMBCuvPgK1a_zLANB6w7KVo9N5d8r-i0,829
|
|
74
74
|
dbt_platform_helper/templates/svc/maintenance_pages/migration.html,sha256=GiQsOiuaMFb7jG5_wU3V7BMcByHBl9fOBgrNf8quYlw,783
|
|
@@ -76,7 +76,7 @@ dbt_platform_helper/templates/svc/manifest-backend.yml,sha256=aAD9ndkbXnF7JBAKS2
|
|
|
76
76
|
dbt_platform_helper/templates/svc/manifest-public.yml,sha256=6NHVR_onBu5hbwynLrB6roDRce7JcylSc0qeYvzlPdI,3664
|
|
77
77
|
dbt_platform_helper/templates/svc/overrides/cfn.patches.yml,sha256=W7-d017akuUq9kda64DQxazavcRcCPDjaAik6t1EZqM,742
|
|
78
78
|
dbt_platform_helper/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
79
|
-
dbt_platform_helper/utils/application.py,sha256=
|
|
79
|
+
dbt_platform_helper/utils/application.py,sha256=sKJG5vjEJyUZJXnqM3NeZS228SKuv9dvK0EGaWpb0sg,4826
|
|
80
80
|
dbt_platform_helper/utils/arn_parser.py,sha256=BaXzIxSOLdFmP_IfAxRq-0j-0Re1iCN7L4j2Zi5-CRQ,1304
|
|
81
81
|
dbt_platform_helper/utils/aws.py,sha256=C18qEs8rekApGpJ39UslPvmpdFKhKX8Pybvz62YslQU,16918
|
|
82
82
|
dbt_platform_helper/utils/click.py,sha256=Fx4y4bbve1zypvog_sgK7tJtCocmzheoEFLBRv1lfdM,2943
|
|
@@ -85,13 +85,12 @@ dbt_platform_helper/utils/files.py,sha256=adQtG2E1IQHDKfeX06l6j1B7UTYukwBuR_uhJH
|
|
|
85
85
|
dbt_platform_helper/utils/git.py,sha256=7JGZMaI8-cU6-GjXIXjOlsYfKu_RppLOGyAicBd4n_8,704
|
|
86
86
|
dbt_platform_helper/utils/manifests.py,sha256=ji3UYHCxq9tTpkm4MlRa2y0-JOYYqq1pWZ2h_zpj0UU,507
|
|
87
87
|
dbt_platform_helper/utils/messages.py,sha256=nWA7BWLb7ND0WH5TejDN4OQUJSKYBxU4tyCzteCrfT0,142
|
|
88
|
-
dbt_platform_helper/utils/platform_config.py,sha256=hAQ7bX-Jqu4L9zPYpBq3EK73LRhOK5-fEP2r3MbT_iQ,475
|
|
89
88
|
dbt_platform_helper/utils/template.py,sha256=g-Db-0I6a6diOHkgK1nYA0IxJSO4TRrjqOvlyeOR32o,950
|
|
90
89
|
dbt_platform_helper/utils/validation.py,sha256=lmWVqRweswj-h7TPYP8lvluq8Qeu0htyKFbz2WUkPxI,1185
|
|
91
|
-
dbt_platform_helper/utils/versioning.py,sha256=
|
|
92
|
-
platform_helper.py,sha256=
|
|
93
|
-
dbt_platform_helper-13.0.
|
|
94
|
-
dbt_platform_helper-13.0.
|
|
95
|
-
dbt_platform_helper-13.0.
|
|
96
|
-
dbt_platform_helper-13.0.
|
|
97
|
-
dbt_platform_helper-13.0.
|
|
90
|
+
dbt_platform_helper/utils/versioning.py,sha256=LRjtKQCGKyAsjBmLZ5P94bTURzc_LKyklb8Sne4UOIo,9114
|
|
91
|
+
platform_helper.py,sha256=lUGBsVgsGGJSDXxRvtvZCo2ybRAWuJXosbzfTzkIxU8,1892
|
|
92
|
+
dbt_platform_helper-13.0.2.dist-info/LICENSE,sha256=dP79lN73--7LMApnankTGLqDbImXg8iYFqWgnExGkGk,1090
|
|
93
|
+
dbt_platform_helper-13.0.2.dist-info/METADATA,sha256=aQcgYyHwmEGmPgtVsakevRRd7Pb0R2XR2lI-wgKDDXA,3212
|
|
94
|
+
dbt_platform_helper-13.0.2.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
|
|
95
|
+
dbt_platform_helper-13.0.2.dist-info/entry_points.txt,sha256=QhbY8F434A-onsg0-FsdMd2U6HKh6Q7yCFFZrGUh5-M,67
|
|
96
|
+
dbt_platform_helper-13.0.2.dist-info/RECORD,,
|
platform_helper.py
CHANGED
|
@@ -15,7 +15,7 @@ from dbt_platform_helper.commands.generate import generate as generate_commands
|
|
|
15
15
|
from dbt_platform_helper.commands.notify import notify as notify_commands
|
|
16
16
|
from dbt_platform_helper.commands.pipeline import pipeline as pipeline_commands
|
|
17
17
|
from dbt_platform_helper.commands.secrets import secrets as secrets_commands
|
|
18
|
-
from dbt_platform_helper.commands.version import
|
|
18
|
+
from dbt_platform_helper.commands.version import version as version_commands
|
|
19
19
|
from dbt_platform_helper.utils.click import ClickDocOptGroup
|
|
20
20
|
|
|
21
21
|
|
|
@@ -39,7 +39,7 @@ platform_helper.add_command(pipeline_commands)
|
|
|
39
39
|
platform_helper.add_command(secrets_commands)
|
|
40
40
|
platform_helper.add_command(notify_commands)
|
|
41
41
|
platform_helper.add_command(database_commands)
|
|
42
|
-
platform_helper.add_command(
|
|
42
|
+
platform_helper.add_command(version_commands)
|
|
43
43
|
|
|
44
44
|
if __name__ == "__main__":
|
|
45
45
|
platform_helper()
|