@camunda8/cli 4.2.1-alpha.1 → 4.2.1-alpha.2
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.
|
@@ -28,7 +28,11 @@ import { fileURLToPath } from 'node:url';
|
|
|
28
28
|
// Version aliases – dynamic discovery with package.json fallback
|
|
29
29
|
// ---------------------------------------------------------------------------
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
// C8CTL_C8RUN_DOWNLOAD_URL overrides the download center base URL (e.g. for
|
|
32
|
+
// mirrors or tests that must not depend on network access).
|
|
33
|
+
const DOWNLOAD_BASE_URL = (
|
|
34
|
+
process.env.C8CTL_C8RUN_DOWNLOAD_URL || 'https://downloads.camunda.cloud/release/camunda/c8run/'
|
|
35
|
+
).replace(/\/*$/, '/');
|
|
32
36
|
|
|
33
37
|
const _pluginPackageJson = JSON.parse(
|
|
34
38
|
readFileSync(join(dirname(fileURLToPath(import.meta.url)), 'package.json'), 'utf-8'),
|
|
@@ -484,7 +488,7 @@ function formatLocalVersionsHint(cacheDir) {
|
|
|
484
488
|
|
|
485
489
|
function getDownloadUrl(version) {
|
|
486
490
|
const platformInfo = getPlatformIdentifier();
|
|
487
|
-
return
|
|
491
|
+
return `${DOWNLOAD_BASE_URL}${version}/camunda8-run-${version}-${platformInfo.platform}-${platformInfo.arch}.${platformInfo.extension}`;
|
|
488
492
|
}
|
|
489
493
|
|
|
490
494
|
async function downloadC8Run(config) {
|
|
@@ -508,7 +512,8 @@ async function downloadC8Run(config) {
|
|
|
508
512
|
throw new Error(
|
|
509
513
|
`Cannot reach the Camunda Download Center.\n` +
|
|
510
514
|
`URL: ${downloadUrl}\n` +
|
|
511
|
-
`Error: ${error.message}\n
|
|
515
|
+
`Error: ${error.message}\n` +
|
|
516
|
+
`Please check your network connection and proxy settings, then try again.\n\n` +
|
|
512
517
|
formatLocalVersionsHint(cacheDir),
|
|
513
518
|
);
|
|
514
519
|
});
|
|
@@ -1169,7 +1174,10 @@ export function processStartSignature(pid) {
|
|
|
1169
1174
|
`$p = Get-CimInstance Win32_Process -Filter "ProcessId=${pid}"; ` +
|
|
1170
1175
|
`if ($p) { $p.CreationDate.ToString('o') }`,
|
|
1171
1176
|
],
|
|
1172
|
-
|
|
1177
|
+
// PowerShell start-up plus a CIM query can exceed 5 s on a loaded
|
|
1178
|
+
// machine; a timeout yields no signature, which makes a live orphan
|
|
1179
|
+
// look stopped, so allow a generous budget.
|
|
1180
|
+
{ encoding: 'utf-8', timeout: 10000 },
|
|
1173
1181
|
).trim();
|
|
1174
1182
|
return out ? `win:${out}` : null;
|
|
1175
1183
|
}
|
|
@@ -1556,6 +1564,18 @@ export function hasRunningClusterPidfiles(cacheDir) {
|
|
|
1556
1564
|
return liveRecordedPids(cacheDir).length > 0;
|
|
1557
1565
|
}
|
|
1558
1566
|
|
|
1567
|
+
// `c8run stop` only signals the cluster processes; Java can keep running for a
|
|
1568
|
+
// while as it shuts down. Wait for them to exit so a follow-up purge does not
|
|
1569
|
+
// mistake a shutting-down cluster for a live one. The timeout is a safety net.
|
|
1570
|
+
export async function waitForClusterExit(cacheDir, { timeoutMs = 60_000, intervalMs = 250 } = {}) {
|
|
1571
|
+
const deadline = Date.now() + timeoutMs;
|
|
1572
|
+
while (hasRunningClusterPidfiles(cacheDir)) {
|
|
1573
|
+
if (Date.now() >= deadline) return false;
|
|
1574
|
+
await sleep(intervalMs);
|
|
1575
|
+
}
|
|
1576
|
+
return true;
|
|
1577
|
+
}
|
|
1578
|
+
|
|
1559
1579
|
export async function stopC8Run(config, debug = false) {
|
|
1560
1580
|
const logger = getLogger();
|
|
1561
1581
|
const markerFile = join(config.cacheDir, ACTIVE_MARKER_FILE);
|
|
@@ -2797,6 +2817,15 @@ export const commands = {
|
|
|
2797
2817
|
`Version ${stoppedVersion} is no longer installed; its runtime data is already gone. Nothing to purge.`,
|
|
2798
2818
|
);
|
|
2799
2819
|
} else {
|
|
2820
|
+
// C8CTL_STOP_WAIT_TIMEOUT_MS is an internal override so tests can bound the wait.
|
|
2821
|
+
const override = Number(process.env.C8CTL_STOP_WAIT_TIMEOUT_MS);
|
|
2822
|
+
const timeoutMs = Number.isFinite(override) && override > 0 ? override : undefined;
|
|
2823
|
+
if (!(await waitForClusterExit(theCacheDir, { timeoutMs }))) {
|
|
2824
|
+
throw new Error(
|
|
2825
|
+
'Cluster processes are still shutting down, so runtime data was not purged. ' +
|
|
2826
|
+
`Once they have exited, run: c8ctl cluster purge ${stoppedVersion}`,
|
|
2827
|
+
);
|
|
2828
|
+
}
|
|
2800
2829
|
await purgeClusterData(theCacheDir, stoppedVersion);
|
|
2801
2830
|
}
|
|
2802
2831
|
}
|