dbt-platform-helper 13.0.2__tar.gz → 13.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of dbt-platform-helper might be problematic. Click here for more details.

Files changed (94) hide show
  1. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/PKG-INFO +1 -1
  2. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/commands/copilot.py +1 -1
  3. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/commands/environment.py +1 -1
  4. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/commands/pipeline.py +1 -1
  5. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/domain/copilot_environment.py +1 -1
  6. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/domain/database_copy.py +1 -1
  7. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/domain/pipelines.py +17 -1
  8. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/providers/config.py +2 -2
  9. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/providers/platform_config_schema.py +21 -14
  10. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/providers/terraform_manifest.py +9 -3
  11. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/templates/environment-pipelines/main.tf +1 -1
  12. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/utils/validation.py +1 -1
  13. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/utils/versioning.py +6 -10
  14. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/pyproject.toml +1 -1
  15. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/LICENSE +0 -0
  16. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/COMMANDS.md +0 -0
  17. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/README.md +0 -0
  18. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/__init__.py +0 -0
  19. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/addon-plans.yml +0 -0
  20. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/commands/__init__.py +0 -0
  21. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/commands/application.py +0 -0
  22. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/commands/codebase.py +0 -0
  23. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/commands/conduit.py +0 -0
  24. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/commands/config.py +0 -0
  25. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/commands/database.py +0 -0
  26. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/commands/generate.py +0 -0
  27. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/commands/notify.py +0 -0
  28. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/commands/secrets.py +0 -0
  29. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/commands/version.py +0 -0
  30. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/constants.py +0 -0
  31. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/default-extensions.yml +0 -0
  32. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/domain/__init__.py +0 -0
  33. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/domain/codebase.py +0 -0
  34. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/domain/conduit.py +0 -0
  35. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/domain/maintenance_page.py +0 -0
  36. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/domain/terraform_environment.py +0 -0
  37. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/jinja2_tags.py +0 -0
  38. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/platform_exception.py +0 -0
  39. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/providers/__init__.py +0 -0
  40. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/providers/aws.py +0 -0
  41. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/providers/cache.py +0 -0
  42. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/providers/cloudformation.py +0 -0
  43. {dbt_platform_helper-13.0.2/dbt_platform_helper/domain → dbt_platform_helper-13.1.1/dbt_platform_helper/providers}/config_validator.py +0 -0
  44. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/providers/copilot.py +0 -0
  45. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/providers/ecr.py +0 -0
  46. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/providers/ecs.py +0 -0
  47. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/providers/files.py +0 -0
  48. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/providers/io.py +0 -0
  49. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/providers/load_balancers.py +0 -0
  50. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/providers/opensearch.py +0 -0
  51. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/providers/redis.py +0 -0
  52. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/providers/secrets.py +0 -0
  53. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/providers/semantic_version.py +0 -0
  54. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/providers/validation.py +0 -0
  55. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/providers/version.py +0 -0
  56. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/providers/vpc.py +0 -0
  57. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/providers/yaml_file.py +0 -0
  58. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/templates/.copilot/config.yml +0 -0
  59. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/templates/.copilot/image_build_run.sh +0 -0
  60. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/templates/.copilot/phases/build.sh +0 -0
  61. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/templates/.copilot/phases/install.sh +0 -0
  62. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/templates/.copilot/phases/post_build.sh +0 -0
  63. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/templates/.copilot/phases/pre_build.sh +0 -0
  64. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/templates/COMMANDS.md.jinja +0 -0
  65. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/templates/addon-instructions.txt +0 -0
  66. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/templates/addons/README.md +0 -0
  67. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/templates/addons/svc/appconfig-ipfilter.yml +0 -0
  68. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/templates/addons/svc/prometheus-policy.yml +0 -0
  69. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/templates/addons/svc/s3-cross-account-policy.yml +0 -0
  70. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/templates/addons/svc/s3-policy.yml +0 -0
  71. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/templates/addons/svc/subscription-filter.yml +0 -0
  72. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/templates/ci-codebuild-role-policy.json +0 -0
  73. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/templates/create-codebuild-role.json +0 -0
  74. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/templates/custom-codebuild-role-policy.json +0 -0
  75. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/templates/env/manifest.yml +0 -0
  76. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/templates/env/terraform-overrides/cfn.patches.yml +0 -0
  77. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/templates/svc/maintenance_pages/default.html +0 -0
  78. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/templates/svc/maintenance_pages/dmas-migration.html +0 -0
  79. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/templates/svc/maintenance_pages/migration.html +0 -0
  80. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/templates/svc/manifest-backend.yml +0 -0
  81. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/templates/svc/manifest-public.yml +0 -0
  82. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/templates/svc/overrides/cfn.patches.yml +0 -0
  83. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/utils/__init__.py +0 -0
  84. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/utils/application.py +0 -0
  85. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/utils/arn_parser.py +0 -0
  86. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/utils/aws.py +0 -0
  87. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/utils/click.py +0 -0
  88. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/utils/cloudfoundry.py +0 -0
  89. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/utils/files.py +0 -0
  90. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/utils/git.py +0 -0
  91. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/utils/manifests.py +0 -0
  92. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/utils/messages.py +0 -0
  93. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/dbt_platform_helper/utils/template.py +0 -0
  94. {dbt_platform_helper-13.0.2 → dbt_platform_helper-13.1.1}/platform_helper.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: dbt-platform-helper
