skuba 4.0.0 โ†’ 4.2.0-beta.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 (73) hide show
  1. package/lib/api/git/commitAllChanges.d.ts +1 -1
  2. package/lib/api/git/commitAllChanges.js +4 -1
  3. package/lib/api/git/commitAllChanges.js.map +1 -1
  4. package/lib/api/git/currentBranch.d.ts +10 -0
  5. package/lib/api/git/currentBranch.js +41 -0
  6. package/lib/api/git/currentBranch.js.map +1 -0
  7. package/lib/api/git/index.d.ts +2 -1
  8. package/lib/api/git/index.js +4 -1
  9. package/lib/api/git/index.js.map +1 -1
  10. package/lib/api/git/log.d.ts +9 -2
  11. package/lib/api/git/log.js +24 -5
  12. package/lib/api/git/log.js.map +1 -1
  13. package/lib/api/git/remote.d.ts +4 -2
  14. package/lib/api/git/remote.js +22 -5
  15. package/lib/api/git/remote.js.map +1 -1
  16. package/lib/api/github/environment.d.ts +0 -4
  17. package/lib/api/github/environment.js +3 -7
  18. package/lib/api/github/environment.js.map +1 -1
  19. package/lib/cli/adapter/eslint.js +16 -1
  20. package/lib/cli/adapter/eslint.js.map +1 -1
  21. package/lib/cli/configure/analysis/package.js +1 -1
  22. package/lib/cli/configure/analysis/package.js.map +1 -1
  23. package/lib/cli/configure/modules/package.js +1 -1
  24. package/lib/cli/configure/modules/package.js.map +1 -1
  25. package/lib/cli/configure/processing/package.d.ts +1 -0
  26. package/lib/cli/format.js +3 -2
  27. package/lib/cli/format.js.map +1 -1
  28. package/lib/cli/init/git.d.ts +0 -1
  29. package/lib/cli/init/git.js +1 -11
  30. package/lib/cli/init/git.js.map +1 -1
  31. package/lib/cli/init/index.js +7 -3
  32. package/lib/cli/init/index.js.map +1 -1
  33. package/lib/cli/lint/autofix.d.ts +2 -0
  34. package/lib/cli/lint/autofix.js +114 -0
  35. package/lib/cli/lint/autofix.js.map +1 -0
  36. package/lib/cli/lint/external.js +6 -0
  37. package/lib/cli/lint/external.js.map +1 -1
  38. package/lib/cli/node.js +5 -2
  39. package/lib/cli/node.js.map +1 -1
  40. package/lib/cli/start.js +3 -4
  41. package/lib/cli/start.js.map +1 -1
  42. package/lib/utils/env.d.ts +5 -0
  43. package/lib/utils/env.js +9 -0
  44. package/lib/utils/env.js.map +1 -0
  45. package/package.json +78 -64
  46. package/template/base/jest.config.ts +6 -0
  47. package/template/express-rest-api/.buildkite/pipeline.yml +13 -22
  48. package/template/express-rest-api/.env +1 -0
  49. package/template/express-rest-api/docker-compose.yml +3 -1
  50. package/template/express-rest-api/gantry.apply.yml +2 -0
  51. package/template/express-rest-api/gantry.build.yml +2 -1
  52. package/template/express-rest-api/package.json +2 -2
  53. package/template/greeter/.buildkite/pipeline.yml +4 -9
  54. package/template/greeter/docker-compose.yml +3 -1
  55. package/template/greeter/package.json +2 -2
  56. package/template/koa-rest-api/.buildkite/pipeline.yml +13 -22
  57. package/template/koa-rest-api/.env +1 -0
  58. package/template/koa-rest-api/docker-compose.yml +3 -1
  59. package/template/koa-rest-api/gantry.apply.yml +2 -0
  60. package/template/koa-rest-api/gantry.build.yml +2 -1
  61. package/template/koa-rest-api/package.json +3 -3
  62. package/template/lambda-sqs-worker/.buildkite/pipeline.yml +16 -22
  63. package/template/lambda-sqs-worker/.env +1 -0
  64. package/template/lambda-sqs-worker/docker-compose.yml +3 -1
  65. package/template/lambda-sqs-worker/package.json +2 -2
  66. package/template/lambda-sqs-worker/serverless.yml +6 -11
  67. package/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml +14 -20
  68. package/template/lambda-sqs-worker-cdk/cdk.json +3 -3
  69. package/template/lambda-sqs-worker-cdk/docker-compose.yml +3 -1
  70. package/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap +2 -0
  71. package/template/lambda-sqs-worker-cdk/infra/appStack.ts +1 -0
  72. package/template/lambda-sqs-worker-cdk/package.json +1 -1
  73. package/template/private-npm-package/.buildkite/pipeline.yml +3 -2
