@dotcom-tool-kit/containerised-app 0.1.13 → 0.2.0

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.
package/.toolkitrc.yml CHANGED
@@ -18,8 +18,7 @@ commands:
18
18
  roleArn: !toolkit/option '@dotcom-tool-kit/containerised-app.awsRoleArnStaging'
19
19
  - HakoDeploy:
20
20
  asReviewApp: true
21
- environments:
22
- - ft-com-test-eu
21
+ environments: !toolkit/option '@dotcom-tool-kit/containerised-app.hakoReviewEnvironments'
23
22
  'deploy:staging':
24
23
  - DockerAuthCloudsmith
25
24
  - DockerBuild
@@ -27,22 +26,13 @@ commands:
27
26
  - AwsAssumeRole:
28
27
  roleArn: !toolkit/option '@dotcom-tool-kit/containerised-app.awsRoleArnStaging'
29
28
  - HakoDeploy:
30
- environments:
31
- - ft-com-test-eu
29
+ environments: !toolkit/option '@dotcom-tool-kit/containerised-app.hakoStagingEnvironments'
32
30
  'deploy:production':
33
31
  - DockerAuthCloudsmith
34
32
  - AwsAssumeRole:
35
33
  roleArn: !toolkit/option '@dotcom-tool-kit/containerised-app.awsRoleArnProduction'
36
- # HACK: the `environments` property under `HakoDeploy` gets fully overridden by the `environments`
37
- # property under the !toolkit/if-defined if multiregion is true. We'll refactor this later when
38
- # we decide what new YAML tags we need
39
34
  - HakoDeploy:
40
- environments:
41
- - ft-com-prod-eu
42
- !toolkit/if-defined '@dotcom-tool-kit/containerised-app.multiregion':
43
- environments:
44
- - ft-com-prod-eu
45
- - ft-com-prod-us
35
+ environments: !toolkit/option '@dotcom-tool-kit/containerised-app.hakoProductionEnvironments'
46
36
 
47
37
  optionsSchema: ./schema
48
38
  version: 2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotcom-tool-kit/containerised-app",
3
- "version": "0.1.13",
3
+ "version": "0.2.0",
4
4
  "scripts": {
5
5
  "test": "echo \"Error: no test specified\" && exit 1"
6
6
  },
@@ -26,13 +26,14 @@
26
26
  "dotcom-tool-kit": "4.x"
27
27
  },
28
28
  "dependencies": {
29
- "@dotcom-tool-kit/aws": "^0.1.7",
30
- "@dotcom-tool-kit/circleci-deploy": "^4.1.15",
31
- "@dotcom-tool-kit/cloudsmith": "^1.1.1",
32
- "@dotcom-tool-kit/docker": "^0.4.2",
33
- "@dotcom-tool-kit/doppler": "^2.2.2",
34
- "@dotcom-tool-kit/hako": "^0.1.12",
35
- "@dotcom-tool-kit/node": "^4.3.3",
36
- "zod": "^3.24.3"
29
+ "@dotcom-tool-kit/aws": "^0.1.8",
30
+ "@dotcom-tool-kit/circleci-deploy": "^4.1.16",
31
+ "@dotcom-tool-kit/cloudsmith": "^1.1.2",
32
+ "@dotcom-tool-kit/docker": "^0.4.3",
33
+ "@dotcom-tool-kit/doppler": "^2.2.3",
34
+ "@dotcom-tool-kit/hako": "^0.1.13",
35
+ "@dotcom-tool-kit/logger": "^4.2.2",
36
+ "@dotcom-tool-kit/node": "^4.3.4",
37
+ "zod": "^3.24.4"
37
38
  }
38
39
  }
package/readme.md CHANGED
@@ -49,11 +49,13 @@ See the relevant documentation for further options:
49
49
 
50
50
  ### `@dotcom-tool-kit/containerised-app`
51
51
 