3
- Version: 13.0.2
3
+ Version: 13.1.1
4
4
  Summary: Set of tools to help transfer applications/services from GOV.UK PaaS to DBT PaaS augmenting AWS Copilot.
5
5
  License: MIT
6
6
  Author: Department for Business and Trade Platform Team
@@ -10,9 +10,9 @@ import yaml
10
10
  from schema import SchemaError
11
11
 
12
12
  from dbt_platform_helper.constants import PLATFORM_CONFIG_FILE
13
- from dbt_platform_helper.domain.config_validator import ConfigValidator
14
13
  from dbt_platform_helper.domain.copilot_environment import CopilotTemplating
15
14
  from dbt_platform_helper.providers.config import ConfigProvider
15
+ from dbt_platform_helper.providers.config_validator import ConfigValidator
16
16
  from dbt_platform_helper.providers.files import FileProvider
17
17
  from dbt_platform_helper.utils.application import get_application_name
18
18
  from dbt_platform_helper.utils.application import load_application
@@ -1,13 +1,13 @@
1
1
  import click
2
2
 
3
3
  from dbt_platform_helper.constants import DEFAULT_TERRAFORM_PLATFORM_MODULES_VERSION
4
- from dbt_platform_helper.domain.config_validator import ConfigValidator
5
4
  from dbt_platform_helper.domain.copilot_environment import CopilotEnvironment
6
5
  from dbt_platform_helper.domain.maintenance_page import MaintenancePage
7
6
  from dbt_platform_helper.domain.terraform_environment import TerraformEnvironment
8
7
  from dbt_platform_helper.platform_exception import PlatformException
9
8
  from dbt_platform_helper.providers.cloudformation import CloudFormation
10
9
  from dbt_platform_helper.providers.config import ConfigProvider
10
+ from dbt_platform_helper.providers.config_validator import ConfigValidator
11
11
  from dbt_platform_helper.providers.io import ClickIOProvider
12
12
  from dbt_platform_helper.providers.vpc import VpcProvider
13
13
  from dbt_platform_helper.utils.application import load_application
@@ -2,9 +2,9 @@
2
2
  import click
3
3
 
4
4
  from dbt_platform_helper.constants import DEFAULT_TERRAFORM_PLATFORM_MODULES_VERSION
5
- from dbt_platform_helper.domain.config_validator import ConfigValidator
6
5
  from dbt_platform_helper.domain.pipelines import Pipelines
7
6
  from dbt_platform_helper.providers.config import ConfigProvider
7
+ from dbt_platform_helper.providers.config_validator import ConfigValidator
8
8
  from dbt_platform_helper.providers.ecr import ECRProvider
9
9
  from dbt_platform_helper.providers.io import ClickIOProvider
10
10
  from dbt_platform_helper.providers.terraform_manifest import TerraformManifestProvider
@@ -132,7 +132,7 @@ class CopilotEnvironment:
132
132
  class CopilotTemplating:
133
133
  def __init__(
134
134
  self,
135
- file_provider: FileProvider = None,
135
+ file_provider: FileProvider = FileProvider(),
136
136
  io: ClickIOProvider = ClickIOProvider(),
137
137
  # TODO file_provider can be moved up a layer. File writing can be the responsibility of CopilotEnvironment generate
138
138
  # Or we align with PlatformTerraformManifestGenerator and rename from Templating to reflect the file writing responsibility
@@ -6,9 +6,9 @@ import boto3
6
6
  from boto3 import Session
7
7
 
8
8
  from dbt_platform_helper.constants import PLATFORM_CONFIG_FILE
9
- from dbt_platform_helper.domain.config_validator import ConfigValidator
10
9
  from dbt_platform_helper.domain.maintenance_page import MaintenancePage
11
10
  from dbt_platform_helper.providers.config import ConfigProvider
11
+ from dbt_platform_helper.providers.config_validator import ConfigValidator
12
12
  from dbt_platform_helper.providers.io import ClickIOProvider
13
13
  from dbt_platform_helper.providers.io import ClickIOProviderException
14
14
  from dbt_platform_helper.providers.vpc import Vpc
@@ -72,6 +72,16 @@ class Pipelines:
72
72
  platform_config_terraform_modules_default_version,
73
73
  )
74
74
 
75
+ # TODO - this whole code block/if-statement can fall away once the deploy_repository is a required key.
76
+ deploy_repository = ""
77
+ if "deploy_repository" in platform_config.keys():
78
+ deploy_repository = f"{platform_config['deploy_repository']}"
79
+ else:
80
+ self.io.warn(
81
+ "No `deploy_repository` key set in platform-config.yml, this will become a required key. See full platform config reference in the docs: https://platform.readme.trade.gov.uk/reference/platform-config-yml/#core-configuration"
82
+ )
83
+ deploy_repository = f"uktrade/{platform_config['application']}-deploy"
84
+
75
85
  if has_environment_pipelines:
76
86
  environment_pipelines = platform_config[ENVIRONMENT_PIPELINES_KEY]