@@ -1,13 +1,7 @@
1
- configs:
2
- environments:
3
- - &dev
4
- agents:
5
- queue: <%- devBuildkiteQueueName %>
6
-
7
- - &prod
8
- agents:
9
- queue: <%- prodBuildkiteQueueName %>
1
+ agents:
2
+ queue: <%- prodBuildkiteQueueName %>
10
3
 
4
+ configs:
11
5
  plugins:
12
6
  - &aws-sm
13
7
  seek-oss/aws-sm#v2.3.1:
@@ -36,8 +30,7 @@ configs:
36
30
  permit_on_passed: true
37
31
 
38
32
  steps:
39
- - <<: *prod
40
- label: ๐Ÿง–โ€โ™€๏ธ Warm Prod
33
+ - label: ๐Ÿง–โ€โ™€๏ธ Warm Prod
41
34
  command: ':'
42
35
  key: warm-prod
43
36
  plugins:
@@ -45,8 +38,7 @@ steps:
45
38
  - *private-npm
46
39
  - *docker-ecr-cache
47
40
 
48
- - <<: *prod
49
- label: ๐Ÿงช Test & Lint
41
+ - label: ๐Ÿงช Test & Lint
50
42
  commands:
51
43
  - echo '+++ yarn test:ci'
52
44
  - yarn test:ci
@@ -62,14 +54,13 @@ steps:
62
54
  - docker-compose#v3.9.0:
63
55
  run: app
64
56
 
65
- - <<: *prod
66
- label: ๐Ÿ“ฆ Build & Package
57
+ - label: ๐Ÿ“ฆ Build & Package
67
58
  depends_on: warm-prod
68
59
  plugins:
69
60
  - *aws-sm
70
61
  - *private-npm
71
62
  - *docker-ecr-cache
72
- - seek-jobs/gantry#v1.6.1:
63
+ - seek-jobs/gantry#v1.6.2:
73
64
  command: build
74
65
  file: gantry.build.yml
75
66
  region: <%- region %>
@@ -79,13 +70,14 @@ steps:
79
70
  - block: ๐Ÿ™‹๐Ÿปโ€โ™€๏ธ Deploy Dev
80
71
  branches: '!${BUILDKITE_PIPELINE_DEFAULT_BRANCH}'
81
72
 
82
- - <<: *dev
83
- <<: *deploy
73
+ - <<: *deploy
74
+ agents:
75
+ queue: <%- devBuildkiteQueueName %>
84
76
  label: ๐Ÿคž Deploy Dev
85
77
  concurrency_group: <%- teamName %>/deploy/gantry/<%- devGantryEnvironmentName %>
86
78
  key: deploy-dev
87
79
  plugins:
88
- - seek-jobs/gantry#v1.6.1:
80
+ - seek-jobs/gantry#v1.6.2:
89
81
  command: apply
90
82
  environment: <%- devGantryEnvironmentName %>
91
83
  file: gantry.apply.yml
@@ -94,14 +86,13 @@ steps:
94
86
  - .gantry/common.yml
95
87
  - .gantry/dev.yml
96
88
 
97
- - <<: *prod
98
- <<: *deploy
89
+ - <<: *deploy
99
90
  label: ๐Ÿš€ Deploy Prod
100
91
  branches: ${BUILDKITE_PIPELINE_DEFAULT_BRANCH}
