@squiz/component-cli-lib 1.32.0 → 1.32.1-alpha.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.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@squiz/component-cli-lib",
|
|
3
|
-
"version": "1.32.0",
|
|
3
|
+
"version": "1.32.1-alpha.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
"author": "",
|
|
14
14
|
"license": "ISC",
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@squiz/component-lib": "1.32.0",
|
|
17
|
-
"@squiz/component-web-api-lib": "1.32.0",
|
|
18
|
-
"@squiz/dx-common-lib": "1.32.0",
|
|
19
|
-
"@squiz/dx-json-schema-lib": "1.32.0",
|
|
20
|
-
"@squiz/dx-logger-lib": "1.32.0",
|
|
21
|
-
"@squiz/virus-scanner-lib": "1.32.0",
|
|
16
|
+
"@squiz/component-lib": "1.32.1-alpha.0",
|
|
17
|
+
"@squiz/component-web-api-lib": "1.32.1-alpha.0",
|
|
18
|
+
"@squiz/dx-common-lib": "1.32.1-alpha.0",
|
|
19
|
+
"@squiz/dx-json-schema-lib": "1.32.1-alpha.0",
|
|
20
|
+
"@squiz/dx-logger-lib": "1.32.1-alpha.0",
|
|
21
|
+
"@squiz/virus-scanner-lib": "1.32.1-alpha.0",
|
|
22
22
|
"@types/cli-color": "2.0.2",
|
|
23
23
|
"@types/express": "4.17.17",
|
|
24
24
|
"@types/jest": "28.1.8",
|
|
@@ -32,12 +32,12 @@
|
|
|
32
32
|
"typescript": "4.9.4"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@squiz/render-runtime-lib": "1.32.0",
|
|
35
|
+
"@squiz/render-runtime-lib": "1.32.1-alpha.0",
|
|
36
36
|
"archiver": "5.3.1",
|
|
37
37
|
"axios": "1.3.2",
|
|
38
38
|
"cli-color": "^2.0.2",
|
|
39
39
|
"open": "^8.4.0",
|
|
40
40
|
"supertest": "^6.2.3"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "288c324fa0660ebe104919b706c998f4a6ab975a"
|
|
43
43
|
}
|
|
@@ -33,11 +33,40 @@ export async function uploadComponentFolder(
|
|
|
33
33
|
await watchAndWaitForUploadAndScanComplete(apiClient, componentServiceManagementUrl, initialUpload.id);
|
|
34
34
|
|
|
35
35
|
logger.info(`deployment id: ${initialUpload.id} status: deploying component folder`);
|
|
36
|
-
|
|
36
|
+
|
|
37
|
+
//Rarely this call will return 504, while successfully uploading the component - the cause is currently unknown
|
|
38
|
+
let result = await handleResponse<any>(
|
|
37
39
|
apiClient.post(`/v1/upload-component/next/${initialUpload.id}`, {}, { baseURL: componentServiceManagementUrl }),
|
|
38
40
|
);
|
|
39
41
|
|
|
40
|
-
|
|
42
|
+
if (result.toString().includes('504 Gateway Time-out')) {
|
|
43
|
+
let retriesAllowed = 3;
|
|
44
|
+
while (retriesAllowed > 0 && result.toString().includes('504 Gateway Time-out')) {
|
|
45
|
+
logger.info(
|
|
46
|
+
`deployment id: ${initialUpload.id} status: ${color.yellow(
|
|
47
|
+
`timed out, retrying ${retriesAllowed} more times`,
|
|
48
|
+
)}`,
|
|
49
|
+
);
|
|
50
|
+
result = await handleResponse<any>(
|
|
51
|
+
apiClient.post(
|
|
52
|
+
`/v1/upload-component/next/${initialUpload.id}`,
|
|
53
|
+
{},
|
|
54
|
+
{
|
|
55
|
+
baseURL: componentServiceManagementUrl,
|
|
56
|
+
},
|
|
57
|
+
),
|
|
58
|
+
);
|
|
59
|
+
retriesAllowed--;
|
|
60
|
+
}
|
|
61
|
+
if (retriesAllowed === 0) {
|
|
62
|
+
logger.error(`deployment id: ${initialUpload.id} status: ${color.red('failed due to timeout')}`);
|
|
63
|
+
throw new Error('504 Gateway Time-out');
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
await fsp.rm(tmpDir, { force: true, recursive: true }).catch((error: any) => {
|
|
68
|
+
logger.error('failed to remove temp directory', error);
|
|
69
|
+
});
|
|
41
70
|
|
|
42
71
|
if (result.status === 'successful') {
|
|
43
72
|
logger.info(`deployment id: ${initialUpload.id} status: ${color.green('success')}`);
|
|
@@ -45,10 +74,14 @@ export async function uploadComponentFolder(
|
|
|
45
74
|
} else {
|
|
46
75
|
const message = result?.message ?? 'unknown';
|
|
47
76
|
logger.error(`failed due an unexpected reason: ${message}`);
|
|
77
|
+
await fsp.rm(tmpDir, { force: true, recursive: true }).catch((error: any) => {
|
|
78
|
+
logger.error('failed to remove temp directory', error);
|
|
79
|
+
});
|
|
48
80
|
}
|
|
49
81
|
} catch (e) {
|
|
50
|
-
await fsp.rm(tmpDir, { force: true, recursive: true })
|
|
51
|
-
|
|
82
|
+
await fsp.rm(tmpDir, { force: true, recursive: true }).catch((error: any) => {
|
|
83
|
+
logger.error('failed to remove temp directory', error);
|
|
84
|
+
});
|
|
52
85
|
throw e;
|
|
53
86
|
}
|
|
54
87
|
}
|