52
- | Property | Description | Type |
53
- | :------------------------------ | :------------------------------------------------------------ | :----------------------------------------------- |
54
- | **`awsRoleArnStaging`** (\*) | the ARN of an IAM role to assume when deploying to staging | `string` (_regex: `/^arn:aws:iam::\d+:role\//`_) |
55
- | **`awsRoleArnProduction`** (\*) | the ARN of an IAM role to assume when deploying to production | `string` (_regex: `/^arn:aws:iam::\d+:role\//`_) |
56
- | `multiregion` | Whether the app is deployed across both EU and US regions | `true` |
52
+ | Property | Description | Type | Default |
53
+ | :------------------------------ | :------------------------------------------------------------------------- | :----------------------------------------------- | :------------------- |
54
+ | **`awsRoleArnStaging`** (\*) | the ARN of an IAM role to assume when deploying to staging | `string` (_regex: `/^arn:aws:iam::\d+:role\//`_) | |
55
+ | **`awsRoleArnProduction`** (\*) | the ARN of an IAM role to assume when deploying to production | `string` (_regex: `/^arn:aws:iam::\d+:role\//`_) | |
56
+ | `hakoReviewEnvironments` | the set of Hako environments to deploy to in the deploy:review command | `Array<string>` | `["ft-com-test-eu"]` |
57
+ | `hakoStagingEnvironments` | the set of Hako environments to deploy to in the deploy:staging command | `Array<string>` | `["ft-com-test-eu"]` |
58
+ | `hakoProductionEnvironments` | the set of Hako environments to deploy to in the deploy:production command | `Array<string>` | `["ft-com-prod-eu"]` |
57
59
 
58
60
  _(\*) Required._
59
61
  <!-- end autogenerated docs -->
package/schema.js CHANGED
@@ -1,17 +1,43 @@
1
1
  const z = require('zod')
2
+ const { HakoEnvironmentName } = require('@dotcom-tool-kit/hako/lib/tasks/deploy')
3
+ const { styles } = require('@dotcom-tool-kit/logger')
2
4
 
3
- module.exports = z.object({
4
- awsRoleArnStaging: z
5
- .string()
6
- .regex(/^arn:aws:iam::\d+:role\//, 'Role ARN must be a full IAM role ARN including account number')
7
- .describe('the ARN of an IAM role to assume when deploying to staging'),
8
- awsRoleArnProduction: z
9
- .string()
10
- .regex(/^arn:aws:iam::\d+:role\//, 'Role ARN must be a full IAM role ARN including account number')
11
- .describe('the ARN of an IAM role to assume when deploying to production'),
12
- // HACK: must be either `true` or `undefined` because of the way !toolkit/if-defined works
13
- multiregion: z
14
- .literal(true)
15
- .optional()
16
- .describe('Whether the app is deployed across both EU and US regions')
17
- })
5
+ // We don't want to transform the environment yet as the value will get
6
+ // substituted into the HakoDeploy task options where it will then get
7
+ // transformed. The transform isn't idempotent so will result in a parse error
8
+ // if applied twice.
9
+ const HakoEnvironmentNameInner = HakoEnvironmentName.innerType()
10
+
11
+ module.exports = z
12
+ .object({
13
+ awsRoleArnStaging: z
14
+ .string()
15
+ .regex(/^arn:aws:iam::\d+:role\//, 'Role ARN must be a full IAM role ARN including account number')
16
+ .describe('the ARN of an IAM role to assume when deploying to staging'),
17
+ awsRoleArnProduction: z
18
+ .string()
19
+ .regex(/^arn:aws:iam::\d+:role\//, 'Role ARN must be a full IAM role ARN including account number')
20
+ .describe('the ARN of an IAM role to assume when deploying to production'),
21
+ hakoReviewEnvironments: z
22
+ .array(HakoEnvironmentNameInner)
23
+ .default(['ft-com-test-eu'])
24
+ .describe('the set of Hako environments to deploy to in the deploy:review command'),
25
+ hakoStagingEnvironments: z
26
+ .array(HakoEnvironmentNameInner)
27
+ .default(['ft-com-test-eu'])
28
+ .describe('the set of Hako environments to deploy to in the deploy:staging command'),
29
+ hakoProductionEnvironments: z
30
+ .array(HakoEnvironmentNameInner)
31
+ .default(['ft-com-prod-eu'])
32
+ .describe('the set of Hako environments to deploy to in the deploy:production command')
33
+ })
34
+ .passthrough()
35
+ .refine((options) => !('multiregion' in options), {
36
+ message: `the option ${styles.code('multiregion')} has been replaced by ${styles.code(
37
+ 'hakoReviewEnvironments'
38
+ )}, ${styles.code('hakoStagingEnvironments')}, and ${styles.code(
39
+ 'hakoProductionEnvironments'
40
+ )}. set ${styles.code('hakoProductionEnvironments')} to ${styles.code(
41
+ '[ft-com-prod-eu, ft-com-prod-us]'
42
+ )} for equivalent behaviour.`
43
+ })