@naturalcycles/backend-lib 4.19.2 → 4.20.1
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/dist/deploy/deployGae.js
CHANGED
|
@@ -22,16 +22,22 @@ async function deployGae(opt = {}) {
|
|
|
22
22
|
gaeService,
|
|
23
23
|
gaeVersion,
|
|
24
24
|
});
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
catch (err) {
|
|
30
|
-
if (logOnFailure) {
|
|
31
|
-
logs(gaeProject, gaeService, gaeVersion);
|
|
25
|
+
await (0, js_lib_1.pRetry)(async () => {
|
|
26
|
+
try {
|
|
27
|
+
(0, nodejs_lib_1.execVoidCommandSync)(`gcloud app deploy ${appYamlPath} --project ${gaeProject} --version ${gaeVersion} --quiet --no-promote`, [], { shell: true });
|
|
32
28
|
}
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
catch (err) {
|
|
30
|
+
if (logOnFailure) {
|
|
31
|
+
logs(gaeProject, gaeService, gaeVersion);
|
|
32
|
+
}
|
|
33
|
+
throw err;
|
|
34
|
+
}
|
|
35
|
+
}, {
|
|
36
|
+
name: 'deploy',
|
|
37
|
+
maxAttempts: 2,
|
|
38
|
+
delay: 30000,
|
|
39
|
+
predicate: err => (0, js_lib_1._anyToError)(err).message.includes('operation is already in progress'),
|
|
40
|
+
});
|
|
35
41
|
// Health check (versionUrl)
|
|
36
42
|
// yarn deploy-health-check --url $deployInfo_versionUrl --repeat 3 --timeoutSec 180 --intervalSec 2
|
|
37
43
|
await (0, deployHealthCheck_1.deployHealthCheck)(versionUrl, opt);
|
|
@@ -52,7 +52,7 @@ const serverStatsHTMLHandler = (req, res) => {
|
|
|
52
52
|
`<td align="right"><pre>${all5xx}</pre></td>`,
|
|
53
53
|
...percentiles.map(pc => `<td align="right"><pre>${Math.round((0, js_lib_1._percentile)(allLatencies, pc))}</pre></td>`),
|
|
54
54
|
`</tr>`,
|
|
55
|
-
...(0, js_lib_1._sortBy)((0, js_lib_1._stringMapEntries)(serverStatsMap), ([_, stat]) => (0, js_lib_1._get)(stat, sortBy), false,
|
|
55
|
+
...(0, js_lib_1._sortBy)((0, js_lib_1._stringMapEntries)(serverStatsMap), ([_, stat]) => (0, js_lib_1._get)(stat, sortBy), false, asc ? 'asc' : 'desc').map(([endpoint, stat]) => {
|
|
56
56
|
return [
|
|
57
57
|
'<tr>',
|
|
58
58
|
`<td><pre>${endpoint}</pre></td>`,
|
package/package.json
CHANGED
package/src/deploy/deployGae.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { buildProdCommand } from '@naturalcycles/dev-lib'
|
|
2
|
-
import { _objectAssign } from '@naturalcycles/js-lib'
|
|
2
|
+
import { _anyToError, _objectAssign, pRetry } from '@naturalcycles/js-lib'
|
|
3
3
|
import { execVoidCommandSync } from '@naturalcycles/nodejs-lib'
|
|
4
4
|
import { deployHealthCheck, DeployHealthCheckOptions } from './deployHealthCheck'
|
|
5
5
|
import { deployPrepare, DeployPrepareOptions } from './deployPrepare'
|
|
@@ -29,20 +29,28 @@ export async function deployGae(opt: DeployGaeOptions = {}): Promise<void> {
|
|
|
29
29
|
gaeVersion,
|
|
30
30
|
})
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
32
|
+
await pRetry(
|
|
33
|
+
async () => {
|
|
34
|
+
try {
|
|
35
|
+
execVoidCommandSync(
|
|
36
|
+
`gcloud app deploy ${appYamlPath} --project ${gaeProject} --version ${gaeVersion} --quiet --no-promote`,
|
|
37
|
+
[],
|
|
38
|
+
{ shell: true },
|
|
39
|
+
)
|
|
40
|
+
} catch (err) {
|
|
41
|
+
if (logOnFailure) {
|
|
42
|
+
logs(gaeProject, gaeService, gaeVersion)
|
|
43
|
+
}
|
|
44
|
+
throw err
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: 'deploy',
|
|
49
|
+
maxAttempts: 2,
|
|
50
|
+
delay: 30_000,
|
|
51
|
+
predicate: err => _anyToError(err).message.includes('operation is already in progress'),
|
|
52
|
+
},
|
|
53
|
+
)
|
|
46
54
|
|
|
47
55
|
// Health check (versionUrl)
|
|
48
56
|
// yarn deploy-health-check --url $deployInfo_versionUrl --repeat 3 --timeoutSec 180 --intervalSec 2
|