@fishawack/lab-env 5.0.3 → 5.0.4
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/CHANGELOG.md +16 -0
- package/_Test/hub.js +64 -7
- package/hub.js +20 -10
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
## Changelog
|
|
2
2
|
|
|
3
|
+
### 5.0.4 (2025-10-31)
|
|
4
|
+
|
|
5
|
+
#### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* configure axios to not keep alive to avoid econnreset errors ([9b56a83](https://bitbucket.org/fishawackdigital/lab-env/commits/9b56a83398675aebce47775a62cb62e36b89f693))
|
|
8
|
+
* hub now throws error so tests and other things can exit gracefully ([2832cd8](https://bitbucket.org/fishawackdigital/lab-env/commits/2832cd83dd8ee2622bc38a66f75833c794ce5c24))
|
|
9
|
+
* remove length size default from axios ([b9db763](https://bitbucket.org/fishawackdigital/lab-env/commits/b9db763405bc7fd0dea3ba620795942a076b2c88))
|
|
10
|
+
|
|
11
|
+
### 5.0.4-beta.1 (2025-10-31)
|
|
12
|
+
|
|
13
|
+
#### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* configure axios to not keep alive to avoid econnreset errors ([9b56a83](https://bitbucket.org/fishawackdigital/lab-env/commits/9b56a83398675aebce47775a62cb62e36b89f693))
|
|
16
|
+
* hub now throws error so tests and other things can exit gracefully ([2832cd8](https://bitbucket.org/fishawackdigital/lab-env/commits/2832cd83dd8ee2622bc38a66f75833c794ce5c24))
|
|
17
|
+
* remove length size default from axios ([b9db763](https://bitbucket.org/fishawackdigital/lab-env/commits/b9db763405bc7fd0dea3ba620795942a076b2c88))
|
|
18
|
+
|
|
3
19
|
### 5.0.3 (2025-10-30)
|
|
4
20
|
|
|
5
21
|
#### Bug Fixes
|
package/_Test/hub.js
CHANGED
|
@@ -28,12 +28,16 @@ try {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
describe("hub", () => {
|
|
31
|
+
let repository;
|
|
32
|
+
|
|
33
|
+
before(async () => {
|
|
34
|
+
repository = await hub.findRepository(remote);
|
|
35
|
+
});
|
|
36
|
+
|
|
31
37
|
describe("deployment", () => {
|
|
32
38
|
let deployment;
|
|
33
39
|
|
|
34
40
|
it("Should create a deployment model", async () => {
|
|
35
|
-
const repository = await hub.findRepository(remote);
|
|
36
|
-
|
|
37
41
|
deployment = await hub.startedDeployment(repository.id, branch);
|
|
38
42
|
|
|
39
43
|
expect(deployment.status).to.equal("started");
|
|
@@ -57,23 +61,76 @@ describe("hub", () => {
|
|
|
57
61
|
});
|
|
58
62
|
|
|
59
63
|
describe("artifacts", () => {
|
|
60
|
-
|
|
64
|
+
const fs = require("fs");
|
|
65
|
+
const archiver = require("archiver");
|
|
61
66
|
|
|
62
|
-
|
|
63
|
-
|
|
67
|
+
let artifacts = [];
|
|
68
|
+
let largeZipPath;
|
|
69
|
+
|
|
70
|
+
before(async () => {
|
|
71
|
+
// Generate a large zip file (800MB)
|
|
72
|
+
largeZipPath = path.join(
|
|
73
|
+
__dirname,
|
|
74
|
+
"_fixtures/generated-large.zip",
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
await new Promise((resolve, reject) => {
|
|
78
|
+
const output = fs.createWriteStream(largeZipPath);
|
|
79
|
+
const archive = archiver("zip", { zlib: { level: 0 } }); // No compression for speed
|
|
80
|
+
|
|
81
|
+
output.on("close", resolve);
|
|
82
|
+
archive.on("error", reject);
|
|
83
|
+
|
|
84
|
+
archive.pipe(output);
|
|
85
|
+
|
|
86
|
+
// Generate ~800MB of data by creating multiple large buffers
|
|
87
|
+
const chunkSize = 100 * 1024 * 1024; // 100MB chunks
|
|
88
|
+
const numChunks = 4; // 4 chunks = ~400MB
|
|
64
89
|
|
|
65
|
-
|
|
90
|
+
for (let i = 0; i < numChunks; i++) {
|
|
91
|
+
const buffer = Buffer.alloc(chunkSize, "A");
|
|
92
|
+
archive.append(buffer, { name: `dummy-${i}.txt` });
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
archive.finalize();
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it("Should create a artifact model", async () => {
|
|
100
|
+
let artifact = await hub.storeArtifact(
|
|
66
101
|
repository.id,
|
|
67
102
|
branch,
|
|
68
103
|
"pdf",
|
|
69
104
|
path.join(__dirname, "_fixtures/dummy.pdf"),
|
|
70
105
|
);
|
|
71
106
|
|
|
107
|
+
artifacts.push(artifact);
|
|
108
|
+
|
|
109
|
+
expect(artifact.file_path).to.not.be.empty;
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
it("Should be able to transfer huge artifacts", async () => {
|
|
113
|
+
let artifact = await hub.storeArtifact(
|
|
114
|
+
repository.id,
|
|
115
|
+
branch,
|
|
116
|
+
"build",
|
|
117
|
+
largeZipPath,
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
artifacts.push(artifact);
|
|
121
|
+
|
|
72
122
|
expect(artifact.file_path).to.not.be.empty;
|
|
73
123
|
});
|
|
74
124
|
|
|
75
125
|
after(() => {
|
|
76
|
-
|
|
126
|
+
artifacts.forEach((artifact) => {
|
|
127
|
+
hub.purgeArtifact(artifact.id);
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
// Clean up generated zip file
|
|
131
|
+
if (largeZipPath && fs.existsSync(largeZipPath)) {
|
|
132
|
+
fs.unlinkSync(largeZipPath);
|
|
133
|
+
}
|
|
77
134
|
});
|
|
78
135
|
});
|
|
79
136
|
|
package/hub.js
CHANGED
|
@@ -4,10 +4,20 @@ require("dotenv").config({
|
|
|
4
4
|
override: true,
|
|
5
5
|
});
|
|
6
6
|
|
|
7
|
-
const axios = require("axios");
|
|
8
|
-
const FormData = require("form-data");
|
|
9
7
|
const fs = require("fs");
|
|
10
8
|
|
|
9
|
+
const http = require("http");
|
|
10
|
+
const https = require("https");
|
|
11
|
+
const FormData = require("form-data");
|
|
12
|
+
|
|
13
|
+
// Create axios instance with fresh connections (no keep-alive)
|
|
14
|
+
const axios = require("axios").create({
|
|
15
|
+
httpAgent: new http.Agent({ keepAlive: false }),
|
|
16
|
+
httpsAgent: new https.Agent({ keepAlive: false }),
|
|
17
|
+
maxContentLength: Infinity,
|
|
18
|
+
maxBodyLength: Infinity,
|
|
19
|
+
});
|
|
20
|
+
|
|
11
21
|
const baseUrl = process.env.HUB_URL;
|
|
12
22
|
const headers = {
|
|
13
23
|
headers: {
|
|
@@ -33,7 +43,7 @@ module.exports = {
|
|
|
33
43
|
console.log(
|
|
34
44
|
`Deployment Hub: Error logging deployment start in hub: ${e.message}`,
|
|
35
45
|
);
|
|
36
|
-
|
|
46
|
+
throw e;
|
|
37
47
|
}
|
|
38
48
|
},
|
|
39
49
|
async finishedDeployment(deploymentId) {
|
|
@@ -51,7 +61,7 @@ module.exports = {
|
|
|
51
61
|
console.log(
|
|
52
62
|
`Deployment Hub: Error logging deployment finish in hub: ${e.message}`,
|
|
53
63
|
);
|
|
54
|
-
|
|
64
|
+
throw e;
|
|
55
65
|
}
|
|
56
66
|
},
|
|
57
67
|
async failedDeployment(deploymentId) {
|
|
@@ -69,7 +79,7 @@ module.exports = {
|
|
|
69
79
|
console.log(
|
|
70
80
|
`Error logging deployment failure in hub: ${e.message}`,
|
|
71
81
|
);
|
|
72
|
-
|
|
82
|
+
throw e;
|
|
73
83
|
}
|
|
74
84
|
},
|
|
75
85
|
async purgeDeployment(deploymentId) {
|
|
@@ -80,7 +90,7 @@ module.exports = {
|
|
|
80
90
|
);
|
|
81
91
|
} catch (e) {
|
|
82
92
|
console.log(e.message);
|
|
83
|
-
|
|
93
|
+
throw e;
|
|
84
94
|
}
|
|
85
95
|
},
|
|
86
96
|
async storeArtifact(repositoryId, branch, type, file) {
|
|
@@ -107,7 +117,7 @@ module.exports = {
|
|
|
107
117
|
console.log(
|
|
108
118
|
`Deployment Hub: Error storing artifact in hub: ${e.message}`,
|
|
109
119
|
);
|
|
110
|
-
|
|
120
|
+
throw e;
|
|
111
121
|
}
|
|
112
122
|
},
|
|
113
123
|
async purgeArtifact(artifactId) {
|
|
@@ -118,7 +128,7 @@ module.exports = {
|
|
|
118
128
|
);
|
|
119
129
|
} catch (e) {
|
|
120
130
|
console.log(e.message);
|
|
121
|
-
|
|
131
|
+
throw e;
|
|
122
132
|
}
|
|
123
133
|
},
|
|
124
134
|
async getConfigurations(repositoryId) {
|
|
@@ -135,7 +145,7 @@ module.exports = {
|
|
|
135
145
|
).data.data;
|
|
136
146
|
} catch (e) {
|
|
137
147
|
console.log(e.message);
|
|
138
|
-
|
|
148
|
+
throw e;
|
|
139
149
|
}
|
|
140
150
|
},
|
|
141
151
|
async findRepository(remoteUrl) {
|
|
@@ -153,7 +163,7 @@ module.exports = {
|
|
|
153
163
|
console.log(
|
|
154
164
|
`Deployment Hub: Error finding repository: ${e.message}`,
|
|
155
165
|
);
|
|
156
|
-
|
|
166
|
+
throw e;
|
|
157
167
|
}
|
|
158
168
|
},
|
|
159
169
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fishawack/lab-env",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.4",
|
|
4
4
|
"description": "Docker manager for FW",
|
|
5
5
|
"main": "cli.js",
|
|
6
6
|
"scripts": {
|
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"yargs": "16.2.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
+
"archiver": "^7.0.1",
|
|
48
49
|
"chai": "4.3.4",
|
|
49
50
|
"mocha": "^9.2.2",
|
|
50
51
|
"node-fetch": "^3.2.10"
|