101
92
  concurrency_group: <%- teamName %>/deploy/gantry/<%- prodGantryEnvironmentName %>
102
93
  depends_on: deploy-dev
103
94
  plugins:
104
- - seek-jobs/gantry#v1.6.1:
95
+ - seek-jobs/gantry#v1.6.2:
105
96
  command: apply
106
97
  environment: <%- prodGantryEnvironmentName %>
107
98
  file: gantry.apply.yml
@@ -0,0 +1 @@
1
+ ENVIRONMENT=local
@@ -3,11 +3,13 @@ version: '3.7'
3
3
  services:
4
4
  app:
5
5
  environment:
6
- # Enable Buildkite + GitHub annotation support.
6
+ # Enable Buildkite + GitHub integrations.
7
7
  - BUILDKITE
8
8
  - BUILDKITE_AGENT_ACCESS_TOKEN
9
+ - BUILDKITE_BRANCH
9
10
  - BUILDKITE_BUILD_NUMBER
10
11
  - BUILDKITE_JOB_ID
12
+ - BUILDKITE_PIPELINE_DEFAULT_BRANCH
11
13
  - BUILDKITE_STEP_ID
12
14
  - GITHUB_API_TOKEN
13
15
  image: ${BUILDKITE_PLUGIN_DOCKER_IMAGE:-''}
@@ -115,6 +115,8 @@ cpu: 256
115
115
  memory: 512
116
116
 
117
117
  deployment:
118
+ # SEEK-Jobs/gantry#488
119
+ ignoreAlarms: true
118
120
  smokeTest:
119
121
  path: /smoke
120
122
  useExternalDns: true
@@ -9,4 +9,5 @@ buildArgs:
9
9
  BASE_IMAGE: '{{.Env.BUILDKITE_PLUGIN_DOCKER_ECR_CACHE_EXPORT_IMAGE}}'
10
10
  BASE_TAG: '{{.Env.BUILDKITE_PLUGIN_DOCKER_ECR_CACHE_EXPORT_TAG}}'
11
11
 
12
- failOnScanFindings: true
12
+ # SEEK-Jobs/gantry#1661
13
+ failOnScanFindings: false
@@ -3,7 +3,7 @@
3
3
  "@koa/router": "^10.1.1",
4
4
  "@opentelemetry/api": "^1.0.4",
5
5
  "@opentelemetry/exporter-collector-grpc": "^0.25.0",
6
- "@opentelemetry/instrumentation-aws-sdk": "^0.5.0",
6
+ "@opentelemetry/instrumentation-aws-sdk": "^0.6.0",
7
7
  "@opentelemetry/instrumentation-http": "^0.27.0",
8
8
  "@opentelemetry/sdk-node": "^0.27.0",
9
9
  "@seek/logger": "^5.0.1",
@@ -16,7 +16,7 @@
16
16
  "runtypes-filter": "^0.6.0",
17
17
  "seek-datadog-custom-metrics": "^4.0.0",
18
18
  "seek-koala": "^5.1.0",
19
- "skuba-dive": "^1.2.0",
19
+ "skuba-dive": "^2.0.0",
20
20
  "uuid": "^8.3.2"
21
21
  },
