skuba 0.0.0-master-20231002013336 → 0.0.0-master-20240206001217
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/README.md +3 -3
- package/jest/transform.test.ts +3 -1
- package/lib/api/jest/index.d.ts +3 -3
- package/lib/api/jest/index.js +19 -1
- package/lib/api/jest/index.js.map +2 -2
- package/lib/api/net/compose.js +2 -1
- package/lib/api/net/compose.js.map +2 -2
- package/lib/cli/adapter/prettier.d.ts +1 -1
- package/lib/cli/adapter/prettier.js +11 -10
- package/lib/cli/adapter/prettier.js.map +2 -2
- package/lib/cli/build/index.js +0 -2
- package/lib/cli/build/index.js.map +2 -2
- package/lib/cli/buildPackage.js +0 -2
- package/lib/cli/buildPackage.js.map +2 -2
- package/lib/cli/configure/analyseConfiguration.d.ts +2 -0
- package/lib/cli/configure/analyseConfiguration.js.map +2 -2
- package/lib/cli/configure/getEntryPoint.js +1 -1
- package/lib/cli/configure/getEntryPoint.js.map +2 -2
- package/lib/cli/configure/getProjectType.d.ts +1 -1
- package/lib/cli/configure/getProjectType.js +6 -3
- package/lib/cli/configure/getProjectType.js.map +2 -2
- package/lib/cli/configure/index.js +11 -12
- package/lib/cli/configure/index.js.map +2 -2
- package/lib/cli/configure/modules/index.js +0 -2
- package/lib/cli/configure/modules/index.js.map +2 -2
- package/lib/cli/configure/modules/package.d.ts +1 -1
- package/lib/cli/configure/modules/package.js +2 -1
- package/lib/cli/configure/modules/package.js.map +2 -2
- package/lib/cli/configure/patchRenovateConfig.d.ts +2 -1
- package/lib/cli/configure/patchRenovateConfig.js +36 -21
- package/lib/cli/configure/patchRenovateConfig.js.map +2 -2
- package/lib/cli/configure/types.d.ts +2 -0
- package/lib/cli/configure/types.js.map +1 -1
- package/lib/cli/configure/upgrade/index.d.ts +15 -0
- package/lib/cli/configure/upgrade/index.js +130 -0
- package/lib/cli/configure/upgrade/index.js.map +7 -0
- package/lib/cli/configure/{addEmptyExports.d.ts → upgrade/patches/7.3.1/addEmptyExports.d.ts} +2 -2
- package/lib/cli/configure/{addEmptyExports.js → upgrade/patches/7.3.1/addEmptyExports.js} +15 -11
- package/lib/cli/configure/upgrade/patches/7.3.1/addEmptyExports.js.map +7 -0
- package/lib/cli/configure/upgrade/patches/7.3.1/index.d.ts +2 -0
- package/lib/cli/configure/upgrade/patches/7.3.1/index.js +55 -0
- package/lib/cli/configure/upgrade/patches/7.3.1/index.js.map +7 -0
- package/lib/cli/configure/upgrade/patches/7.3.1/moveNpmrcOutOfGitignoreManagedSection.d.ts +2 -0
- package/lib/cli/configure/upgrade/patches/7.3.1/moveNpmrcOutOfGitignoreManagedSection.js +94 -0
- package/lib/cli/configure/upgrade/patches/7.3.1/moveNpmrcOutOfGitignoreManagedSection.js.map +7 -0
- package/lib/cli/configure/upgrade/patches/7.3.1/patchDockerfile.d.ts +2 -0
- package/lib/cli/configure/{patchDockerfile.js → upgrade/patches/7.3.1/patchDockerfile.js} +18 -12
- package/lib/cli/configure/upgrade/patches/7.3.1/patchDockerfile.js.map +7 -0
- package/lib/cli/configure/upgrade/patches/7.3.1/patchServerListener.d.ts +2 -0
- package/lib/cli/configure/{patchServerListener.js → upgrade/patches/7.3.1/patchServerListener.js} +18 -14
- package/lib/cli/configure/upgrade/patches/7.3.1/patchServerListener.js.map +7 -0
- package/lib/cli/format.js +7 -14
- package/lib/cli/format.js.map +2 -2
- package/lib/cli/init/getConfig.d.ts +7 -5
- package/lib/cli/init/getConfig.js +61 -34
- package/lib/cli/init/getConfig.js.map +2 -2
- package/lib/cli/init/git.d.ts +2 -1
- package/lib/cli/init/git.js +2 -9
- package/lib/cli/init/git.js.map +2 -2
- package/lib/cli/init/index.d.ts +1 -1
- package/lib/cli/init/index.js +19 -10
- package/lib/cli/init/index.js.map +2 -2
- package/lib/cli/init/prompts.d.ts +26 -3
- package/lib/cli/init/prompts.js +10 -2
- package/lib/cli/init/prompts.js.map +2 -2
- package/lib/cli/init/types.d.ts +120 -27
- package/lib/cli/init/types.js +30 -35
- package/lib/cli/init/types.js.map +2 -2
- package/lib/cli/init/writePackageJson.d.ts +6 -0
- package/lib/cli/init/writePackageJson.js.map +2 -2
- package/lib/cli/lint/annotate/buildkite/index.d.ts +2 -1
- package/lib/cli/lint/annotate/buildkite/index.js +5 -3
- package/lib/cli/lint/annotate/buildkite/index.js.map +2 -2
- package/lib/cli/lint/annotate/buildkite/internal.d.ts +2 -0
- package/lib/cli/lint/annotate/buildkite/internal.js +45 -0
- package/lib/cli/lint/annotate/buildkite/internal.js.map +7 -0
- package/lib/cli/lint/annotate/github/index.d.ts +2 -1
- package/lib/cli/lint/annotate/github/index.js +4 -2
- package/lib/cli/lint/annotate/github/index.js.map +2 -2
- package/lib/cli/lint/annotate/github/internal.d.ts +3 -0
- package/lib/cli/lint/annotate/github/internal.js +36 -0
- package/lib/cli/lint/annotate/github/internal.js.map +7 -0
- package/lib/cli/lint/annotate/index.d.ts +4 -3
- package/lib/cli/lint/annotate/index.js +9 -3
- package/lib/cli/lint/annotate/index.js.map +2 -2
- package/lib/cli/lint/autofix.d.ts +3 -1
- package/lib/cli/lint/autofix.js +36 -59
- package/lib/cli/lint/autofix.js.map +3 -3
- package/lib/cli/lint/external.d.ts +6 -1
- package/lib/cli/lint/external.js +6 -29
- package/lib/cli/lint/external.js.map +2 -2
- package/lib/cli/lint/index.d.ts +2 -1
- package/lib/cli/lint/index.js +46 -14
- package/lib/cli/lint/index.js.map +2 -2
- package/lib/cli/lint/internal.d.ts +12 -1
- package/lib/cli/lint/internal.js +55 -19
- package/lib/cli/lint/internal.js.map +3 -3
- package/lib/cli/lint/internalLints/deleteFiles.d.ts +3 -0
- package/lib/cli/lint/internalLints/deleteFiles.js +102 -0
- package/lib/cli/lint/internalLints/deleteFiles.js.map +7 -0
- package/lib/cli/lint/internalLints/noSkubaTemplateJs.d.ts +3 -0
- package/lib/cli/lint/internalLints/noSkubaTemplateJs.js +75 -0
- package/lib/cli/lint/internalLints/noSkubaTemplateJs.js.map +7 -0
- package/lib/cli/lint/internalLints/refreshConfigFiles.d.ts +11 -0
- package/lib/cli/lint/internalLints/refreshConfigFiles.js +147 -0
- package/lib/cli/lint/internalLints/refreshConfigFiles.js.map +7 -0
- package/lib/cli/test/index.js +0 -2
- package/lib/cli/test/index.js.map +2 -2
- package/lib/skuba.d.ts +1 -1
- package/lib/skuba.js.map +1 -1
- package/lib/utils/error.d.ts +30 -10
- package/lib/utils/error.js +10 -20
- package/lib/utils/error.js.map +2 -2
- package/lib/utils/exec.d.ts +2 -1
- package/lib/utils/exec.js +3 -2
- package/lib/utils/exec.js.map +2 -2
- package/lib/utils/logging.d.ts +2 -0
- package/lib/utils/logging.js +1 -0
- package/lib/utils/logging.js.map +2 -2
- package/lib/utils/logo.js +6 -10
- package/lib/utils/logo.js.map +3 -3
- package/lib/utils/manifest.d.ts +4 -4
- package/lib/utils/manifest.js +10 -10
- package/lib/utils/manifest.js.map +2 -2
- package/lib/utils/npmrc.d.ts +1 -0
- package/lib/utils/npmrc.js +29 -0
- package/lib/utils/npmrc.js.map +7 -0
- package/lib/utils/packageManager.d.ts +24 -0
- package/lib/utils/packageManager.js +97 -0
- package/lib/utils/packageManager.js.map +7 -0
- package/lib/utils/template.d.ts +46 -13
- package/lib/utils/template.js +17 -15
- package/lib/utils/template.js.map +2 -2
- package/lib/utils/worker.d.ts +1 -0
- package/lib/wrapper/http.d.ts +1 -0
- package/package.json +50 -47
- package/template/base/_.dockerignore +0 -1
- package/template/base/_.eslintignore +1 -0
- package/template/base/_.gitignore +1 -1
- package/template/base/_.npmrc +8 -0
- package/template/express-rest-api/.buildkite/pipeline.yml +16 -12
- package/template/express-rest-api/.gantry/dev.yml +3 -0
- package/template/express-rest-api/.nvmrc +1 -1
- package/template/express-rest-api/Dockerfile +6 -12
- package/template/express-rest-api/Dockerfile.dev-deps +8 -7
- package/template/express-rest-api/README.md +12 -12
- package/template/express-rest-api/docker-compose.yml +0 -10
- package/template/express-rest-api/gantry.apply.yml +5 -0
- package/template/express-rest-api/gantry.build.yml +1 -2
- package/template/express-rest-api/package.json +4 -4
- package/template/express-rest-api/skuba.template.js +1 -0
- package/template/greeter/.buildkite/pipeline.yml +15 -11
- package/template/greeter/.nvmrc +1 -1
- package/template/greeter/Dockerfile +8 -7
- package/template/greeter/README.md +9 -9
- package/template/greeter/docker-compose.yml +0 -10
- package/template/greeter/package.json +3 -3
- package/template/greeter/skuba.template.js +1 -0
- package/template/koa-rest-api/.buildkite/pipeline.yml +16 -12
- package/template/koa-rest-api/.gantry/dev.yml +3 -0
- package/template/koa-rest-api/.nvmrc +1 -1
- package/template/koa-rest-api/Dockerfile +6 -12
- package/template/koa-rest-api/Dockerfile.dev-deps +8 -7
- package/template/koa-rest-api/README.md +12 -12
- package/template/koa-rest-api/docker-compose.yml +0 -10
- package/template/koa-rest-api/gantry.apply.yml +5 -0
- package/template/koa-rest-api/gantry.build.yml +1 -2
- package/template/koa-rest-api/package.json +10 -8
- package/template/koa-rest-api/skuba.template.js +1 -0
- package/template/koa-rest-api/src/app.test.ts +8 -4
- package/template/koa-rest-api/src/framework/validation.test.ts +48 -15
- package/template/koa-rest-api/src/framework/validation.ts +31 -8
- package/template/koa-rest-api/src/testing/types.ts +16 -4
- package/template/lambda-sqs-worker/.buildkite/pipeline.yml +25 -18
- package/template/lambda-sqs-worker/.nvmrc +1 -1
- package/template/lambda-sqs-worker/Dockerfile +8 -8
- package/template/lambda-sqs-worker/README.md +14 -14
- package/template/lambda-sqs-worker/_.npmrc +12 -0
- package/template/lambda-sqs-worker/docker-compose.yml +0 -15
- package/template/lambda-sqs-worker/package.json +6 -7
- package/template/lambda-sqs-worker/serverless.yml +5 -2
- package/template/lambda-sqs-worker/skuba.template.js +1 -0
- package/template/lambda-sqs-worker/src/framework/validation.test.ts +1 -1
- package/template/lambda-sqs-worker/src/hooks.ts +1 -2
- package/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml +46 -21
- package/template/lambda-sqs-worker-cdk/.nvmrc +1 -1
- package/template/lambda-sqs-worker-cdk/Dockerfile +11 -9
- package/template/lambda-sqs-worker-cdk/cdk.json +12 -6
- package/template/lambda-sqs-worker-cdk/docker-compose.yml +0 -15
- package/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap +1590 -228
- package/template/lambda-sqs-worker-cdk/infra/appStack.test.ts +23 -3
- package/template/lambda-sqs-worker-cdk/infra/appStack.ts +128 -15
- package/template/lambda-sqs-worker-cdk/package.json +9 -7
- package/template/lambda-sqs-worker-cdk/shared/context-types.ts +1 -0
- package/template/lambda-sqs-worker-cdk/skuba.template.js +1 -0
- package/template/lambda-sqs-worker-cdk/src/app.ts +14 -1
- package/template/lambda-sqs-worker-cdk/src/postHook.ts +154 -0
- package/template/lambda-sqs-worker-cdk/src/preHook.ts +95 -0
- package/template/oss-npm-package/.github/workflows/release.yml +10 -7
- package/template/oss-npm-package/.github/workflows/validate.yml +10 -7
- package/template/oss-npm-package/.nvmrc +1 -1
- package/template/oss-npm-package/.releaserc +16 -0
- package/template/oss-npm-package/README.md +18 -18
- package/template/oss-npm-package/_package.json +3 -2
- package/template/oss-npm-package/skuba.template.js +1 -0
- package/template/private-npm-package/.nvmrc +1 -1
- package/template/private-npm-package/.releaserc +16 -0
- package/template/private-npm-package/README.md +18 -18
- package/template/private-npm-package/_package.json +3 -3
- package/template/private-npm-package/skuba.template.js +1 -0
- package/lib/cli/configure/addEmptyExports.js.map +0 -7
- package/lib/cli/configure/modules/tsconfig.d.ts +0 -2
- package/lib/cli/configure/modules/tsconfig.js +0 -87
- package/lib/cli/configure/modules/tsconfig.js.map +0 -7
- package/lib/cli/configure/patchDockerfile.d.ts +0 -1
- package/lib/cli/configure/patchDockerfile.js.map +0 -7
- package/lib/cli/configure/patchServerListener.d.ts +0 -3
- package/lib/cli/configure/patchServerListener.js.map +0 -7
- package/lib/cli/configure/refreshIgnoreFiles.d.ts +0 -3
- package/lib/cli/configure/refreshIgnoreFiles.js +0 -78
- package/lib/cli/configure/refreshIgnoreFiles.js.map +0 -7
|
@@ -7,7 +7,7 @@ Next steps:
|
|
|
7
7
|
1. [ ] Finish templating if this was skipped earlier:
|
|
8
8
|
|
|
9
9
|
```shell
|
|
10
|
-
|
|
10
|
+
pnpm exec skuba configure
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
2. [ ] Create a new repository in the appropriate GitHub organisation.
|
|
@@ -19,12 +19,12 @@ Next steps:
|
|
|
19
19
|
6. [ ] Configure [GitHub repository settings].
|
|
20
20
|
7. [ ] Delete this checklist 😌.
|
|
21
21
|
|
|
22
|
-
[builds at seek]: https://builds-
|
|
22
|
+
[builds at seek]: https://backstage.myseek.xyz/docs/default/component/builds-cicd-seek/
|
|
23
23
|
[github repository settings]: https://github.com/<%-orgName%>/<%-repoName%>/settings
|
|
24
24
|
|
|
25
25
|
## Design
|
|
26
26
|
|
|
27
|
-
<%-repoName %> is a Node.js HTTP server built in line with our [
|
|
27
|
+
<%-repoName %> is a Node.js HTTP server built in line with our [Technical Guidelines].
|
|
28
28
|
It uses the [Express] middleware framework and common SEEK packages.
|
|
29
29
|
Resource APIs enable synchronous interactions and serve as the backbone of SEEK's general service architecture.
|
|
30
30
|
|
|
@@ -43,27 +43,27 @@ This defaults to an HTTP request to the `GET /smoke` endpoint.
|
|
|
43
43
|
### Test
|
|
44
44
|
|
|
45
45
|
```shell
|
|
46
|
-
|
|
46
|
+
pnpm run test
|
|
47
47
|
```
|
|
48
48
|
|
|
49
49
|
### Lint
|
|
50
50
|
|
|
51
51
|
```shell
|
|
52
52
|
# fix
|
|
53
|
-
|
|
53
|
+
pnpm run format
|
|
54
54
|
|
|
55
55
|
# check
|
|
56
|
-
|
|
56
|
+
pnpm run lint
|
|
57
57
|
```
|
|
58
58
|
|
|
59
59
|
### Start
|
|
60
60
|
|
|
61
61
|
```shell
|
|
62
62
|
# Start a local HTTP server
|
|
63
|
-
|
|
63
|
+
pnpm run start
|
|
64
64
|
|
|
65
65
|
# Start with Node.js Inspector enabled
|
|
66
|
-
|
|
66
|
+
pnpm run start:debug
|
|
67
67
|
```
|
|
68
68
|
|
|
69
69
|
### Deploy
|
|
@@ -100,7 +100,7 @@ TODO: add support links for the prod environment.
|
|
|
100
100
|
- Splunk logs
|
|
101
101
|
-->
|
|
102
102
|
|
|
103
|
-
[
|
|
104
|
-
[
|
|
105
|
-
[
|
|
106
|
-
[
|
|
103
|
+
[CodeDeploy]: https://docs.aws.amazon.com/codedeploy
|
|
104
|
+
[Express]: https://expressjs.com
|
|
105
|
+
[Gantry]: https://backstage.myseek.xyz/docs/default/component/gantry/
|
|
106
|
+
[Technical Guidelines]: https://myseek.atlassian.net/wiki/spaces/AA/pages/2358346017/
|
|
@@ -2,16 +2,6 @@ version: '3.7'
|
|
|
2
2
|
|
|
3
3
|
services:
|
|
4
4
|
app:
|
|
5
|
-
environment:
|
|
6
|
-
# Enable Buildkite + GitHub integrations.
|
|
7
|
-
- BUILDKITE
|
|
8
|
-
- BUILDKITE_AGENT_ACCESS_TOKEN
|
|
9
|
-
- BUILDKITE_BRANCH
|
|
10
|
-
- BUILDKITE_BUILD_NUMBER
|
|
11
|
-
- BUILDKITE_JOB_ID
|
|
12
|
-
- BUILDKITE_PIPELINE_DEFAULT_BRANCH
|
|
13
|
-
- BUILDKITE_STEP_ID
|
|
14
|
-
- GITHUB_API_TOKEN
|
|
15
5
|
image: ${BUILDKITE_PLUGIN_DOCKER_IMAGE:-''}
|
|
16
6
|
init: true
|
|
17
7
|
volumes:
|
|
@@ -17,6 +17,10 @@ env:
|
|
|
17
17
|
{{$key}}: {{$value}}
|
|
18
18
|
{{end}}
|
|
19
19
|
|
|
20
|
+
{{if .Values.cloudwatchDashboardDisabled}}
|
|
21
|
+
cloudwatchDashboardDisabled: {{values "cloudwatchDashboardDisabled"}}
|
|
22
|
+
{{end}}
|
|
23
|
+
|
|
20
24
|
{{if .Values.datadogSecretId}}
|
|
21
25
|
datadogSecretId: '{{values "datadogSecretId"}}'
|
|
22
26
|
{{end}}
|
|
@@ -118,3 +122,4 @@ tags:
|
|
|
118
122
|
{{end}}
|
|
119
123
|
|
|
120
124
|
cpuArchitecture: <%- platformName %>
|
|
125
|
+
readOnlyRootFilesystem: true
|
|
@@ -6,8 +6,7 @@ image: '{{values "image"}}'
|
|
|
6
6
|
|
|
7
7
|
buildArgs:
|
|
8
8
|
# https://github.com/seek-oss/docker-ecr-cache-buildkite-plugin#building-on-the-resulting-image
|
|
9
|
-
BASE_IMAGE: '{{.Env.BUILDKITE_PLUGIN_DOCKER_ECR_CACHE_EXPORT_IMAGE}}'
|
|
10
|
-
BASE_TAG: '{{.Env.BUILDKITE_PLUGIN_DOCKER_ECR_CACHE_EXPORT_TAG}}'
|
|
9
|
+
BASE_IMAGE: '{{.Env.BUILDKITE_PLUGIN_DOCKER_ECR_CACHE_EXPORT_IMAGE}}:{{.Env.BUILDKITE_PLUGIN_DOCKER_ECR_CACHE_EXPORT_TAG}}'
|
|
11
10
|
|
|
12
11
|
# SEEK-Jobs/gantry#1661
|
|
13
12
|
failOnScanFindings: false
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"format": "skuba format",
|
|
7
7
|
"lint": "skuba lint",
|
|
8
8
|
"start": "skuba start --port <%- port %>",
|
|
9
|
-
"start:debug": "
|
|
9
|
+
"start:debug": "pnpm run --silent start --inspect-brk",
|
|
10
10
|
"test": "skuba test",
|
|
11
11
|
"test:ci": "skuba test --coverage",
|
|
12
12
|
"test:watch": "skuba test --watch"
|
|
@@ -18,13 +18,13 @@
|
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@types/express": "^4.17.13",
|
|
21
|
-
"@types/node": "^
|
|
22
|
-
"@types/supertest": "^
|
|
21
|
+
"@types/node": "^20.9.0",
|
|
22
|
+
"@types/supertest": "^6.0.0",
|
|
23
23
|
"pino-pretty": "^10.0.0",
|
|
24
24
|
"skuba": "*",
|
|
25
25
|
"supertest": "^6.1.6"
|
|
26
26
|
},
|
|
27
27
|
"engines": {
|
|
28
|
-
"node": ">=
|
|
28
|
+
"node": ">=20"
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -4,34 +4,38 @@ agents:
|
|
|
4
4
|
configs:
|
|
5
5
|
plugins:
|
|
6
6
|
- &aws-sm
|
|
7
|
-
seek-oss/aws-sm#v2.3.
|
|
7
|
+
seek-oss/aws-sm#v2.3.2:
|
|
8
8
|
env:
|
|
9
9
|
NPM_READ_TOKEN: arn:aws:secretsmanager:ap-southeast-2:987872074697:secret:npm/npm-read-token
|
|
10
10
|
|
|
11
11
|
- &docker-ecr-cache
|
|
12
|
-
seek-oss/docker-ecr-cache#v2.1.
|
|
13
|
-
cache-on:
|
|
14
|
-
|
|
15
|
-
- yarn.lock
|
|
16
|
-
secrets: id=npm,src=.npmrc
|
|
12
|
+
seek-oss/docker-ecr-cache#v2.1.1:
|
|
13
|
+
cache-on: pnpm-lock.yaml
|
|
14
|
+
secrets: id=npm,src=tmp/.npmrc
|
|
17
15
|
|
|
18
16
|
- &private-npm
|
|
19
17
|
seek-oss/private-npm#v1.2.0:
|
|
20
18
|
env: NPM_READ_TOKEN
|
|
19
|
+
output-path: tmp/
|
|
21
20
|
|
|
22
21
|
steps:
|
|
23
22
|
- label: 🧪 Test & Lint
|
|
24
23
|
commands:
|
|
25
|
-
- echo '
|
|
26
|
-
-
|
|
27
|
-
- echo '
|
|
28
|
-
-
|
|
24
|
+
- echo '--- pnpm install --offline'
|
|
25
|
+
- pnpm install --offline
|
|
26
|
+
- echo '+++ pnpm run test:ci'
|
|
27
|
+
- pnpm run test:ci
|
|
28
|
+
- echo '--- pnpm run lint'
|
|
29
|
+
- pnpm run lint
|
|
29
30
|
env:
|
|
30
31
|
GET_GITHUB_TOKEN: please
|
|
31
32
|
plugins:
|
|
32
33
|
- *aws-sm
|
|
33
34
|
- *private-npm
|
|
34
35
|
- *docker-ecr-cache
|
|
35
|
-
- docker-compose#v4.
|
|
36
|
+
- docker-compose#v4.16.0:
|
|
36
37
|
run: app
|
|
38
|
+
environment:
|
|
39
|
+
- GITHUB_API_TOKEN
|
|
40
|
+
propagate-environment: true
|
|
37
41
|
timeout_in_minutes: 10
|
package/template/greeter/.nvmrc
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
20
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
# syntax=docker/dockerfile:1.
|
|
1
|
+
# syntax=docker/dockerfile:1.6
|
|
2
2
|
|
|
3
|
-
FROM --platform=${BUILDPLATFORM:-<%- platformName %>} node:
|
|
3
|
+
FROM --platform=${BUILDPLATFORM:-<%- platformName %>} node:20-alpine AS dev-deps
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
RUN corepack enable pnpm
|
|
6
|
+
RUN pnpm config set store-dir /root/.pnpm-store
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
WORKDIR /workdir
|
|
8
9
|
|
|
9
|
-
RUN \
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
RUN --mount=type=bind,source=pnpm-lock.yaml,target=pnpm-lock.yaml \
|
|
11
|
+
--mount=type=secret,id=npm,dst=/root/.npmrc,required=true \
|
|
12
|
+
pnpm fetch
|
|
@@ -7,7 +7,7 @@ Next steps:
|
|
|
7
7
|
1. [ ] Finish templating if this was skipped earlier:
|
|
8
8
|
|
|
9
9
|
```shell
|
|
10
|
-
|
|
10
|
+
pnpm exec skuba configure
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
2. [ ] Create a new repository in the appropriate GitHub organisation.
|
|
@@ -17,13 +17,13 @@ Next steps:
|
|
|
17
17
|
5. [ ] Configure [GitHub repository settings].
|
|
18
18
|
6. [ ] Delete this checklist 😌.
|
|
19
19
|
|
|
20
|
-
[builds at seek]: https://builds-
|
|
20
|
+
[builds at seek]: https://backstage.myseek.xyz/docs/default/component/builds-cicd-seek/
|
|
21
21
|
[github repository settings]: https://github.com/<%-orgName%>/<%-repoName%>/settings
|
|
22
22
|
|
|
23
23
|
## Design
|
|
24
24
|
|
|
25
25
|
The `greeter` template is the prototypical _hello world_ project.
|
|
26
|
-
It can function as a playground for the TypeScript tooling prescribed by our [
|
|
26
|
+
It can function as a playground for the TypeScript tooling prescribed by our [Technical Guidelines],
|
|
27
27
|
or serve as a starting point for a backend project if the other built-in templates are not a good fit.
|
|
28
28
|
|
|
29
29
|
It's a barebones Node.js application that comprises:
|
|
@@ -36,27 +36,27 @@ It's a barebones Node.js application that comprises:
|
|
|
36
36
|
### Test
|
|
37
37
|
|
|
38
38
|
```shell
|
|
39
|
-
|
|
39
|
+
pnpm run test
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
### Lint
|
|
43
43
|
|
|
44
44
|
```shell
|
|
45
45
|
# Fix issues
|
|
46
|
-
|
|
46
|
+
pnpm run format
|
|
47
47
|
|
|
48
48
|
# Check for issues
|
|
49
|
-
|
|
49
|
+
pnpm run lint
|
|
50
50
|
```
|
|
51
51
|
|
|
52
52
|
### Start
|
|
53
53
|
|
|
54
54
|
```shell
|
|
55
55
|
# Start a live-reloading process
|
|
56
|
-
|
|
56
|
+
pnpm run start
|
|
57
57
|
|
|
58
58
|
# Start with Node.js Inspector enabled
|
|
59
|
-
|
|
59
|
+
pnpm run start:debug
|
|
60
60
|
```
|
|
61
61
|
|
|
62
62
|
This runs a live-reloading Node.js process pointing to the [src/app.ts](src/app.ts) entrypoint.
|
|
@@ -93,4 +93,4 @@ TODO: add support links for the prod environment.
|
|
|
93
93
|
- Splunk logs
|
|
94
94
|
-->
|
|
95
95
|
|
|
96
|
-
[
|
|
96
|
+
[Technical Guidelines]: https://myseek.atlassian.net/wiki/spaces/AA/pages/2358346017/
|
|
@@ -2,16 +2,6 @@ version: '3.7'
|
|
|
2
2
|
|
|
3
3
|
services:
|
|
4
4
|
app:
|
|
5
|
-
environment:
|
|
6
|
-
# Enable Buildkite + GitHub integrations.
|
|
7
|
-
- BUILDKITE
|
|
8
|
-
- BUILDKITE_AGENT_ACCESS_TOKEN
|
|
9
|
-
- BUILDKITE_BRANCH
|
|
10
|
-
- BUILDKITE_BUILD_NUMBER
|
|
11
|
-
- BUILDKITE_JOB_ID
|
|
12
|
-
- BUILDKITE_PIPELINE_DEFAULT_BRANCH
|
|
13
|
-
- BUILDKITE_STEP_ID
|
|
14
|
-
- GITHUB_API_TOKEN
|
|
15
5
|
image: ${BUILDKITE_PLUGIN_DOCKER_IMAGE:-''}
|
|
16
6
|
init: true
|
|
17
7
|
volumes:
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"format": "skuba format",
|
|
7
7
|
"lint": "skuba lint",
|
|
8
8
|
"start": "skuba start",
|
|
9
|
-
"start:debug": "
|
|
9
|
+
"start:debug": "pnpm run --silent start --inspect-brk",
|
|
10
10
|
"test": "skuba test",
|
|
11
11
|
"test:ci": "skuba test --coverage",
|
|
12
12
|
"test:watch": "skuba test --watch"
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
"skuba-dive": "^2.0.0"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@types/node": "^
|
|
18
|
+
"@types/node": "^20.9.0",
|
|
19
19
|
"skuba": "*"
|
|
20
20
|
},
|
|
21
21
|
"engines": {
|
|
22
|
-
"node": ">=
|
|
22
|
+
"node": ">=20"
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -4,21 +4,20 @@ agents:
|
|
|
4
4
|
configs:
|
|
5
5
|
plugins:
|
|
6
6
|
- &aws-sm
|
|
7
|
-
seek-oss/aws-sm#v2.3.
|
|
7
|
+
seek-oss/aws-sm#v2.3.2:
|
|
8
8
|
env:
|
|
9
9
|
NPM_READ_TOKEN: arn:aws:secretsmanager:ap-southeast-2:987872074697:secret:npm/npm-read-token
|
|
10
10
|
|
|
11
11
|
- &docker-ecr-cache
|
|
12
|
-
seek-oss/docker-ecr-cache#v2.1.
|
|
13
|
-
cache-on:
|
|
14
|
-
- package.json
|
|
15
|
-
- yarn.lock
|
|
12
|
+
seek-oss/docker-ecr-cache#v2.1.1: &docker-ecr-cache-defaults
|
|
13
|
+
cache-on: pnpm-lock.yaml
|
|
16
14
|
dockerfile: Dockerfile.dev-deps
|
|
17
|
-
secrets: id=npm,src
|
|
15
|
+
secrets: id=npm,src=tmp/.npmrc
|
|
18
16
|
|
|
19
17
|
- &private-npm
|
|
20
18
|
seek-oss/private-npm#v1.2.0:
|
|
21
19
|
env: NPM_READ_TOKEN
|
|
20
|
+
output-path: tmp/
|
|
22
21
|
|
|
23
22
|
base-steps:
|
|
24
23
|
- &deploy
|
|
@@ -36,16 +35,18 @@ steps:
|
|
|
36
35
|
plugins:
|
|
37
36
|
- *aws-sm
|
|
38
37
|
- *private-npm
|
|
39
|
-
- seek-oss/docker-ecr-cache#v2.1.
|
|
38
|
+
- seek-oss/docker-ecr-cache#v2.1.1:
|
|
40
39
|
<<: *docker-ecr-cache-defaults
|
|
41
40
|
skip-pull-from-cache: true
|
|
42
41
|
|
|
43
42
|
- label: 🧪 Test & Lint
|
|
44
43
|
commands:
|
|
45
|
-
- echo '
|
|
46
|
-
-
|
|
47
|
-
- echo '
|
|
48
|
-
-
|
|
44
|
+
- echo '--- pnpm install --offline'
|
|
45
|
+
- pnpm install --offline
|
|
46
|
+
- echo '+++ pnpm run test:ci'
|
|
47
|
+
- pnpm run test:ci
|
|
48
|
+
- echo '--- pnpm run lint'
|
|
49
|
+
- pnpm run lint
|
|
49
50
|
depends_on: warm-prod
|
|
50
51
|
env:
|
|
51
52
|
GET_GITHUB_TOKEN: please
|
|
@@ -53,8 +54,11 @@ steps:
|
|
|
53
54
|
- *aws-sm
|
|
54
55
|
- *private-npm
|
|
55
56
|
- *docker-ecr-cache
|
|
56
|
-
- docker-compose#v4.
|
|
57
|
+
- docker-compose#v4.16.0:
|
|
57
58
|
run: app
|
|
59
|
+
environment:
|
|
60
|
+
- GITHUB_API_TOKEN
|
|
61
|
+
propagate-environment: true
|
|
58
62
|
timeout_in_minutes: 10
|
|
59
63
|
|
|
60
64
|
- label: 📦 Build & Package
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
20
|
|
@@ -1,29 +1,23 @@
|
|
|
1
1
|
ARG BASE_IMAGE
|
|
2
|
-
ARG BASE_TAG
|
|
3
2
|
|
|
4
3
|
###
|
|
5
4
|
|
|
6
|
-
FROM ${BASE_IMAGE}
|
|
7
|
-
|
|
8
|
-
RUN yarn install --ignore-optional --ignore-scripts --non-interactive --offline --production
|
|
9
|
-
|
|
10
|
-
###
|
|
11
|
-
|
|
12
|
-
FROM ${BASE_IMAGE}:${BASE_TAG} AS build
|
|
5
|
+
FROM ${BASE_IMAGE} AS build
|
|
13
6
|
|
|
14
7
|
COPY . .
|
|
15
8
|
|
|
16
|
-
RUN
|
|
9
|
+
RUN pnpm install --offline
|
|
10
|
+
RUN pnpm run build
|
|
11
|
+
RUN pnpm install --offline --prod
|
|
17
12
|
|
|
18
13
|
###
|
|
19
14
|
|
|
20
|
-
FROM --platform=${BUILDPLATFORM:-<%- platformName %>} gcr.io/distroless/
|
|
15
|
+
FROM --platform=${BUILDPLATFORM:-<%- platformName %>} gcr.io/distroless/nodejs20-debian12 AS runtime
|
|
21
16
|
|
|
22
17
|
WORKDIR /workdir
|
|
23
18
|
|
|
24
19
|
COPY --from=build /workdir/lib lib
|
|
25
|
-
|
|
26
|
-
COPY --from=deps /workdir/node_modules node_modules
|
|
20
|
+
COPY --from=build /workdir/node_modules node_modules
|
|
27
21
|
|
|
28
22
|
ENV NODE_ENV=production
|
|
29
23
|
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
# syntax=docker/dockerfile:1.
|
|
1
|
+
# syntax=docker/dockerfile:1.6
|
|
2
2
|
|
|
3
|
-
FROM --platform=${BUILDPLATFORM:-<%- platformName %>} node:
|
|
3
|
+
FROM --platform=${BUILDPLATFORM:-<%- platformName %>} node:20-alpine AS dev-deps
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
RUN corepack enable pnpm
|
|
6
|
+
RUN pnpm config set store-dir /root/.pnpm-store
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
WORKDIR /workdir
|
|
8
9
|
|
|
9
|
-
RUN \
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
RUN --mount=type=bind,source=pnpm-lock.yaml,target=pnpm-lock.yaml \
|
|
11
|
+
--mount=type=secret,id=npm,dst=/root/.npmrc,required=true \
|
|
12
|
+
pnpm fetch
|
|
@@ -7,7 +7,7 @@ Next steps:
|
|
|
7
7
|
1. [ ] Finish templating if this was skipped earlier:
|
|
8
8
|
|
|
9
9
|
```shell
|
|
10
|
-
|
|
10
|
+
pnpm exec skuba configure
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
2. [ ] Create a new repository in the appropriate GitHub organisation.
|
|
@@ -19,12 +19,12 @@ Next steps:
|
|
|
19
19
|
6. [ ] Configure [GitHub repository settings].
|
|
20
20
|
7. [ ] Delete this checklist 😌.
|
|
21
21
|
|
|
22
|
-
[builds at seek]: https://builds-
|
|
22
|
+
[builds at seek]: https://backstage.myseek.xyz/docs/default/component/builds-cicd-seek/
|
|
23
23
|
[github repository settings]: https://github.com/<%-orgName%>/<%-repoName%>/settings
|
|
24
24
|
|
|
25
25
|
## Design
|
|
26
26
|
|
|
27
|
-
<%-repoName %> is a Node.js HTTP server built in line with our [
|
|
27
|
+
<%-repoName %> is a Node.js HTTP server built in line with our [Technical Guidelines].
|
|
28
28
|
It uses the [Koa] middleware framework and common SEEK packages.
|
|
29
29
|
Resource APIs enable synchronous interactions and serve as the backbone of SEEK's general service architecture.
|
|
30
30
|
|
|
@@ -48,27 +48,27 @@ This defaults to an HTTP request to the `GET /smoke` endpoint.
|
|
|
48
48
|
### Test
|
|
49
49
|
|
|
50
50
|
```shell
|
|
51
|
-
|
|
51
|
+
pnpm run test
|
|
52
52
|
```
|
|
53
53
|
|
|
54
54
|
### Lint
|
|
55
55
|
|
|
56
56
|
```shell
|
|
57
57
|
# Fix issues
|
|
58
|
-
|
|
58
|
+
pnpm run format
|
|
59
59
|
|
|
60
60
|
# Check for issues
|
|
61
|
-
|
|
61
|
+
pnpm run lint
|
|
62
62
|
```
|
|
63
63
|
|
|
64
64
|
### Start
|
|
65
65
|
|
|
66
66
|
```shell
|
|
67
67
|
# Start a local HTTP server
|
|
68
|
-
|
|
68
|
+
pnpm run start
|
|
69
69
|
|
|
70
70
|
# Start with Node.js Inspector enabled
|
|
71
|
-
|
|
71
|
+
pnpm run start:debug
|
|
72
72
|
```
|
|
73
73
|
|
|
74
74
|
### Deploy
|
|
@@ -105,7 +105,7 @@ TODO: add support links for the prod environment.
|
|
|
105
105
|
- Splunk logs
|
|
106
106
|
-->
|
|
107
107
|
|
|
108
|
-
[
|
|
109
|
-
[
|
|
110
|
-
[
|
|
111
|
-
[
|
|
108
|
+
[CodeDeploy]: https://docs.aws.amazon.com/codedeploy
|
|
109
|
+
[Gantry]: https://backstage.myseek.xyz/docs/default/component/gantry/
|
|
110
|
+
[Koa]: https://koajs.com
|
|
111
|
+
[Technical Guidelines]: https://myseek.atlassian.net/wiki/spaces/AA/pages/2358346017/
|
|
@@ -2,16 +2,6 @@ version: '3.7'
|
|
|
2
2
|
|
|
3
3
|
services:
|
|
4
4
|
app:
|
|
5
|
-
environment:
|
|
6
|
-
# Enable Buildkite + GitHub integrations.
|
|
7
|
-
- BUILDKITE
|
|
8
|
-
- BUILDKITE_AGENT_ACCESS_TOKEN
|
|
9
|
-
- BUILDKITE_BRANCH
|
|
10
|
-
- BUILDKITE_BUILD_NUMBER
|
|
11
|
-
- BUILDKITE_JOB_ID
|
|
12
|
-
- BUILDKITE_PIPELINE_DEFAULT_BRANCH
|
|
13
|
-
- BUILDKITE_STEP_ID
|
|
14
|
-
- GITHUB_API_TOKEN
|
|
15
5
|
image: ${BUILDKITE_PLUGIN_DOCKER_IMAGE:-''}
|
|
16
6
|
init: true
|
|
17
7
|
volumes:
|
|
@@ -18,6 +18,10 @@ env:
|
|
|
18
18
|
{{$key}}: {{$value}}
|
|
19
19
|
{{end}}
|
|
20
20
|
|
|
21
|
+
{{if .Values.cloudwatchDashboardDisabled}}
|
|
22
|
+
cloudwatchDashboardDisabled: {{values "cloudwatchDashboardDisabled"}}
|
|
23
|
+
{{end}}
|
|
24
|
+
|
|
21
25
|
{{if .Values.datadogSecretId}}
|
|
22
26
|
datadogSecretId: '{{values "datadogSecretId"}}'
|
|
23
27
|
{{end}}
|
|
@@ -125,3 +129,4 @@ tags:
|
|
|
125
129
|
{{end}}
|
|
126
130
|
|
|
127
131
|
cpuArchitecture: <%- platformName %>
|
|
132
|
+
readOnlyRootFilesystem: true
|
|
@@ -6,8 +6,7 @@ image: '{{values "image"}}'
|
|
|
6
6
|
|
|
7
7
|
buildArgs:
|
|
8
8
|
# https://github.com/seek-oss/docker-ecr-cache-buildkite-plugin#building-on-the-resulting-image
|
|
9
|
-
BASE_IMAGE: '{{.Env.BUILDKITE_PLUGIN_DOCKER_ECR_CACHE_EXPORT_IMAGE}}'
|
|
10
|
-
BASE_TAG: '{{.Env.BUILDKITE_PLUGIN_DOCKER_ECR_CACHE_EXPORT_TAG}}'
|
|
9
|
+
BASE_IMAGE: '{{.Env.BUILDKITE_PLUGIN_DOCKER_ECR_CACHE_EXPORT_IMAGE}}:{{.Env.BUILDKITE_PLUGIN_DOCKER_ECR_CACHE_EXPORT_TAG}}'
|
|
11
10
|
|
|
12
11
|
# SEEK-Jobs/gantry#1661
|
|
13
12
|
failOnScanFindings: false
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"format": "skuba format",
|
|
7
7
|
"lint": "skuba lint",
|
|
8
8
|
"start": "skuba start --port <%- port %>",
|
|
9
|
-
"start:debug": "
|
|
9
|
+
"start:debug": "pnpm run --silent start --inspect-brk",
|
|
10
10
|
"test": "skuba test",
|
|
11
11
|
"test:ci": "skuba test --coverage",
|
|
12
12
|
"test:watch": "skuba test --watch"
|
|
@@ -14,10 +14,12 @@
|
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@koa/router": "^12.0.0",
|
|
16
16
|
"@opentelemetry/api": "^1.1.0",
|
|
17
|
-
"@opentelemetry/
|
|
18
|
-
"@opentelemetry/
|
|
19
|
-
"@opentelemetry/instrumentation-
|
|
20
|
-
"@opentelemetry/
|
|
17
|
+
"@opentelemetry/core": "^1.18.1",
|
|
18
|
+
"@opentelemetry/exporter-trace-otlp-grpc": "^0.48.0",
|
|
19
|
+
"@opentelemetry/instrumentation-aws-sdk": "^0.38.0",
|
|
20
|
+
"@opentelemetry/instrumentation-http": "^0.48.0",
|
|
21
|
+
"@opentelemetry/propagator-b3": "^1.18.1",
|
|
22
|
+
"@opentelemetry/sdk-node": "^0.48.0",
|
|
21
23
|
"@seek/logger": "^6.0.0",
|
|
22
24
|
"aws-sdk": "^2.1039.0",
|
|
23
25
|
"hot-shots": "^10.0.0",
|
|
@@ -34,14 +36,14 @@
|
|
|
34
36
|
"@types/koa": "^2.13.4",
|
|
35
37
|
"@types/koa-bodyparser": "^5.0.2",
|
|
36
38
|
"@types/koa__router": "^12.0.0",
|
|
37
|
-
"@types/node": "^
|
|
38
|
-
"@types/supertest": "^
|
|
39
|
+
"@types/node": "^20.9.0",
|
|
40
|
+
"@types/supertest": "^6.0.0",
|
|
39
41
|
"chance": "^1.1.8",
|
|
40
42
|
"pino-pretty": "^10.0.0",
|
|
41
43
|
"skuba": "*",
|
|
42
44
|
"supertest": "^6.1.6"
|
|
43
45
|
},
|
|
44
46
|
"engines": {
|
|
45
|
-
"node": ">=
|
|
47
|
+
"node": ">=20"
|
|
46
48
|
}
|
|
47
49
|
}
|
|
@@ -10,11 +10,15 @@ describe('app', () => {
|
|
|
10
10
|
|
|
11
11
|
it('has a happy health check', () => agent.get('/health').expect(200, ''));
|
|
12
12
|
|
|
13
|
-
it('has a reachable smoke test', () =>
|
|
14
|
-
agent.get('/smoke')
|
|
13
|
+
it('has a reachable smoke test', async () => {
|
|
14
|
+
const response = await agent.get('/smoke');
|
|
15
|
+
expect(response.status).not.toBe(404);
|
|
16
|
+
});
|
|
15
17
|
|
|
16
|
-
it('has a reachable nested route', () =>
|
|
17
|
-
agent.get('/jobs')
|
|
18
|
+
it('has a reachable nested route', async () => {
|
|
19
|
+
const response = await agent.get('/jobs');
|
|
20
|
+
expect(response.status).not.toBe(404);
|
|
21
|
+
});
|
|
18
22
|
|
|
19
23
|
it('has OPTIONS for a nested route', () =>
|
|
20
24
|
agent.options('/jobs').expect(200).expect('allow', /HEAD/));
|