@naturalcycles/backend-lib 4.20.2 → 4.21.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.
@@ -7,7 +7,7 @@ const js_lib_1 = require("@naturalcycles/js-lib");
7
7
  const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
8
8
  const js_yaml_1 = tslib_1.__importDefault(require("js-yaml"));
9
9
  const APP_YAML_DEFAULT = () => ({
10
- runtime: 'nodejs18',
10
+ runtime: 'nodejs20',
11
11
  service: 'default',
12
12
  inbound_services: ['warmup'],
13
13
  instance_class: 'F1',
@@ -9,10 +9,8 @@ const deployPrepare_1 = require("./deployPrepare");
9
9
  async function deployGae(opt = {}) {
10
10
  const { logOnFailure, logOnSuccess } = opt;
11
11
  // 1. build-prod
12
- // await execCommand(`yarn`, [`build-prod`])
13
12
  (0, dev_lib_1.buildProdCommand)();
14
13
  // 2. deploy-prepare
15
- // await execCommand(`yarn`, ['deploy-prepare'])
16
14
  const deployInfo = await (0, deployPrepare_1.deployPrepare)();
17
15
  const targetDir = './tmp/deploy';
18
16
  const appYamlPath = `${targetDir}/app.yaml`;
@@ -22,6 +20,7 @@ async function deployGae(opt = {}) {
22
20
  gaeService,
23
21
  gaeVersion,
24
22
  });
23
+ (0, nodejs_lib_1.appendToGithubSummary)(`[versionUrl](${versionUrl})`);
25
24
  await (0, js_lib_1.pRetry)(async () => {
26
25
  try {
27
26
  (0, nodejs_lib_1.execVoidCommandSync)(`gcloud app deploy ${appYamlPath} --project ${gaeProject} --version ${gaeVersion} --quiet --no-promote`, [], { shell: true });
@@ -36,6 +35,8 @@ async function deployGae(opt = {}) {
36
35
  name: 'deploy',
37
36
  maxAttempts: 2,
38
37
  delay: 30000,
38
+ // todo: this doesn't work, as the error is different from what is logged.
39
+ // We shoud somehow capture the logged text
39
40
  predicate: err => (0, js_lib_1._anyToError)(err).message.includes('operation is already in progress'),
40
41
  });
41
42
  // Health check (versionUrl)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturalcycles/backend-lib",
3
- "version": "4.20.2",
3
+ "version": "4.21.0",
4
4
  "scripts": {
5
5
  "prepare": "husky install",
6
6
  "serve": "APP_ENV=dev nodemon",
@@ -6,7 +6,7 @@ import { BackendCfg } from './backend.cfg.util'
6
6
  import { AppYaml, DeployInfo } from './deploy.model'
7
7
 
8
8
  const APP_YAML_DEFAULT = (): AppYaml => ({
9
- runtime: 'nodejs18',
9
+ runtime: 'nodejs20',
10
10
  service: 'default',
11
11
  inbound_services: ['warmup'],
12
12
  instance_class: 'F1',
@@ -1,6 +1,6 @@
1
1
  import { buildProdCommand } from '@naturalcycles/dev-lib'
2
2
  import { _anyToError, _objectAssign, pRetry } from '@naturalcycles/js-lib'
3
- import { execVoidCommandSync } from '@naturalcycles/nodejs-lib'
3
+ import { appendToGithubSummary, execVoidCommandSync } from '@naturalcycles/nodejs-lib'
4
4
  import { deployHealthCheck, DeployHealthCheckOptions } from './deployHealthCheck'
5
5
  import { deployPrepare, DeployPrepareOptions } from './deployPrepare'
6
6
 
@@ -11,12 +11,10 @@ export async function deployGae(opt: DeployGaeOptions = {}): Promise<void> {
11
11
 
12
12
  // 1. build-prod
13
13
 
14
- // await execCommand(`yarn`, [`build-prod`])
15
14
  buildProdCommand()
16
15
 
17
16
  // 2. deploy-prepare
18
17
 
19
- // await execCommand(`yarn`, ['deploy-prepare'])
20
18
  const deployInfo = await deployPrepare()
21
19
 
22
20
  const targetDir = './tmp/deploy'
@@ -29,6 +27,8 @@ export async function deployGae(opt: DeployGaeOptions = {}): Promise<void> {
29
27
  gaeVersion,
30
28
  })
31
29
 
30
+ appendToGithubSummary(`[versionUrl](${versionUrl})`)
31
+
32
32
  await pRetry(
33
33
  async () => {
34
34
  try {
@@ -48,6 +48,8 @@ export async function deployGae(opt: DeployGaeOptions = {}): Promise<void> {
48
48
  name: 'deploy',
49
49
  maxAttempts: 2,
50
50
  delay: 30_000,
51
+ // todo: this doesn't work, as the error is different from what is logged.
52
+ // We shoud somehow capture the logged text
51
53
  predicate: err => _anyToError(err).message.includes('operation is already in progress'),
52
54
  },
53
55
  )