skuba 5.0.0 → 5.1.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.
Files changed (79) hide show
  1. package/jest/transform.js +31 -9
  2. package/jest/transform.test.ts +11 -0
  3. package/lib/api/buildkite/annotate.d.ts +1 -1
  4. package/lib/api/git/getChangedFiles.d.ts +1 -1
  5. package/lib/api/github/checkRun.d.ts +2 -2
  6. package/lib/api/jest/index.d.ts +2 -2
  7. package/lib/cli/adapter/prettier.js +15 -1
  8. package/lib/cli/adapter/prettier.js.map +2 -2
  9. package/lib/cli/configure/processing/prettier.d.ts +1 -1
  10. package/lib/cli/configure/processing/typescript.d.ts +2 -2
  11. package/lib/cli/configure/types.d.ts +6 -6
  12. package/lib/cli/init/getConfig.js +18 -5
  13. package/lib/cli/init/getConfig.js.map +2 -2
  14. package/lib/cli/init/prompts.d.ts +14 -1
  15. package/lib/cli/init/prompts.js +7 -1
  16. package/lib/cli/init/prompts.js.map +2 -2
  17. package/lib/cli/init/types.d.ts +3 -2
  18. package/lib/cli/init/types.js +2 -1
  19. package/lib/cli/init/types.js.map +2 -2
  20. package/lib/cli/init/validation.d.ts +5 -0
  21. package/lib/cli/init/validation.js +10 -2
  22. package/lib/cli/init/validation.js.map +2 -2
  23. package/lib/skuba.js.map +1 -1
  24. package/lib/utils/command.d.ts +1 -1
  25. package/lib/utils/copy.d.ts +1 -1
  26. package/lib/utils/error.d.ts +1 -1
  27. package/lib/utils/exec.d.ts +2 -2
  28. package/lib/utils/logging.d.ts +1 -1
  29. package/lib/utils/manifest.d.ts +1 -1
  30. package/lib/utils/template.d.ts +2 -2
  31. package/lib/utils/version.d.ts +1 -1
  32. package/lib/utils/wait.d.ts +1 -1
  33. package/lib/wrapper/main.js.map +1 -1
  34. package/package.json +14 -14
  35. package/template/express-rest-api/.buildkite/pipeline.yml +1 -1
  36. package/template/express-rest-api/.gantry/common.yml +1 -1
  37. package/template/express-rest-api/.gantry/dev.yml +1 -0
  38. package/template/express-rest-api/.gantry/prod.yml +1 -0
  39. package/template/express-rest-api/Dockerfile +1 -1
  40. package/template/express-rest-api/Dockerfile.dev-deps +1 -1
  41. package/template/express-rest-api/README.md +7 -10
  42. package/template/express-rest-api/gantry.apply.yml +2 -2
  43. package/template/express-rest-api/gantry.build.yml +1 -1
  44. package/template/greeter/.buildkite/pipeline.yml +1 -1
  45. package/template/greeter/Dockerfile +1 -1
  46. package/template/greeter/README.md +6 -9
  47. package/template/koa-rest-api/.buildkite/pipeline.yml +1 -1
  48. package/template/koa-rest-api/.gantry/common.yml +1 -1
  49. package/template/koa-rest-api/.gantry/dev.yml +1 -0
  50. package/template/koa-rest-api/.gantry/prod.yml +1 -0
  51. package/template/koa-rest-api/Dockerfile +1 -1
  52. package/template/koa-rest-api/Dockerfile.dev-deps +1 -1
  53. package/template/koa-rest-api/README.md +7 -10
  54. package/template/koa-rest-api/gantry.apply.yml +2 -2
  55. package/template/koa-rest-api/gantry.build.yml +1 -1
  56. package/template/koa-rest-api/package.json +2 -2
  57. package/template/lambda-sqs-worker/.buildkite/pipeline.yml +4 -4
  58. package/template/lambda-sqs-worker/.nvmrc +1 -1
  59. package/template/lambda-sqs-worker/Dockerfile +1 -1
  60. package/template/lambda-sqs-worker/README.md +7 -10
  61. package/template/lambda-sqs-worker/package.json +10 -5
  62. package/template/lambda-sqs-worker/serverless.yml +2 -4
  63. package/template/lambda-sqs-worker/src/app.test.ts +5 -6
  64. package/template/lambda-sqs-worker/src/framework/handler.test.ts +2 -2
  65. package/template/lambda-sqs-worker/src/hooks.ts +22 -30
  66. package/template/lambda-sqs-worker/src/services/aws.ts +2 -2
  67. package/template/lambda-sqs-worker/src/services/pipelineEventSender.test.ts +9 -7
  68. package/template/lambda-sqs-worker/src/services/pipelineEventSender.ts +6 -4
  69. package/template/lambda-sqs-worker/src/testing/services.ts +11 -7
  70. package/template/lambda-sqs-worker/tsconfig.json +2 -2
  71. package/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml +4 -4
  72. package/template/lambda-sqs-worker-cdk/.nvmrc +1 -1
  73. package/template/lambda-sqs-worker-cdk/Dockerfile +1 -1
  74. package/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap +2 -4
  75. package/template/lambda-sqs-worker-cdk/infra/appStack.ts +4 -4
  76. package/template/lambda-sqs-worker-cdk/package.json +4 -4
  77. package/template/lambda-sqs-worker-cdk/tsconfig.json +2 -2
  78. package/template/oss-npm-package/_package.json +1 -1
  79. package/template/private-npm-package/_package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import * as t from 'runtypes';
