@glash/cli 0.2.15 → 0.2.16
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/lib/version.mjs +1 -1
- package/package.json +1 -1
package/commands/deploy.mjs
CHANGED
|
@@ -178,12 +178,13 @@ export async function deploy({ flags }) {
|
|
|
178
178
|
const seen = new Set();
|
|
179
179
|
let lastStatus = '';
|
|
180
180
|
const start = Date.now();
|
|
181
|
+
const timeoutMs = deployTimeoutMs(flags);
|
|
181
182
|
let pollDelayMs = 5000;
|
|
182
183
|
let lastProgressAt = Date.now();
|
|
183
184
|
let currentPhase = 'queued';
|
|
184
185
|
const indicator = createDeployIndicator({ start, getPhase: () => currentPhase });
|
|
185
186
|
indicator.start();
|
|
186
|
-
while (Date.now() - start <
|
|
187
|
+
while (Date.now() - start < timeoutMs) {
|
|
187
188
|
let pipe;
|
|
188
189
|
try {
|
|
189
190
|
pipe = await apiGet(`/deployments/${dep.id}/pipeline`);
|
|
@@ -233,7 +234,7 @@ export async function deploy({ flags }) {
|
|
|
233
234
|
await indicator.wait(pollDelayMs);
|
|
234
235
|
}
|
|
235
236
|
indicator.stop();
|
|
236
|
-
warn(
|
|
237
|
+
warn(`Timed out after ${formatDuration(timeoutMs)} waiting for deployment. Check \`glash status ${dep.id}\`.`);
|
|
237
238
|
}
|
|
238
239
|
|
|
239
240
|
async function syncEnvBeforeDeploy(projectId, target, flags) {
|
|
@@ -312,6 +313,23 @@ function nextPollDelay(pipe) {
|
|
|
312
313
|
return 5000;
|
|
313
314
|
}
|
|
314
315
|
|
|
316
|
+
function deployTimeoutMs(flags) {
|
|
317
|
+
const raw = flags['wait-timeout'] ?? flags.timeout ?? process.env.GLASH_DEPLOY_TIMEOUT_MS;
|
|
318
|
+
if (raw !== undefined && raw !== null && raw !== '') {
|
|
319
|
+
const parsed = Number(raw);
|
|
320
|
+
if (Number.isFinite(parsed) && parsed > 0) {
|
|
321
|
+
return parsed < 1000 ? parsed * 60_000 : parsed;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
return 45 * 60_000;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
function formatDuration(ms) {
|
|
328
|
+
const seconds = Math.round(ms / 1000);
|
|
329
|
+
if (seconds < 90) return `${seconds}s`;
|
|
330
|
+
return `${Math.round(seconds / 60)}m`;
|
|
331
|
+
}
|
|
332
|
+
|
|
315
333
|
function phaseFromEvent(ev) {
|
|
316
334
|
if (ev.step === 'detect') return 'detecting';
|
|
317
335
|
if (ev.step === 'host') return 'assigning host';
|
package/lib/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.2.
|
|
1
|
+
export const VERSION = '0.2.16';
|
package/package.json
CHANGED