@glash/cli 0.2.25 → 0.2.27
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/commands/deploy.mjs +20 -2
- package/package.json +1 -1
package/commands/deploy.mjs
CHANGED
|
@@ -226,13 +226,16 @@ export async function deploy({ flags }) {
|
|
|
226
226
|
|
|
227
227
|
const status = pipe.deployStatus ?? pipe.buildStatus ?? '';
|
|
228
228
|
if (['ready', 'live', 'success'].includes(status)) {
|
|
229
|
-
indicator.stop();
|
|
230
229
|
const url = pipe.hostings?.[0]?.domains?.[0]?.domain;
|
|
231
230
|
if (url) {
|
|
232
|
-
|
|
231
|
+
indicator.setPhase('checking');
|
|
232
|
+
const problem = await waitForLiveUrlProblem(`https://${url.replace(/^https?:\/\//, '')}`);
|
|
233
|
+
indicator.stop();
|
|
233
234
|
if (problem) {
|
|
234
235
|
return fail(`Deployment finished, but the hostname is still not serving your app: ${problem}. Run \`glash logs ${dep.id}\` for details.`);
|
|
235
236
|
}
|
|
237
|
+
} else {
|
|
238
|
+
indicator.stop();
|
|
236
239
|
}
|
|
237
240
|
printDeploySuccess({ url, envSummary });
|
|
238
241
|
return;
|
|
@@ -398,6 +401,21 @@ async function detectLiveUrlProblem(url) {
|
|
|
398
401
|
}
|
|
399
402
|
}
|
|
400
403
|
|
|
404
|
+
async function waitForLiveUrlProblem(url, { timeoutMs = 90_000, intervalMs = 5000 } = {}) {
|
|
405
|
+
const deadline = Date.now() + timeoutMs;
|
|
406
|
+
let problem = '';
|
|
407
|
+
while (Date.now() < deadline) {
|
|
408
|
+
problem = await detectLiveUrlProblem(url);
|
|
409
|
+
if (!problem || !isTransientLiveUrlProblem(problem)) return problem;
|
|
410
|
+
await sleep(intervalMs);
|
|
411
|
+
}
|
|
412
|
+
return problem;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
function isTransientLiveUrlProblem(problem) {
|
|
416
|
+
return /no nginx route|parked page|HTTP 5\d\d|live URL check failed/i.test(problem);
|
|
417
|
+
}
|
|
418
|
+
|
|
401
419
|
function printDeploySuccess({ url, envSummary }) {
|
|
402
420
|
const liveUrl = url ? `https://${url.replace(/^https?:\/\//, '')}` : '';
|
|
403
421
|
if (liveUrl) info(`Live: ${terminalLink(liveUrl)}`);
|
package/package.json
CHANGED