2
2
  export declare const TEMPLATE_NAMES: readonly ["express-rest-api", "greeter", "koa-rest-api", "lambda-sqs-worker", "lambda-sqs-worker-cdk", "oss-npm-package", "private-npm-package"];
3
- export declare type TemplateName = typeof TEMPLATE_NAMES[number];
3
+ export type TemplateName = typeof TEMPLATE_NAMES[number];
4
4
  export declare const TEMPLATE_NAMES_WITH_BYO: readonly ["express-rest-api", "greeter", "koa-rest-api", "lambda-sqs-worker", "lambda-sqs-worker-cdk", "oss-npm-package", "private-npm-package", "github →"];
5
5
  interface TemplateDocumentationConfig {
6
6
  /**
@@ -17,7 +17,7 @@ interface TemplateDocumentationConfig {
17
17
  filename: string;
18
18
  }
19
19
  export declare const TEMPLATE_DOCUMENTATION_CONFIG: Record<TemplateName, TemplateDocumentationConfig>;
20
- export declare type TemplateConfig = t.Static<typeof TemplateConfig>;
20
+ export type TemplateConfig = t.Static<typeof TemplateConfig>;
21
21
  export declare const TemplateConfig: t.Record<{
22
22
  fields: t.Array<t.Record<{
23
23
  name: t.String;
@@ -1,6 +1,6 @@
1
1
  export declare const latestNpmVersion: (packageName: string) => Promise<string>;
2
2
  export declare const getSkubaVersion: () => Promise<string>;
3
- declare type SkubaVersionInfo = {
3
+ type SkubaVersionInfo = {
4
4
  isStale: true;
5
5
  local: string;
6
6
  latest: string;
@@ -5,7 +5,7 @@ export declare const sleep: (ms: number) => Timeout;
5
5
  export declare const throwOnTimeout: <T>(promise: PromiseLike<T>, { s }: {
6
6
  s: number;
7
7
  }) => Promise<T>;
8
- declare type TimeoutResult<T> = {
8
+ type TimeoutResult<T> = {
9
9
  ok: true;
10
10
  value: T;
11
11
  } | {
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/wrapper/main.ts"],
4
4
  "sourcesContent": ["import path from 'path';\n\nimport { runFunctionHandler } from './functionHandler';\nimport { runRequestListener } from './requestListener';\n\nexport const main = async (rawEntryPoint: string, rawPort: string) => {\n const availablePort = Number(rawPort) || undefined;\n\n // Support exported function targeting, e.g. `src/module.ts#callMeMaybe`\n const [modulePath, functionName] = path\n .join(process.cwd(), rawEntryPoint)\n .split('#', 2);\n\n // Load entry point as module\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const entryPoint = require(modulePath) as unknown;\n\n return functionName\n ? runFunctionHandler({ availablePort, entryPoint, functionName })\n : runRequestListener({ availablePort, entryPoint });\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,6BAAmC;AACnC,6BAAmC;AAE5B,MAAM,OAAO,OAAO,eAAuB,YAAoB;AACpE,QAAM,gBAAgB,OAAO,OAAO,KAAK;AAGzC,QAAM,CAAC,YAAY,YAAY,IAAI,YAAAA,QAChC,KAAK,QAAQ,IAAI,GAAG,aAAa,EACjC,MAAM,KAAK,CAAC;AAIf,QAAM,aAAa,QAAQ,UAAU;AAErC,SAAO,mBACH,2CAAmB,EAAE,eAAe,YAAY,aAAa,CAAC,QAC9D,2CAAmB,EAAE,eAAe,WAAW,CAAC;AACtD;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,6BAAmC;AACnC,6BAAmC;AAE5B,MAAM,OAAO,OAAO,eAAuB,YAAoB;AACpE,QAAM,gBAAgB,OAAO,OAAO,KAAK;AAGzC,QAAM,CAAC,YAAY,YAAY,IAAI,YAAAA,QAChC,KAAK,QAAQ,IAAI,GAAG,aAAa,EACjC,MAAM,KAAK,CAAC;AAIf,QAAM,aAAa,QAAQ;AAE3B,SAAO,mBACH,2CAAmB,EAAE,eAAe,YAAY,aAAa,CAAC,QAC9D,2CAAmB,EAAE,eAAe,WAAW,CAAC;AACtD;",
6
6
  "names": ["path"]
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skuba",
3
- "version": "5.0.0",
3
+ "version": "5.1.0",
4
4
  "private": false,
5
5
  "description": "SEEK development toolkit for backend applications and packages",
6
6
  "homepage": "https://github.com/seek-oss/skuba#readme",
@@ -81,12 +81,12 @@
81
81
  "dotenv": "^16.0.0",
82
82
  "ejs": "^3.1.6",
83
83
  "enquirer": "^2.3.6",
84
- "esbuild": "~0.15.7",
84
+ "esbuild": "~0.16.0",
85
85
  "eslint": "^8.11.0",
86
- "eslint-config-skuba": "1.1.4",
86
+ "eslint-config-skuba": "1.2.1",
87
87
  "execa": "^5.0.0",
88
88
  "fdir": "^5.0.0",
89
- "fs-extra": "^10.0.0",
89
+ "fs-extra": "^11.0.0",
90
90
  "function-arguments": "^1.0.9",
91
91
  "get-port": "^5.1.1",
92
92
  "ignore": "^5.1.8",
@@ -101,7 +101,7 @@
101
101
  "npm-run-path": "^4.0.1",
102
102
  "npm-which": "^3.0.1",
103
103
  "picomatch": "^2.2.2",
104
- "prettier": "~2.7.0",
104
+ "prettier": "~2.8.0",
105
105
  "read-pkg-up": "^7.0.1",
106
106
  "runtypes": "^6.0.0",
107
107
  "semantic-release": "^19.0.0",
@@ -115,15 +115,15 @@
115
115
  "ts-node-dev": "^2.0.0",
116
116
  "tsconfig-paths": "^4.0.0",
117
117
  "tsconfig-seek": "1.0.2",
118
- "typescript": "~4.8.2",
118
+ "typescript": "~4.9.0",
119
119
  "validate-npm-package-name": "^5.0.0"
120
120
  },
121
121
  "devDependencies": {
122
- "@changesets/cli": "2.25.2",
123
- "@changesets/get-github-info": "0.5.1",
124
- "@jest/reporters": "29.3.0",
122
+ "@changesets/cli": "2.26.0",
123
+ "@changesets/get-github-info": "0.5.2",
124
+ "@jest/reporters": "29.3.1",
125
125
  "@types/ejs": "3.1.1",
126
- "@types/express": "4.17.14",
126
+ "@types/express": "4.17.15",
127
127
  "@types/fs-extra": "9.0.13",
128
128
  "@types/koa": "2.13.5",
129
129
  "@types/libnpmsearch": "2.0.3",
@@ -133,15 +133,15 @@
133
133
  "@types/picomatch": "2.3.0",
134
134
  "@types/supertest": "2.0.12",
135
135
  "@types/validate-npm-package-name": "4.0.0",
136
- "enhanced-resolve": "5.10.0",
136
+ "enhanced-resolve": "5.12.0",
137
137
  "express": "4.18.2",
138
138
  "jsonfile": "6.1.0",
139
- "koa": "2.13.4",
140
- "memfs": "3.4.10",
139
+ "koa": "2.14.1",
140
+ "memfs": "3.4.12",
141
141
  "remark-cli": "11.0.0",
142
142
  "remark-preset-lint-recommended": "6.1.2",
143
143
  "semver": "7.3.8",
144
- "supertest": "6.3.1",
144
+ "supertest": "6.3.3",
145
145
  "type-fest": "2.19.0"
146
146
  },
147
147
  "peerDependencies": {
@@ -51,7 +51,7 @@ steps:
51
51
  - *aws-sm
52
52
  - *private-npm
53
53
  - *docker-ecr-cache
54
- - docker-compose#v4.5.0:
54
+ - docker-compose#v4.9.0:
55
55
  run: app
56
56
  timeout_in_minutes: 10
57
57
 
@@ -13,7 +13,7 @@ tags:
13
13
  # seek:data:consumers: internal
14
14
  # https://rfc.skinfra.xyz/RFC019-AWS-Tagging-Standard.html#seekdatatypes
15
15
  # seek:data:types:restricted: job-ads
16
- seek:env:label: '{{.Environment}}'
16
+ seek:env:label: '{{values "environment"}}'
17
17
  seek:env:production: '{{values "isProduction"}}'
18
18
  seek:owner:team: '<%- teamName %>'
19
19
  seek:source:sha: '{{.CommitSHA}}'
@@ -1,3 +1,4 @@
1
+ environment: dev
1
2
  env:
2
3
  SOME_ENVIRONMENT_VARIABLE: dev-value
3
4
 
@@ -1,3 +1,4 @@
1
+ environment: prod
1
2
  env:
2
3
  SOME_ENVIRONMENT_VARIABLE: prod-value
3
4
 
@@ -17,7 +17,7 @@ RUN yarn build
17
17
 
18
18
  ###
19
19
 
20
- FROM --platform=${BUILDPLATFORM:-arm64} gcr.io/distroless/nodejs:18 AS runtime
20
+ FROM --platform=${BUILDPLATFORM:-<%- platformName %>} gcr.io/distroless/nodejs:18 AS runtime
21
21
 
22
22
  WORKDIR /workdir
23
23
 
@@ -1,6 +1,6 @@
1
1
  # syntax=docker/dockerfile:1.2
2
2
 
3
- FROM --platform=${BUILDPLATFORM:-arm64} node:18-alpine AS dev-deps
3
+ FROM --platform=${BUILDPLATFORM:-<%- platformName %>} node:18-alpine AS dev-deps
4
4
 
5
5
  WORKDIR /workdir
6
6
 
@@ -4,24 +4,21 @@
4
4
 
5
5
  Next steps:
6
6
 
7
- 1. [ ] Check if your team has a Graviton-based Buildkite cluster;
8
- see the [ARM64 guide] for more information.
9
- 2. [ ] Finish templating if this was skipped earlier:
7
+ 1. [ ] Finish templating if this was skipped earlier:
10
8
 
11
9
  ```shell
12
10
  yarn skuba configure
13
11
  ```
14
12
 
15
- 3. [ ] Create a new repository in the appropriate GitHub organisation.
16
- 4. [ ] Add the repository to BuildAgency;
13
+ 2. [ ] Create a new repository in the appropriate GitHub organisation.
14
+ 3. [ ] Add the repository to BuildAgency;
17
15
  see [Builds at SEEK] for more information.
18
- 5. [ ] Add Datadog configuration and data classification tags to [.gantry/common.yml](.gantry/common.yml);
16
+ 4. [ ] Add Datadog configuration and data classification tags to [.gantry/common.yml](.gantry/common.yml);
19
17
  see the [Gantry] documentation for more information.
20
- 6. [ ] Push local commits to the upstream GitHub branch.
21
- 7. [ ] Configure [GitHub repository settings].
22
- 8. [ ] Delete this checklist 😌.
18
+ 5. [ ] Push local commits to the upstream GitHub branch.
19
+ 6. [ ] Configure [GitHub repository settings].
20
+ 7. [ ] Delete this checklist 😌.
23
21
 
24
- [arm64 guide]: https://seek-oss.github.io/skuba/docs/deep-dives/arm64.html
25
22
  [builds at seek]: https://builds-at-seek.ssod.skinfra.xyz
26
23
  [github repository settings]: https://github.com/<%-orgName%>/<%-repoName%>/settings
27
24
 
@@ -10,7 +10,7 @@ env:
10
10
  # https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/node-reusing-connections.html
11
11
  AWS_NODEJS_CONNECTION_REUSE_ENABLED: '1'
12
12
 
13
- ENVIRONMENT: '{{.Environment}}'
13
+ ENVIRONMENT: '{{values "environment"}}'
14
14
  SERVICE: '{{values "service"}}'
15
15
 
16
16
  {{range $key, $value := .Values.env}}
@@ -119,4 +119,4 @@ tags:
119
119
  {{$key}}: '{{$value}}'
120
120
  {{end}}
121
121
 
122
- cpuArchitecture: arm64
122
+ cpuArchitecture: <%- platformName %>
@@ -12,4 +12,4 @@ buildArgs:
12
12
  # SEEK-Jobs/gantry#1661
13
13
  failOnScanFindings: false
14
14
 
15
- cpuArchitecture: arm64
15
+ cpuArchitecture: <%- platformName %>
@@ -32,6 +32,6 @@ steps:
32
32
  - *aws-sm
33
33
  - *private-npm
34
34
  - *docker-ecr-cache
35
- - docker-compose#v4.5.0:
35
+ - docker-compose#v4.9.0:
36
36
  run: app
37
37
  timeout_in_minutes: 10
@@ -1,6 +1,6 @@
1
1
  # syntax=docker/dockerfile:1.2
2
2
 
3
- FROM --platform=${BUILDPLATFORM:-arm64} node:18-alpine AS dev-deps
3
+ FROM --platform=${BUILDPLATFORM:-<%- platformName %>} node:18-alpine AS dev-deps
4
4
 
5
5
  WORKDIR /workdir
6
6
 
@@ -4,22 +4,19 @@
4
4
 
5
5
  Next steps:
6
6
 
7
- 1. [ ] Check if your team has a Graviton-based Buildkite cluster;
8
- see the [ARM64 guide] for more information.
9
- 2. [ ] Finish templating if this was skipped earlier:
7
+ 1. [ ] Finish templating if this was skipped earlier:
10
8
 
11
9
  ```shell
12
10
  yarn skuba configure
13
11
  ```
14
12
 
15
- 3. [ ] Create a new repository in the appropriate GitHub organisation.
16
- 4. [ ] Add the repository to BuildAgency;
13
+ 2. [ ] Create a new repository in the appropriate GitHub organisation.
14
+ 3. [ ] Add the repository to BuildAgency;
17
15
  see [Builds at SEEK] for more information.
18
- 5. [ ] Push local commits to the upstream GitHub branch.
19
- 6. [ ] Configure [GitHub repository settings].
20
- 7. [ ] Delete this checklist 😌.
16
+ 4. [ ] Push local commits to the upstream GitHub branch.
17
+ 5. [ ] Configure [GitHub repository settings].
18
+ 6. [ ] Delete this checklist 😌.
21
19
 
22
- [arm64 guide]: https://seek-oss.github.io/skuba/docs/deep-dives/arm64.html
23
20
  [builds at seek]: https://builds-at-seek.ssod.skinfra.xyz
24
21
  [github repository settings]: https://github.com/<%-orgName%>/<%-repoName%>/settings
25
22
 
@@ -51,7 +51,7 @@ steps:
51
51
  - *aws-sm
52
52
  - *private-npm
53
53
  - *docker-ecr-cache
54
- - docker-compose#v4.5.0:
54
+ - docker-compose#v4.9.0:
55
55
  run: app
56
56
  timeout_in_minutes: 10
57
57
 
@@ -13,7 +13,7 @@ tags:
13
13
  # seek:data:consumers: internal
14
14
  # https://rfc.skinfra.xyz/RFC019-AWS-Tagging-Standard.html#seekdatatypes
15
15
  # seek:data:types:restricted: job-ads
16
- seek:env:label: '{{.Environment}}'
16
+ seek:env:label: '{{values "environment"}}'
17
17
  seek:env:production: '{{values "isProduction"}}'
18
18
  seek:owner:team: '<%- teamName %>'
19
19
  seek:source:sha: '{{.CommitSHA}}'
@@ -1,3 +1,4 @@
1
+ environment: dev
1
2
  env:
2
3
  SOME_ENVIRONMENT_VARIABLE: dev-value
3
4
 
@@ -1,3 +1,4 @@
1
+ environment: prod
1
2
  env:
2
3
  SOME_ENVIRONMENT_VARIABLE: prod-value
3
4
 
@@ -17,7 +17,7 @@ RUN yarn build
17
17
 
18
18
  ###
19
19
 
20
- FROM --platform=${BUILDPLATFORM:-arm64} gcr.io/distroless/nodejs:18 AS runtime
20
+ FROM --platform=${BUILDPLATFORM:-<%- platformName %>} gcr.io/distroless/nodejs:18 AS runtime
21
21
 
22
22
  WORKDIR /workdir
23
23
 
@@ -1,6 +1,6 @@
1
1
  # syntax=docker/dockerfile:1.2
2
2
 
3
- FROM --platform=${BUILDPLATFORM:-arm64} node:18-alpine AS dev-deps
3
+ FROM --platform=${BUILDPLATFORM:-<%- platformName %>} node:18-alpine AS dev-deps
4
4
 
5
5
  WORKDIR /workdir
6
6
 
@@ -4,24 +4,21 @@
4
4
 
5
5
  Next steps:
6
6
 
7
- 1. [ ] Check if your team has a Graviton-based Buildkite cluster;
8
- see the [ARM64 guide] for more information.
9
- 2. [ ] Finish templating if this was skipped earlier:
7
+ 1. [ ] Finish templating if this was skipped earlier:
10
8
 
11
9
  ```shell
12
10
  yarn skuba configure
13
11
  ```
14
12
 
15
- 3. [ ] Create a new repository in the appropriate GitHub organisation.
16
- 4. [ ] Add the repository to BuildAgency;
13
+ 2. [ ] Create a new repository in the appropriate GitHub organisation.
14
+ 3. [ ] Add the repository to BuildAgency;
17
15
  see [Builds at SEEK] for more information.
18
- 5. [ ] Add Datadog configuration and data classification tags to [.gantry/common.yml](.gantry/common.yml);
16
+ 4. [ ] Add Datadog configuration and data classification tags to [.gantry/common.yml](.gantry/common.yml);
19
17
  see the [Gantry] documentation for more information.
20
- 6. [ ] Push local commits to the upstream GitHub branch.
21
- 7. [ ] Configure [GitHub repository settings].
22
- 8. [ ] Delete this checklist 😌.
18
+ 5. [ ] Push local commits to the upstream GitHub branch.
19
+ 6. [ ] Configure [GitHub repository settings].
20
+ 7. [ ] Delete this checklist 😌.
23
21
 
24
- [arm64 guide]: https://seek-oss.github.io/skuba/docs/deep-dives/arm64.html
25
22
  [builds at seek]: https://builds-at-seek.ssod.skinfra.xyz
26
23
  [github repository settings]: https://github.com/<%-orgName%>/<%-repoName%>/settings
27
24
 
@@ -10,7 +10,7 @@ env:
10
10
  # https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/node-reusing-connections.html
11
11
  AWS_NODEJS_CONNECTION_REUSE_ENABLED: '1'
12
12
 
13
- ENVIRONMENT: '{{.Environment}}'
13
+ ENVIRONMENT: '{{values "environment"}}'
14
14
  OPENTELEMETRY_ENABLED: '{{.Values.openTelemetry.enabled | default false}}'
15
15
  SERVICE: '{{values "service"}}'
16
16
 
@@ -126,4 +126,4 @@ tags:
126
126
  {{$key}}: '{{$value}}'
127
127
  {{end}}
128
128
 
129
- cpuArchitecture: arm64
129
+ cpuArchitecture: <%- platformName %>
@@ -12,4 +12,4 @@ buildArgs:
12
12
  # SEEK-Jobs/gantry#1661
13
13
  failOnScanFindings: false
14
14
 
15
- cpuArchitecture: arm64
15
+ cpuArchitecture: <%- platformName %>
@@ -16,8 +16,8 @@
16
16
  "@opentelemetry/api": "^1.1.0",
17
17
  "@opentelemetry/exporter-collector-grpc": "^0.25.0",
18
18
  "@opentelemetry/instrumentation-aws-sdk": "^0.32.0",
19
- "@opentelemetry/instrumentation-http": "^0.33.0",
20
- "@opentelemetry/sdk-node": "^0.33.0",
19
+ "@opentelemetry/instrumentation-http": "^0.34.0",
20
+ "@opentelemetry/sdk-node": "^0.34.0",
21
21
  "@seek/logger": "^5.0.1",
22
22
  "aws-sdk": "^2.1039.0",
23
23
  "hot-shots": "^9.0.0",
@@ -26,13 +26,13 @@ configs:
26
26
  - yarn deploy
27
27
  concurrency: 1
28
28
  plugins:
29
- - artifacts#v1.7.0:
29
+ - artifacts#v1.8.0:
30
30
  build: ${BUILDKITE_BUILD_ID}
31
31
  download: lib/*
32
32
  - *aws-sm
33
33
  - *private-npm
34
34
  - *docker-ecr-cache
35
- - docker-compose#v4.5.0:
35
+ - docker-compose#v4.9.0:
36
36
  dependencies: false
37
37
  run: app
38
38
  retry:
@@ -60,13 +60,13 @@ steps:
60
60
  - *aws-sm
61
61
  - *private-npm
62
62
  - *docker-ecr-cache
63
- - docker-compose#v4.5.0:
63
+ - docker-compose#v4.9.0:
64
64
  run: app
65
65
  timeout_in_minutes: 10
66
66
 
67
67
  - agents:
68
68
  queue: <%- devBuildkiteQueueName %>
69
- branches: '!renovate--*'
69
+ branches: '!renovate-*'
70
70
  label: 🧖‍♀️ Warm Dev
71
71
  command: ':'
72
72
  plugins:
@@ -1 +1 @@
1
- 16
1
+ 18
@@ -1,6 +1,6 @@
1
1
  # syntax=docker/dockerfile:1.2
2
2
 
3
- FROM --platform=${BUILDPLATFORM:-arm64} node:16-alpine AS dev-deps
3
+ FROM --platform=${BUILDPLATFORM:-<%- platformName %>} node:18-alpine AS dev-deps
4
4
 
5
5
  WORKDIR /workdir
6
6
 
@@ -4,23 +4,20 @@
4
4
 
5
5
  Next steps:
6
6
 
7
- 1. [ ] Check if your team has a Graviton-based Buildkite cluster;
8
- see the [ARM64 guide] for more information.
9
- 2. [ ] Finish templating if this was skipped earlier:
7
+ 1. [ ] Finish templating if this was skipped earlier:
10
8
 
11
9
  ```shell
12
10
  yarn skuba configure
13
11
  ```
14
12
 
15
- 3. [ ] Create a new repository in the appropriate GitHub organisation.
16
- 4. [ ] Add the repository to BuildAgency;
13
+ 2. [ ] Create a new repository in the appropriate GitHub organisation.
14
+ 3. [ ] Add the repository to BuildAgency;
17
15
  see [Builds at SEEK] for more information.
18
- 5. [ ] Add Datadog extension, deployment bucket configuration and data classification tags to [serverless.yml](serverless.yml).
19
- 6. [ ] Push local commits to the upstream GitHub branch.
20
- 7. [ ] Configure [GitHub repository settings].
21
- 8. [ ] Delete this checklist 😌.
16
+ 4. [ ] Add Datadog extension, deployment bucket configuration and data classification tags to [serverless.yml](serverless.yml).
17
+ 5. [ ] Push local commits to the upstream GitHub branch.
18
+ 6. [ ] Configure [GitHub repository settings].
19
+ 7. [ ] Delete this checklist 😌.
22
20
 
23
- [arm64 guide]: https://seek-oss.github.io/skuba/docs/deep-dives/arm64.html
24
21
  [builds at seek]: https://builds-at-seek.ssod.skinfra.xyz
25
22
  [github repository settings]: https://github.com/<%-orgName%>/<%-repoName%>/settings
26
23
 
@@ -14,25 +14,30 @@
14
14
  "test:watch": "skuba test --watch"
15
15
  },
16
16
  "dependencies": {
17
+ "@aws-sdk/client-codedeploy": "^3.213.0",
18
+ "@aws-sdk/client-lambda": "^3.213.0",
19
+ "@aws-sdk/client-sns": "^3.213.0",
17
20
  "@seek/logger": "^5.0.1",
18
- "aws-sdk": "^2.1011.0",
19
21
  "datadog-lambda-js": "^6.83.0",
22
+ "dd-trace": "^3.8.0",
20
23
  "skuba-dive": "^2.0.0",
21
24
  "zod": "^3.19.1"
22
25
  },
23
26
  "devDependencies": {
24
27
  "@types/aws-lambda": "^8.10.84",
25
28
  "@types/chance": "^1.1.3",
26
- "@types/node": "16.11.64",
29
+ "@types/node": "^18.11.9",
30
+ "aws-sdk-client-mock": "^2.0.1",
31
+ "aws-sdk-client-mock-jest": "^2.0.1",
27
32
  "chance": "^1.1.8",
28
33
  "pino-pretty": "^9.0.0",
29
- "serverless": "^3.17.0",
34
+ "serverless": "^3.25.0",
30
35
  "serverless-plugin-canary-deployments": "^0.8.0",
31
- "serverless-plugin-datadog": "^5.7.0",
36
+ "serverless-plugin-datadog": "^5.12.0",
32
37
  "serverless-prune-plugin": "^2.0.0",
33
38
  "skuba": "*"
34
39
  },
35
40
  "engines": {
36
- "node": ">=16"
41
+ "node": ">=18"
37
42
  }
38
43
  }
@@ -37,8 +37,8 @@ provider:
37
37
  logRetentionInDays: 30
38
38
  name: aws
39
39
  region: ap-southeast-2
40
- runtime: nodejs16.x
41
- architecture: arm64
40
+ runtime: nodejs18.x
41
+ architecture: <%- lambdaServerlessArchitecture %>
42
42
  deploymentMethod: direct
43
43
  stackName: ${self:service}
44
44
  stage: ${env:ENVIRONMENT}
@@ -47,8 +47,6 @@ provider:
47
47
  # This is easier to manage in terms of access, deployment, and tagging.
48
48
  name: ${param:deploymentBucket}
49
49
  environment:
50
- # https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/node-reusing-connections.html
51
- AWS_NODEJS_CONNECTION_REUSE_ENABLED: 1
52
50
  NODE_ENV: production
53
51
  # https://nodejs.org/api/cli.html#cli_node_options_options
54
52
  NODE_OPTIONS: --enable-source-maps
@@ -1,3 +1,5 @@
1
+ import { PublishCommand } from '@aws-sdk/client-sns';
2
+
1
3
  import { metricsClient } from 'src/framework/metrics';
2
4
  import { createCtx, createSqsEvent } from 'src/testing/handler';
3
5
  import { logger } from 'src/testing/logging';
@@ -23,13 +25,10 @@ describe('handler', () => {
23
25
 
24
26
  beforeAll(logger.spy);
25
27
  beforeAll(scoringService.spy);
26
- beforeAll(sns.spy);
27
28
 
28
29
  beforeEach(() => {
29
30
  scoringService.request.mockResolvedValue(score);
30
- sns.publish.mockPromise(
31
- Promise.resolve({ MessageId: chance.guid({ version: 4 }) }),
32
- );
31
+ sns.publish.resolves({ MessageId: chance.guid({ version: 4 }) });
33
32
  });
34
33
 
35
34
  afterEach(() => {
@@ -59,7 +58,7 @@ describe('handler', () => {
59
58
  ['job.scored', 1],
60
59
  ]);
61
60
 
62
- expect(sns.publish).toHaveBeenCalledTimes(1);
61
+ expect(sns.client).toReceiveCommandTimes(PublishCommand, 1);
63
62
  });
64
63
 
65
64
  it('throws on invalid input', () => {
@@ -83,7 +82,7 @@ describe('handler', () => {
83
82
  it('bubbles up SNS error', async () => {
84
83
  const err = Error(chance.sentence());
85
84
 
86
- sns.publish.mockPromise(Promise.reject(err));
85
+ sns.publish.rejects(err);
87
86
 
88
87
  const event = createSqsEvent([JSON.stringify(jobPublished)]);
89
88
 
@@ -40,7 +40,7 @@ describe('createHandler', () => {
40
40
 
41
41
  await expect(handler(input, ctx)).rejects.toThrow('Function failed');
42
42
 
43
- expect(logger.error.mock.calls).toEqual([[{ err }, 'Function failed']]);
43
+ expect(logger.error).toHaveBeenCalledWith({ err }, 'Function failed');
44
44
 
45
45
  expect(logger.info).not.toHaveBeenCalled();
46
46
  });
@@ -54,7 +54,7 @@ describe('createHandler', () => {
54
54
 
55
55
  await expect(handler(input, ctx)).rejects.toThrow('Function failed');
56
56
 
57
- expect(logger.error.mock.calls).toEqual([[{ err }, 'Function failed']]);
57
+ expect(logger.error).toHaveBeenCalledWith({ err }, 'Function failed');
58
58
 
59
59
  expect(logger.info).not.toHaveBeenCalled();
60
60
  });