22
22
  "devDependencies": {
@@ -41,7 +41,7 @@
41
41
  "build": "skuba build",
42
42
  "format": "skuba format",
43
43
  "lint": "skuba lint",
44
- "start": "ENVIRONMENT=local skuba start --port <%- port %>",
44
+ "start": "skuba start --port <%- port %>",
45
45
  "start:debug": "yarn start --inspect-brk",
46
46
  "test": "skuba test",
47
47
  "test:ci": "skuba test --coverage",
@@ -1,20 +1,7 @@
1
- env:
2
- VERSION: ${BUILDKITE_COMMIT:0:7}.${BUILDKITE_BUILD_NUMBER}
1
+ agents:
2
+ queue: <%- prodBuildkiteQueueName %>
3
3
 
4
4
  configs:
5
- environments:
6
- - &dev
7
- agents:
8
- queue: <%- devBuildkiteQueueName %>
9
- env:
10
- ENVIRONMENT: dev
11
-
12
- - &prod
13
- agents:
14
- queue: <%- prodBuildkiteQueueName %>
15
- env:
16
- ENVIRONMENT: prod
17
-
18
5
  plugins:
19
6
  - &aws-sm
20
7
  seek-oss/aws-sm#v2.3.1:
@@ -55,9 +42,11 @@ configs:
55
42
  # Always follow up with a proper revert or fix in Git history.
56
43
  permit_on_passed: true
57
44
 
45
+ env:
46
+ VERSION: ${BUILDKITE_COMMIT:0:7}.${BUILDKITE_BUILD_NUMBER}
47
+
58
48
  steps:
59
- - <<: *prod
60
- label: ๐Ÿงช Test, Lint & Build
49
+ - label: ๐Ÿงช Test, Lint & Build
61
50
  artifact_paths: lib/**/*
62
51
  commands:
63
52
  - echo '+++ yarn test:ci'
@@ -75,7 +64,8 @@ steps:
75
64
  - docker-compose#v3.9.0:
76
65
  run: app
77
66
 
78
- - <<: *dev
67
+ - agents:
68
+ queue: <%- devBuildkiteQueueName %>
79
69
  branches: '!renovate/*'
80
70
  label: ๐Ÿง–โ€โ™€๏ธ Warm Dev
81
71
  command: ':'
@@ -88,15 +78,19 @@ steps:
88
78
  - block: ๐Ÿ™‹๐Ÿปโ€โ™€๏ธ Deploy Dev
89
79
  branches: '!${BUILDKITE_PIPELINE_DEFAULT_BRANCH}'
90
80
 
91
- - <<: *dev
92
- <<: *deploy
81
+ - <<: *deploy
82
+ agents:
83
+ queue: <%- devBuildkiteQueueName %>
84
+ env:
85
+ ENVIRONMENT: dev
93
86
  concurrency_group: <%- repoName %>/deploy/dev
94
87
  label: ๐Ÿคž Deploy Dev
95
88
 
96
89
  - wait
97
90
 
98
- - <<: *prod
99
- <<: *deploy
91
+ - <<: *deploy
92
+ env:
93
+ ENVIRONMENT: prod
100
94
  branches: ${BUILDKITE_PIPELINE_DEFAULT_BRANCH}
101
95
  concurrency_group: <%- repoName %>/deploy/prod
102
96
  label: ๐Ÿš€ Deploy Prod
@@ -0,0 +1 @@
1
+ ENVIRONMENT=local
@@ -3,11 +3,13 @@ version: '3.7'
3
3
  services:
4
4
  app:
5
5
  environment:
6
- # Enable Buildkite + GitHub annotation support.
6
+ # Enable Buildkite + GitHub integrations.
7
7
  - BUILDKITE
8
8
  - BUILDKITE_AGENT_ACCESS_TOKEN
9
+ - BUILDKITE_BRANCH
9
10
  - BUILDKITE_BUILD_NUMBER
10
11
  - BUILDKITE_JOB_ID
12
+ - BUILDKITE_PIPELINE_DEFAULT_BRANCH
11
13
  - BUILDKITE_STEP_ID
12
14
  - GITHUB_API_TOKEN
13
15
  # Tag AWS resources with the commit hash.
@@ -3,7 +3,7 @@
3
3
  "@seek/logger": "^5.0.1",
4
4
  "aws-sdk": "^2.1011.0",
5
5
  "seek-datadog-custom-metrics": "^4.0.0",
6
- "skuba-dive": "^1.2.0",
6
+ "skuba-dive": "^2.0.0",
7
7
  "runtypes": "^6.4.1",
8
8
  "runtypes-filter": "^0.6.0"
9
9
  },
@@ -29,7 +29,7 @@
29
29
  "format": "skuba format",
30
30
  "lint": "skuba lint",
31
31
  "smoke": "serverless invoke --data '{}' --function Worker",
