underpost 3.2.21 → 3.2.22
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 +38 -1
- package/CLI-HELP.md +3 -1
- package/README.md +2 -2
- package/bin/build.js +12 -1
- package/manifests/cronjobs/dd-cron/dd-cron-backup.yaml +1 -1
- package/manifests/cronjobs/dd-cron/dd-cron-dns.yaml +1 -1
- package/manifests/deployment/dd-default-development/deployment.yaml +2 -2
- package/package.json +1 -1
- package/scripts/test-monitor.sh +242 -78
- package/src/cli/deploy.js +5 -8
- package/src/cli/index.js +8 -0
- package/src/cli/monitor.js +114 -29
- package/src/cli/repository.js +3 -0
- package/src/cli/run.js +22 -4
- package/src/client/components/core/PanelForm.js +44 -44
- package/src/index.js +1 -1
- package/src/server/conf.js +58 -9
- package/src/server/ipfs-client.js +5 -3
- package/src/server/start.js +17 -5
- package/test/deploy-monitor.test.js +33 -5
|
@@ -108,6 +108,10 @@ if [[ "$verb" == "port-forward" ]]; then
|
|
|
108
108
|
sleep 30
|
|
109
109
|
exit 0
|
|
110
110
|
fi
|
|
111
|
+
if [[ "$verb" == "exec" ]]; then
|
|
112
|
+
grep -E '^container-status=' "$UNDERPOST_ENV_FILE" 2>/dev/null | tail -n1 | sed -E 's/^container-status=//'
|
|
113
|
+
exit 0
|
|
114
|
+
fi
|
|
111
115
|
exit 0
|
|
112
116
|
`,
|
|
113
117
|
);
|
|
@@ -118,10 +122,13 @@ exit 0
|
|
|
118
122
|
fs.writeFileSync(
|
|
119
123
|
monitorScriptPath,
|
|
120
124
|
`import Underpost from ${JSON.stringify(pathToFileURL(path.join(repoRoot, 'src/index.js')).href)};
|
|
125
|
+
const options = {};
|
|
126
|
+
if (process.env.MON_READY_GATE) options.readyGate = process.env.MON_READY_GATE;
|
|
127
|
+
if (process.env.MON_TRANSPORT) options.statusTransport = process.env.MON_TRANSPORT;
|
|
121
128
|
try {
|
|
122
129
|
await Underpost.monitor.monitorReadyRunner(${JSON.stringify(DEPLOY_ID)}, ${JSON.stringify(ENV)}, ${JSON.stringify(
|
|
123
130
|
TRAFFIC,
|
|
124
|
-
)}, [], 'default');
|
|
131
|
+
)}, [], 'default', options);
|
|
125
132
|
process.exit(0);
|
|
126
133
|
} catch (_) {
|
|
127
134
|
process.exit(1);
|
|
@@ -174,12 +181,18 @@ try {
|
|
|
174
181
|
});
|
|
175
182
|
});
|
|
176
183
|
|
|
177
|
-
it('success: both phases satisfied → monitor exits 0', async () => {
|
|
184
|
+
it('success (default exec transport): both phases satisfied → monitor exits 0', async () => {
|
|
178
185
|
Underpost.env.set('container-status', RUNNING_STATUS);
|
|
179
186
|
const code = await spawnMonitor({ FAKE_POD_READY: 'True' });
|
|
180
187
|
expect(code).to.equal(0);
|
|
181
188
|
});
|
|
182
189
|
|
|
190
|
+
it('success (opt-in http transport): both phases satisfied → monitor exits 0', async () => {
|
|
191
|
+
Underpost.env.set('container-status', RUNNING_STATUS);
|
|
192
|
+
const code = await spawnMonitor({ FAKE_POD_READY: 'True', MON_TRANSPORT: 'http' });
|
|
193
|
+
expect(code).to.equal(0);
|
|
194
|
+
});
|
|
195
|
+
|
|
183
196
|
it('runtime failure: container-status=error → monitor exits 1', async () => {
|
|
184
197
|
const monitorExit = spawnMonitor({ FAKE_POD_READY: 'True' });
|
|
185
198
|
Underpost.env.set('container-status', 'error');
|
|
@@ -193,11 +206,12 @@ try {
|
|
|
193
206
|
expect(code).to.equal(1);
|
|
194
207
|
});
|
|
195
208
|
|
|
196
|
-
it('transport failure: endpoint unreachable is never success (exits 1)', async () => {
|
|
197
|
-
//
|
|
198
|
-
// fails, so runtime readiness is never confirmed
|
|
209
|
+
it('transport failure (http): endpoint unreachable is never success (exits 1)', async () => {
|
|
210
|
+
// Opt into http and point the monitor at a port with no internal server; the
|
|
211
|
+
// HTTP read always fails, so runtime readiness is never confirmed → timeout.
|
|
199
212
|
Underpost.env.set('container-status', RUNNING_STATUS);
|
|
200
213
|
const code = await spawnMonitor({
|
|
214
|
+
MON_TRANSPORT: 'http',
|
|
201
215
|
UNDERPOST_INTERNAL_PORT: String(CLOSED_PORT),
|
|
202
216
|
UNDERPOST_PF_LOCAL_PORT: String(CLOSED_PORT),
|
|
203
217
|
UNDERPOST_MONITOR_MAX_ITERATIONS: '3',
|
|
@@ -220,4 +234,18 @@ try {
|
|
|
220
234
|
Underpost.env.set('container-status', BUILD_STATUS);
|
|
221
235
|
expect(await monitorExit).to.equal(1);
|
|
222
236
|
});
|
|
237
|
+
|
|
238
|
+
// Custom instances (cyberia-*) gate on K8s Ready and read status via exec;
|
|
239
|
+
// their runtime never stamps `running-deployment` (stays `initializing`).
|
|
240
|
+
it('instance (kubernetes gate + exec): K8s Ready with initializing status → exits 0', async () => {
|
|
241
|
+
Underpost.env.set('container-status', INIT_STATUS);
|
|
242
|
+
const code = await spawnMonitor({ FAKE_POD_READY: 'True', MON_READY_GATE: 'kubernetes', MON_TRANSPORT: 'exec' });
|
|
243
|
+
expect(code).to.equal(0);
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
it('instance (kubernetes gate + exec): container-status=error → exits 1', async () => {
|
|
247
|
+
const monitorExit = spawnMonitor({ FAKE_POD_READY: 'True', MON_READY_GATE: 'kubernetes', MON_TRANSPORT: 'exec' });
|
|
248
|
+
Underpost.env.set('container-status', 'error');
|
|
249
|
+
expect(await monitorExit).to.equal(1);
|
|
250
|
+
});
|
|
223
251
|
});
|