77
87
  accounts = {
@@ -83,6 +93,7 @@ class Pipelines:
83
93
  for account in accounts:
84
94
  self._generate_terraform_environment_pipeline_manifest(
85
95
  platform_config["application"],
96
+ deploy_repository,
86
97
  account,
87
98
  terraform_platform_modules_version,
88
99
  deploy_branch,
@@ -102,7 +113,10 @@ class Pipelines:
102
113
  }
103
114
 
104
115
  self.terraform_manifest_provider.generate_codebase_pipeline_config(
105
- platform_config, terraform_platform_modules_version, ecrs_that_need_importing
116
+ platform_config,
117
+ terraform_platform_modules_version,
118
+ ecrs_that_need_importing,
119
+ deploy_repository,
106
120
  )
107
121
 
108
122
  def _clean_pipeline_config(self, pipelines_dir: Path):
@@ -113,6 +127,7 @@ class Pipelines:
113
127
  def _generate_terraform_environment_pipeline_manifest(
114
128
  self,
115
129
  application: str,
130
+ deploy_repository: str,
116
131
  aws_account: str,
117
132
  terraform_platform_modules_version: str,
118
133
  deploy_branch: str,
@@ -122,6 +137,7 @@ class Pipelines:
122
137
  contents = env_pipeline_template.render(
123
138
  {
124
139
  "application": application,
140
+ "deploy_repository": deploy_repository,
125
141
  "aws_account": aws_account,
126
142
  "terraform_platform_modules_version": terraform_platform_modules_version,
127
143
  "deploy_branch": deploy_branch,
@@ -4,8 +4,8 @@ from pathlib import Path
4
4
  from schema import SchemaError
5
5
 
6
6
  from dbt_platform_helper.constants import PLATFORM_CONFIG_FILE
7
- from dbt_platform_helper.domain.config_validator import ConfigValidator
8
- from dbt_platform_helper.domain.config_validator import ConfigValidatorError
7
+ from dbt_platform_helper.providers.config_validator import ConfigValidator
8
+ from dbt_platform_helper.providers.config_validator import ConfigValidatorError
9
9
  from dbt_platform_helper.providers.io import ClickIOProvider
10
10
  from dbt_platform_helper.providers.platform_config_schema import PlatformConfigSchema
11
11
  from dbt_platform_helper.providers.yaml_file import FileNotFoundException
@@ -14,8 +14,8 @@ class PlatformConfigSchema:
14
14
  def schema() -> Schema:
15
15
  return Schema(
16
16
  {
17
- # The following line is for the AWS Copilot version, will be removed under DBTP-1002
18
17
  "application": str,
18
+ Optional("deploy_repository"): str,
19
19
  Optional("default_versions"): PlatformConfigSchema.__default_versions_schema(),
20
20
  Optional("environments"): PlatformConfigSchema.__environments_schema(),
21
21
  Optional("codebase_pipelines"): PlatformConfigSchema.__codebase_pipelines_schema(),
@@ -134,7 +134,7 @@ class PlatformConfigSchema:
134
134
  Optional("additional_ecr_repository"): str,
135
135
  Optional("deploy_repository_branch"): str,
136
136
  "services": [{str: [str]}],
137
- "pipelines": [
137
+ Optional("pipelines"): [
138
138
  Or(
139
139
  {
140
140
  "name": str,
@@ -435,7 +435,7 @@ class PlatformConfigSchema:
435
435
  return True
436
436
 
437
437
  @staticmethod
438
- def __valid_s3_base_definition() -> dict:
438
+ def __s3_bucket_schema() -> dict:
439
439
  def _valid_s3_bucket_arn(key):
440
440
  return Regex(
441
441
  r"^arn:aws:s3::.*",
@@ -485,6 +485,10 @@ class PlatformConfigSchema:
485
485
 
486
486
  return dict(
487
487
  {
488
+ "type": "s3",
489
+ Optional("objects"): [
490
+ {"key": str, Optional("body"): str, Optional("content_type"): str}
491
+ ],
488
492
  Optional("readonly"): bool,
489
493
  Optional("serve_static_content"): bool,
490
494
  Optional("serve_static_param_name"): str,
@@ -502,7 +506,9 @@ class PlatformConfigSchema:
502
506
  },
503
507
  Optional("cross_environment_service_access"): {
504
508
  PlatformConfigSchema.__valid_schema_key(): {
505
- "application": str,
509
+ # Deprecated: We didn't implement cross application access, no service teams are asking for it.
510
+ # application should be removed once we can confirm that no-one is using it.
511
+ Optional("application"): str,
506
512
  "environment": PlatformConfigSchema.__valid_environment_name(),
507
513
  "account": str,
508
514
  "service": str,
@@ -518,18 +524,19 @@ class PlatformConfigSchema:
518
524
  }
519
525
  )
520
526
 
521
- @staticmethod
522
- def __s3_bucket_schema() -> dict:
523
- return PlatformConfigSchema.__valid_s3_base_definition() | {
524
- "type": "s3",
525
- Optional("objects"): [
526
- {"key": str, Optional("body"): str, Optional("content_type"): str}
527
- ],
528
- }
529
-
530
527
  @staticmethod
531
528
  def __s3_bucket_policy_schema() -> dict:
532
- return PlatformConfigSchema.__valid_s3_base_definition() | {"type": "s3-policy"}
529
+ return dict(
530
+ {
531
+ "type": "s3-policy",
532
+ Optional("services"): Or("__all__", [str]),
533
+ Optional("environments"): {
534
+ PlatformConfigSchema.__valid_environment_name(): {
535
+ "bucket_name": PlatformConfigSchema.valid_s3_bucket_name,
536
+ },
537
+ },
538
+ }
539
+ )
533
540
 
534
541
  @staticmethod
535
542
  def string_matching_regex(regex_pattern: str) -> Callable:
@@ -22,6 +22,7 @@ class TerraformManifestProvider:
22
22
  platform_config: dict,
23
23
  terraform_platform_modules_version: str,
24
24
  ecr_imports: dict[str, str],
25
+ deploy_repository: str,
25
26
  ):
26
27
  default_account = self._get_account_for_env("*", platform_config)
27
28
  state_key_suffix = f"{platform_config['application']}-codebase-pipelines"
@@ -31,7 +32,9 @@ class TerraformManifestProvider:
31
32
  self._add_codebase_pipeline_locals(terraform)
32
33
  self._add_provider(terraform, default_account)
33
34
  self._add_backend(terraform, platform_config, default_account, state_key_suffix)
34
- self._add_codebase_pipeline_module(terraform, terraform_platform_modules_version)
35
+ self._add_codebase_pipeline_module(
36
+ terraform, terraform_platform_modules_version, deploy_repository
37
+ )
35
38
  self._add_imports(terraform, ecr_imports)
36
39
  self._write_terraform_json(terraform, "terraform/codebase-pipelines")
37
40
 
@@ -113,7 +116,9 @@ class TerraformManifestProvider:
113
116
  }
114
117
 
115
118
  @staticmethod
116
- def _add_codebase_pipeline_module(terraform: dict, terraform_platform_modules_version: str):
119
+ def _add_codebase_pipeline_module(
120
+ terraform: dict, terraform_platform_modules_version: str, deploy_repository: str
121
+ ):
117
122
  source = f"git::https://github.com/uktrade/terraform-platform-modules.git//codebase-pipelines?depth=1&ref={terraform_platform_modules_version}"
118
123
  terraform["module"] = {
119
124
  "codebase-pipelines": {
@@ -122,8 +127,9 @@ class TerraformManifestProvider:
122
127
  "application": "${local.application}",
123
128
  "codebase": "${each.key}",
124
129
  "repository": "${each.value.repository}",
130
+ "deploy_repository": f"{deploy_repository}",
125
131
  "additional_ecr_repository": '${lookup(each.value, "additional_ecr_repository", null)}',
126
- "pipelines": "${each.value.pipelines}",
132
+ "pipelines": '${lookup(each.value, "pipelines", [])}',
127
133
  "services": "${each.value.services}",
128
134
  "requires_image_build": '${lookup(each.value, "requires_image_build", true)}',
129
135
  "slack_channel": '${lookup(each.value, "slack_channel", "/codebuild/slack_oauth_channel")}',
@@ -40,7 +40,7 @@ module "environment-pipelines" {
40
40
 
41
41
  application = "{{ application }}"
42
42
  pipeline_name = each.key
43
- repository = "uktrade/{{ application }}-deploy"
43
+ repository = "{{ deploy_repository }}"
44
44
 
45
45
  environments = each.value.environments
46
46
  all_pipelines = local.all_pipelines
@@ -1,6 +1,6 @@
1
1
  from schema import SchemaError
2
2
 
3
- from dbt_platform_helper.domain.config_validator import ConfigValidator
3
+ from dbt_platform_helper.providers.config_validator import ConfigValidator
4
4
  from dbt_platform_helper.providers.platform_config_schema import PlatformConfigSchema
5
5
 
6
6
 
@@ -5,8 +5,6 @@ from importlib.metadata import PackageNotFoundError
5
5
  from importlib.metadata import version
6
6
  from pathlib import Path
7
7
 
8
- import click
9
-
10
8
  from dbt_platform_helper.constants import DEFAULT_TERRAFORM_PLATFORM_MODULES_VERSION
11
9
  from dbt_platform_helper.constants import PLATFORM_HELPER_VERSION_FILE
12
10
  from dbt_platform_helper.platform_exception import PlatformException
@@ -137,23 +135,21 @@ def get_platform_helper_versions(
137
135
 
138
136
 
139
137
  # Validates the returned PlatformHelperVersionStatus and echos useful warnings
140
- # Should use IO provider
141
138
  # Could return ValidationMessages (warnings and errors) which are output elsewhere
142
- def _process_version_file_warnings(versions: PlatformHelperVersionStatus):
139
+ def _process_version_file_warnings(versions: PlatformHelperVersionStatus, io=ClickIOProvider()):
143
140
  messages = versions.warn()
144
141
 
145
142
  if messages.get("errors"):
146
- click.secho("\n".join(messages["errors"]), fg="red")
143
+ io.error("\n".join(messages["errors"]))
147
144
 
148
145
  if messages.get("warnings"):
149
- click.secho("\n".join(messages["warnings"]), fg="yellow")
146
+ io.warn("\n".join(messages["warnings"]))
150
147
 
151
148
 
152
149
  # TODO called at the beginning of every command. This is platform-version base functionality
153
- def check_platform_helper_version_needs_update():
150
+ def check_platform_helper_version_needs_update(io=ClickIOProvider()):
154
151
  if not running_as_installed_package() or "PLATFORM_TOOLS_SKIP_VERSION_CHECK" in os.environ:
155
152
  return
156
-
157
153
  versions = get_platform_helper_versions(include_project_versions=False)
158
154
  local_version = versions.local
159
155
  latest_release = versions.latest
@@ -165,9 +161,9 @@ def check_platform_helper_version_needs_update():
165
161
  try:
166
162
  local_version.validate_compatibility_with(latest_release)
167
163
  except IncompatibleMajorVersionException:
168
- click.secho(message, fg="red")
164
+ io.error(message)
169
165
  except IncompatibleMinorVersionException:
170
- click.secho(message, fg="yellow")
166
+ io.warn(message)
171
167
 
172
168
 
173
169
  # TODO can stay as utility for now
@@ -3,7 +3,7 @@ line-length = 100
3
3
 
4
4
  [tool.poetry]
5
5
  name = "dbt-platform-helper"
6
- version = "13.0.2"
6
+ version = "13.1.1"
7
7
  description = "Set of tools to help transfer applications/services from GOV.UK PaaS to DBT PaaS augmenting AWS Copilot."
8
8
  authors = ["Department for Business and Trade Platform Team <sre-team@digital.trade.gov.uk>"]
9
9
  license = "MIT"