32
- "start": "ENVIRONMENT=local skuba start --port <%- port %>",
32
+ "start": "skuba start --port <%- port %>",
33
33
  "start:debug": "yarn start --inspect-brk",
34
34
  "test": "skuba test",
35
35
  "test:ci": "skuba test --coverage",
@@ -1,7 +1,6 @@
1
1
  service: <%- serviceName %>
2
2
 
3
3
  configValidationMode: error
4
- variablesResolutionMode: 20210326
5
4
 
6
5
  params:
7
6
  default:
@@ -35,6 +34,12 @@ provider:
35
34
  # Use a shared account-level bucket for Lambda bundles and other artefacts.
36
35
  # This is easier to manage in terms of access, deployment, and tagging.
37
36
  name: ${param:deploymentBucket}
37
+ environment:
38
+ # https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/node-reusing-connections.html
39
+ AWS_NODEJS_CONNECTION_REUSE_ENABLED: 1
40
+ NODE_ENV: production
41
+ # https://nodejs.org/api/cli.html#cli_node_options_options
42
+ NODE_OPTIONS: --enable-source-maps
38
43
  iam:
39
44
  role:
40
45
  statements:
@@ -83,11 +88,6 @@ functions:
83
88
  alias: Live
84
89
  preTrafficHook: WorkerPreHook
85
90
  environment:
86
- # https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/node-reusing-connections.html
87
- AWS_NODEJS_CONNECTION_REUSE_ENABLED: 1
88
- # https://nodejs.org/api/cli.html#cli_node_options_options
89
- NODE_OPTIONS: --enable-source-maps
90
-
91
91
  ENVIRONMENT: ${env:ENVIRONMENT}
92
92
  SERVICE: ${self:service}
93
93
  VERSION: ${env:VERSION, 'local'}
@@ -104,11 +104,6 @@ functions:
104
104
  # This is generous because a timeout will hang the deployment
105
105
  timeout: 300
106
106
  environment:
107
- # https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/node-reusing-connections.html
108
- AWS_NODEJS_CONNECTION_REUSE_ENABLED: 1
109
- # https://nodejs.org/api/cli.html#cli_node_options_options
110
- NODE_OPTIONS: --enable-source-maps
111
-
112
107
  FUNCTION_NAME_TO_INVOKE: ${self:functions.Worker.name}
113
108
 
114
109
  resources:
@@ -1,17 +1,7 @@
1
- configs:
2
- environments:
3
- - &dev
4
- agents:
5
- queue: <%- devBuildkiteQueueName %>
6
- env:
7
- ENVIRONMENT: dev
8
-
9
- - &prod
10
- agents:
11
- queue: <%- prodBuildkiteQueueName %>
12
- env:
13
- ENVIRONMENT: prod
1
+ agents:
2
+ queue: <%- prodBuildkiteQueueName %>
14
3
 
4
+ configs:
15
5
  plugins:
16
6
  - &aws-sm
17
7
  seek-oss/aws-sm#v2.3.1:
@@ -52,8 +42,7 @@ configs:
52
42
  permit_on_passed: true
53
43
 
54
44
  steps:
55
- - <<: *prod
56
- label: ๐Ÿงช Test, Lint & Build
45
+ - label: ๐Ÿงช Test, Lint & Build
57
46
  artifact_paths: lib/**/*
58
47
  commands:
59
48
  - echo '+++ yarn test:ci'
@@ -71,7 +60,8 @@ steps:
71
60
  - docker-compose#v3.9.0:
72
61
  run: app
73
62
 
74
- - <<: *dev
63
+ - agents:
64
+ queue: <%- devBuildkiteQueueName %>
75
65
  branches: '!renovate/*'
76
66
  label: ๐Ÿง–โ€โ™€๏ธ Warm Dev
77
67
  command: ':'
@@ -84,14 +74,18 @@ steps:
84
74
  - block: ๐Ÿ™‹๐Ÿปโ€โ™€๏ธ Deploy Dev
85
75
  branches: '!${BUILDKITE_PIPELINE_DEFAULT_BRANCH}'
86
76
 
87
- - <<: *dev
88
- <<: *deploy
77
+ - <<: *deploy
78
+ agents:
79
+ queue: <%- devBuildkiteQueueName %>
80
+ env:
81
+ ENVIRONMENT: dev
89
82
  label: ๐Ÿคž Deploy Dev
90
83
  concurrency_group: '<%- repoName %>/deploy/dev'
91
84
  key: deploy-dev
92
85
 
93
- - <<: *prod
94
- <<: *deploy
86
+ - <<: *deploy
87
+ env:
88
+ ENVIRONMENT: prod
95
89
  label: ๐Ÿš€ Deploy Prod
96
90
  branches: ${BUILDKITE_PIPELINE_DEFAULT_BRANCH}
97
91
  concurrency_group: '<%- repoName %>/deploy/prod'
@@ -19,7 +19,7 @@
19
19
  "SOMETHING": "prod"
20
20
  }
21
21
  }
22
- },
23
- "progress": "events"
24
- }
22
+ }
23
+ },
24
+ "progress": "events"
25
25
  }
@@ -3,11 +3,13 @@ version: '3.7'
3
3
  services:
4
4
  app:
5
5
  environment:
6
- # Enable Buildkite + GitHub annotation support.
6
+ # Enable Buildkite + GitHub integrations.
7
7
  - BUILDKITE
8
8
  - BUILDKITE_AGENT_ACCESS_TOKEN
9
+ - BUILDKITE_BRANCH
9
10
  - BUILDKITE_BUILD_NUMBER
10
11
  - BUILDKITE_JOB_ID
12
+ - BUILDKITE_PIPELINE_DEFAULT_BRANCH
11
13
  - BUILDKITE_STEP_ID
12
14
  - GITHUB_API_TOKEN
13
15
  # Tag AWS resources with the commit hash.
@@ -155,6 +155,7 @@ Object {
155
155
  "Environment": Object {
156
156
  "Variables": Object {
157
157
  "AWS_NODEJS_CONNECTION_REUSE_ENABLED": "1",
158
+ "NODE_ENV": "production",
158
159
  "NODE_OPTIONS": "--enable-source-maps",
159
160
  "SOMETHING": "dev",
160
161
  },
@@ -510,6 +511,7 @@ Object {
510
511
  "Environment": Object {
511
512
  "Variables": Object {
512
513
  "AWS_NODEJS_CONNECTION_REUSE_ENABLED": "1",
514
+ "NODE_ENV": "production",
513
515
  "NODE_OPTIONS": "--enable-source-maps",
514
516
  "SOMETHING": "prod",
515
517
  },
@@ -59,6 +59,7 @@ export class AppStack extends Stack {
59
59
  environment: {
60
60
  // https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/node-reusing-connections.html
61
61
  AWS_NODEJS_CONNECTION_REUSE_ENABLED: '1',
62
+ NODE_ENV: 'production',
62
63
  // https://nodejs.org/api/cli.html#cli_node_options_options
63
64
  NODE_OPTIONS: '--enable-source-maps',
64
65
  ...context.workerLambda.environment,
@@ -15,7 +15,7 @@
15
15
  "private": true,
16
16
  "scripts": {
17
17
  "build": "skuba build",
18
- "deploy": "cdk deploy appStack --require-approval never --context stage=${ENVIRONMENT} --progress events",
18
+ "deploy": "cdk deploy appStack --require-approval never --context stage=${ENVIRONMENT}",
19
19
  "format": "skuba format",
20
20
  "lint": "skuba lint",
21
21
  "package": "yarn install --ignore-optional --ignore-scripts --modules-folder ./lib/node_modules --non-interactive --offline --production",
@@ -1,4 +1,5 @@
1
+ agents:
2
+ queue: artefacts:npm
3
+
1
4
  steps:
2
5
  - command: aws s3 cp s3://seek-npm-package-buildkite-pipeline/pipeline-latest.sh - | bash | buildkite-agent pipeline upload
3
- agents:
4
- queue: artefacts:npm