@camunda8/cli 4.3.0-alpha.2 → 4.3.0-alpha.3
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/README.md
CHANGED
|
@@ -70,6 +70,9 @@ c8ctl cluster start
|
|
|
70
70
|
# Store a secret for local development (values are never shown or stored by c8ctl)
|
|
71
71
|
c8ctl cluster secrets set OPENAI_API_KEY
|
|
72
72
|
|
|
73
|
+
# Manage isolated local physical tenants (requires a supporting c8run 8.10+ build)
|
|
74
|
+
c8ctl cluster tenants add sales
|
|
75
|
+
|
|
73
76
|
# Deploy a process and start an instance
|
|
74
77
|
c8ctl deploy ./my-process.bpmn
|
|
75
78
|
c8ctl run my-process
|
|
@@ -43,6 +43,22 @@ c8ctl cluster install 8.8
|
|
|
43
43
|
c8ctl cluster delete 8.8
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
+
## Physical tenants
|
|
47
|
+
|
|
48
|
+
For physical tenants (supporting Camunda 8.10+ builds):
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
c8ctl cluster tenants --c8-version 8.10 add sales
|
|
52
|
+
c8ctl cluster start 8.10
|
|
53
|
+
c8ctl cluster tenants list
|
|
54
|
+
c8ctl cluster secrets --tenant sales set OPENAI_API_KEY
|
|
55
|
+
c8ctl cluster tenants remove sales --yes
|
|
56
|
+
# Or choose tenants for one start only:
|
|
57
|
+
c8ctl cluster start 8.10 --physical-tenants sales,hr
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Tenant commands delegate to the selected installed c8run, following the same version selection and terminal behavior as `cluster secrets`. c8run owns tenant configuration and storage. See [local physical tenants](../../docs/getting-started.md#local-physical-tenants) for authentication, profiles, relative paths, and limitations.
|
|
61
|
+
|
|
46
62
|
## Version aliases
|
|
47
63
|
|
|
48
64
|
The `stable` and `alpha` aliases are resolved dynamically by querying the
|
|
@@ -114,6 +130,18 @@ The c8run archive is several hundred MB. If the connection drops, `c8ctl cluster
|
|
|
114
130
|
- Set `C8CTL_C8RUN_DOWNLOAD_URL` to download from a mirror with the same layout as the Camunda Download Center.
|
|
115
131
|
- Add `--verbose` to print HTTP details for each download attempt: request and response headers, timing, throughput, and the full error cause chain.
|
|
116
132
|
|
|
133
|
+
## Physical-tenant verification
|
|
134
|
+
|
|
135
|
+
The opt-in integration test owns the local cluster lifecycle and needs an installed c8run build with physical-tenant CLI support. Run it separately from the general integration suite, with no other cluster running and a dedicated cache containing that distribution:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
C8RUN_CACHE_DIR=/path/to/scratch-cache \
|
|
139
|
+
C8CTL_PHYSICAL_TENANTS_VERSION=8.10.1 \
|
|
140
|
+
node --experimental-strip-types --test tests/integration/physical-tenants.test.ts
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Set the version to the actual installed cache version. The test uses temporary tenant/secrets/profile files, validates authenticated profile routing and deployment isolation, restarts the cluster, and stops it on completion. Its tenant's engine data remains in the dedicated cache. The normal unit suite tests forwarding and failure handling without downloading or launching Java.
|
|
144
|
+
|
|
117
145
|
## Supported platforms
|
|
118
146
|
|
|
119
147
|
- macOS (x86_64, aarch64)
|
|
@@ -331,11 +331,12 @@ export const metadata = {
|
|
|
331
331
|
// so the subcommand flags are documented via `flagsHint` instead.
|
|
332
332
|
passthrough: true,
|
|
333
333
|
passthroughHint:
|
|
334
|
-
'--purge, --debug and --c8-version are read by the plugin;
|
|
334
|
+
'--purge, --debug, --physical-tenants and --c8-version are read by the plugin; arguments after `secrets` or `tenants` are forwarded to c8run',
|
|
335
335
|
flagsHint: [
|
|
336
336
|
'--c8-version <version> Camunda version, alias or major.minor (alternative to the positional <version>)',
|
|
337
337
|
'--debug (start, stop) Stream raw c8run output',
|
|
338
338
|
'--purge (stop only) Also delete runtime data after stopping',
|
|
339
|
+
'--physical-tenants <ids> (start only) Comma-separated physical tenants for this run (repeatable; Camunda 8.10+)',
|
|
339
340
|
],
|
|
340
341
|
subcommands: [
|
|
341
342
|
{ name: 'start', description: 'Start local Camunda 8 cluster' },
|
|
@@ -349,6 +350,7 @@ export const metadata = {
|
|
|
349
350
|
{ name: 'logs', description: 'Stream cluster logs' },
|
|
350
351
|
{ name: 'purge', description: 'Delete runtime data (keeps binary) so the next start is fresh' },
|
|
351
352
|
{ name: 'secrets', description: 'Manage local development secrets (passed through to c8run)' },
|
|
353
|
+
{ name: 'tenants', description: 'Manage local physical tenants (passed through to c8run; Camunda 8.10+)' },
|
|
352
354
|
],
|
|
353
355
|
examples: [
|
|
354
356
|
{ command: 'c8ctl cluster start', description: 'Start a local Camunda 8 cluster (latest stable)' },
|
|
@@ -367,6 +369,9 @@ export const metadata = {
|
|
|
367
369
|
{ command: 'c8ctl cluster secrets list', description: 'List secret names (values are never shown)' },
|
|
368
370
|
{ command: 'c8ctl cluster secrets import .env.secrets', description: 'Import secrets from a dotenv file' },
|
|
369
371
|
{ command: 'c8ctl cluster secrets delete OPENAI_API_KEY --yes', description: 'Delete a secret without prompting' },
|
|
372
|
+
{ command: 'c8ctl cluster tenants --c8-version 8.10 add sales', description: 'Save a physical tenant using an installed 8.10 build' },
|
|
373
|
+
{ command: 'c8ctl cluster start 8.10 --physical-tenants sales,hr', description: 'Start physical tenants for one run only' },
|
|
374
|
+
{ command: 'c8ctl cluster secrets --tenant sales set OPENAI_API_KEY', description: 'Store a secret for one physical tenant' },
|
|
370
375
|
],
|
|
371
376
|
},
|
|
372
377
|
},
|
|
@@ -1591,7 +1596,7 @@ function printSummary(rawOutput, version) {
|
|
|
1591
1596
|
console.log('');
|
|
1592
1597
|
}
|
|
1593
1598
|
|
|
1594
|
-
async function startC8Run(config, debug = false) {
|
|
1599
|
+
async function startC8Run(config, debug = false, startArgs = []) {
|
|
1595
1600
|
const logger = getLogger();
|
|
1596
1601
|
const binaryPath = getC8RunBinaryPath(config);
|
|
1597
1602
|
const logDir = join(dirname(binaryPath), 'log');
|
|
@@ -1645,9 +1650,10 @@ async function startC8Run(config, debug = false) {
|
|
|
1645
1650
|
|
|
1646
1651
|
logger.info('Starting Camunda 8 local cluster...');
|
|
1647
1652
|
|
|
1648
|
-
const proc = spawn(binaryPath, ['start'], {
|
|
1653
|
+
const proc = spawn(binaryPath, ['start', ...startArgs], {
|
|
1649
1654
|
stdio: ['ignore', 'pipe', 'pipe'],
|
|
1650
1655
|
cwd: dirname(binaryPath),
|
|
1656
|
+
env: { ...resolveLocalStoreEnv(process.env, process.cwd()), C8RUN_CLI_NAME },
|
|
1651
1657
|
});
|
|
1652
1658
|
|
|
1653
1659
|
if (typeof proc.pid !== 'number') {
|
|
@@ -1691,9 +1697,19 @@ async function startC8Run(config, debug = false) {
|
|
|
1691
1697
|
});
|
|
1692
1698
|
|
|
1693
1699
|
if (exitCode !== 0) {
|
|
1700
|
+
// A failed tenant probe leaves healthy engines alive; preserve their identity
|
|
1701
|
+
// for stop/status even if the installation directory is subsequently replaced.
|
|
1702
|
+
try {
|
|
1703
|
+
recordRunningClusterPids(config, { skipEmpty: true });
|
|
1704
|
+
} catch (error) {
|
|
1705
|
+
logger.warn(`Could not record surviving cluster processes: ${formatErrorWithCause(error)}. Use "c8ctl cluster stop" while the installation is still present.`);
|
|
1706
|
+
}
|
|
1694
1707
|
if (startupOutput.trim()) {
|
|
1695
1708
|
logger.error(`c8run output:\n${startupOutput.trim()}`);
|
|
1696
1709
|
}
|
|
1710
|
+
if (startArgs.length > 0 && /flag provided but not defined: -physical-tenants/.test(startupOutput)) {
|
|
1711
|
+
logger.error('This cached c8run build lacks --physical-tenants. Install a Camunda 8.10+ build containing physical-tenant CLI support with "c8ctl cluster install 8.10".');
|
|
1712
|
+
}
|
|
1697
1713
|
logger.error(
|
|
1698
1714
|
`c8run start exited with code ${exitCode ?? 'unknown'}${exitSignal ? ` (signal: ${exitSignal})` : ''}. Cluster will not be marked as running.`,
|
|
1699
1715
|
);
|
|
@@ -2080,7 +2096,7 @@ export function liveRecordedPids(cacheDir) {
|
|
|
2080
2096
|
* with a start signature so a later stop/status can tell the recorded process
|
|
2081
2097
|
* apart from an unrelated one that reused its PID.
|
|
2082
2098
|
*/
|
|
2083
|
-
export function recordRunningClusterPids(config, { signatureOf = processStartSignature } = {}) {
|
|
2099
|
+
export function recordRunningClusterPids(config, { signatureOf = processStartSignature, skipEmpty = false } = {}) {
|
|
2084
2100
|
const canFingerprint = platformSupportsProcessSignature();
|
|
2085
2101
|
const pids = [];
|
|
2086
2102
|
const signatures = {};
|
|
@@ -2108,7 +2124,9 @@ export function recordRunningClusterPids(config, { signatureOf = processStartSig
|
|
|
2108
2124
|
pids.push(pid);
|
|
2109
2125
|
}
|
|
2110
2126
|
}
|
|
2127
|
+
if (skipEmpty && pids.length === 0) return 0;
|
|
2111
2128
|
writeRunningClusterRecord(config.cacheDir, { version: config.version, pids, signatures });
|
|
2129
|
+
return pids.length;
|
|
2112
2130
|
}
|
|
2113
2131
|
|
|
2114
2132
|
/**
|
|
@@ -2475,13 +2493,15 @@ export async function stopC8Run(config, debug = false) {
|
|
|
2475
2493
|
* `--yes` / `-y` are c8ctl GLOBAL flags, so the host consumes them (it sets
|
|
2476
2494
|
* `ctx.yes`) and strips them from a passthrough command's args. c8run's own
|
|
2477
2495
|
* `secrets delete` has a `--yes` flag that skips its confirmation prompt, so
|
|
2478
|
-
* restore it when the user asked for it.
|
|
2479
|
-
*
|
|
2480
|
-
* not accept
|
|
2496
|
+
* restore it when the user asked for it. Tenant removal/reset also require
|
|
2497
|
+
* confirmation. Skip tenant selectors when locating a secrets verb, and never
|
|
2498
|
+
* append confirmation to a verb that does not accept it. Never mutates `tail`.
|
|
2481
2499
|
*/
|
|
2482
|
-
export function withForwardedYes(tail, ctx) {
|
|
2483
|
-
const
|
|
2484
|
-
|
|
2500
|
+
export function withForwardedYes(tail, ctx, command = 'secrets') {
|
|
2501
|
+
const versionEnd = tail[0]?.startsWith('--c8-version=') ? 1 : tail[0] === '--c8-version' ? 2 : 0;
|
|
2502
|
+
const positions = forwardedPositionals(tail, versionEnd, command === 'secrets');
|
|
2503
|
+
const verbs = command === 'tenants' ? ['remove', 'rm', 'reset'] : ['delete'];
|
|
2504
|
+
if (ctx?.yes !== true || !verbs.includes(tail[positions[0]])) return tail;
|
|
2485
2505
|
// Everything after a `--` terminator is literal for c8run, so the flag goes
|
|
2486
2506
|
// immediately before it, and a `--yes` that only appears after it does not count.
|
|
2487
2507
|
const terminator = tail.indexOf('--');
|
|
@@ -2504,7 +2524,7 @@ export function withForwardedYes(tail, ctx) {
|
|
|
2504
2524
|
* unreleased c8run's verb set (including one c8ctl has never heard of) is
|
|
2505
2525
|
* still forwarded and its own error surfaces as-is.
|
|
2506
2526
|
*/
|
|
2507
|
-
export function parseSecretsArgs(tail) {
|
|
2527
|
+
export function parseSecretsArgs(tail, command = 'secrets') {
|
|
2508
2528
|
let version = null;
|
|
2509
2529
|
let passthrough = tail;
|
|
2510
2530
|
|
|
@@ -2520,14 +2540,14 @@ export function parseSecretsArgs(tail) {
|
|
|
2520
2540
|
}
|
|
2521
2541
|
if (!version || version.startsWith('-')) {
|
|
2522
2542
|
throw new Error(
|
|
2523
|
-
|
|
2543
|
+
`Missing value for --c8-version. Example: c8ctl cluster ${command} --c8-version 8.10 list`,
|
|
2524
2544
|
);
|
|
2525
2545
|
}
|
|
2526
2546
|
}
|
|
2527
2547
|
|
|
2528
2548
|
if (passthrough.length === 0) {
|
|
2529
2549
|
throw new Error(
|
|
2530
|
-
|
|
2550
|
+
`usage: c8ctl cluster ${command} [--c8-version <version>] <${command === 'tenants' ? 'add|list|remove|reset|path|help|...' : 'set|list|path|delete|import|...'}>`,
|
|
2531
2551
|
);
|
|
2532
2552
|
}
|
|
2533
2553
|
|
|
@@ -2541,30 +2561,55 @@ export function parseSecretsArgs(tail) {
|
|
|
2541
2561
|
* C8RUN_SECRETS_DIR would otherwise resolve against the wrong directory and
|
|
2542
2562
|
* silently miss the file the user meant.
|
|
2543
2563
|
*
|
|
2544
|
-
* Only touches an `import` positional and
|
|
2564
|
+
* Only touches an `import` positional and the local store environment paths; every other
|
|
2545
2565
|
* verb and flag passes through untouched. "-" (stdin) and already-absolute
|
|
2546
2566
|
* paths are left alone. Never mutates the passthrough array or env object
|
|
2547
2567
|
* it receives.
|
|
2548
2568
|
*/
|
|
2549
2569
|
export function resolveSecretsPaths(passthrough, { cwd = process.cwd(), env = process.env } = {}) {
|
|
2550
2570
|
let resolvedPassthrough = passthrough;
|
|
2571
|
+
const positions = forwardedPositionals(passthrough, 0, true);
|
|
2572
|
+
const [verbIndex, fileIndex] = positions;
|
|
2551
2573
|
if (
|
|
2552
|
-
passthrough[
|
|
2553
|
-
passthrough[
|
|
2554
|
-
passthrough[
|
|
2555
|
-
!isAbsolute(passthrough[
|
|
2574
|
+
passthrough[verbIndex] === 'import' &&
|
|
2575
|
+
passthrough[fileIndex] &&
|
|
2576
|
+
passthrough[fileIndex] !== '-' &&
|
|
2577
|
+
!isAbsolute(passthrough[fileIndex])
|
|
2556
2578
|
) {
|
|
2557
2579
|
resolvedPassthrough = [...passthrough];
|
|
2558
|
-
resolvedPassthrough[
|
|
2580
|
+
resolvedPassthrough[fileIndex] = resolve(cwd, passthrough[fileIndex]);
|
|
2559
2581
|
}
|
|
2560
2582
|
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2583
|
+
return { passthrough: resolvedPassthrough, env: resolveLocalStoreEnv(env, cwd) };
|
|
2584
|
+
}
|
|
2585
|
+
|
|
2586
|
+
function forwardedPositionals(args, start, tenantScoped) {
|
|
2587
|
+
const positions = [];
|
|
2588
|
+
for (let i = start; i < args.length; i++) {
|
|
2589
|
+
if (args[i] === '--') break;
|
|
2590
|
+
if (tenantScoped && args[i] === '--tenant') {
|
|
2591
|
+
i++;
|
|
2592
|
+
continue;
|
|
2593
|
+
}
|
|
2594
|
+
if (tenantScoped && args[i].startsWith('--tenant=')) continue;
|
|
2595
|
+
// Unknown options belong to c8run. Do not guess which tokens they consume.
|
|
2596
|
+
positions.push(i);
|
|
2565
2597
|
}
|
|
2598
|
+
return positions;
|
|
2599
|
+
}
|
|
2566
2600
|
|
|
2567
|
-
|
|
2601
|
+
// Tells c8run which command prefix to print in its hints ("c8ctl cluster tenants list"
|
|
2602
|
+
// instead of "c8run tenants list"); c8run builds without support ignore it.
|
|
2603
|
+
const C8RUN_CLI_NAME = 'c8ctl cluster';
|
|
2604
|
+
|
|
2605
|
+
function resolveLocalStoreEnv(env, cwd) {
|
|
2606
|
+
let resolvedEnv = env;
|
|
2607
|
+
for (const name of ['C8RUN_SECRETS_DIR', 'C8RUN_TENANTS_FILE']) {
|
|
2608
|
+
if (env[name] && !isAbsolute(env[name])) {
|
|
2609
|
+
resolvedEnv = { ...resolvedEnv, [name]: resolve(cwd, env[name]) };
|
|
2610
|
+
}
|
|
2611
|
+
}
|
|
2612
|
+
return resolvedEnv;
|
|
2568
2613
|
}
|
|
2569
2614
|
|
|
2570
2615
|
/**
|
|
@@ -2637,6 +2682,15 @@ export function mapSecretsFailure(exitCode, stderrTail, version) {
|
|
|
2637
2682
|
* environment).
|
|
2638
2683
|
*/
|
|
2639
2684
|
export async function runClusterSecrets(
|
|
2685
|
+
cacheDir,
|
|
2686
|
+
tail,
|
|
2687
|
+
options = {},
|
|
2688
|
+
) {
|
|
2689
|
+
return runClusterLocalCommand('secrets', cacheDir, tail, options);
|
|
2690
|
+
}
|
|
2691
|
+
|
|
2692
|
+
async function runClusterLocalCommand(
|
|
2693
|
+
command,
|
|
2640
2694
|
cacheDir,
|
|
2641
2695
|
tail,
|
|
2642
2696
|
{ explicitVersion, spawnFn = spawn, cwd = process.cwd(), env = process.env } = {},
|
|
@@ -2646,7 +2700,7 @@ export async function runClusterSecrets(
|
|
|
2646
2700
|
const version = await selectSecretsVersion(cacheDir, { explicit: explicitVersion });
|
|
2647
2701
|
if (!version) {
|
|
2648
2702
|
logger.error(
|
|
2649
|
-
|
|
2703
|
+
`No c8run installed locally. Install one first: c8ctl cluster install ${command === 'tenants' ? '8.10' : 'alpha'}`,
|
|
2650
2704
|
);
|
|
2651
2705
|
process.exit(1);
|
|
2652
2706
|
return;
|
|
@@ -2656,18 +2710,20 @@ export async function runClusterSecrets(
|
|
|
2656
2710
|
try {
|
|
2657
2711
|
binaryPath = getC8RunBinaryPath({ cacheDir, version });
|
|
2658
2712
|
} catch (error) {
|
|
2659
|
-
logger.error(`Failed to run
|
|
2713
|
+
logger.error(`Failed to run ${command} command: ${error.message}`);
|
|
2660
2714
|
process.exit(1);
|
|
2661
2715
|
return;
|
|
2662
2716
|
}
|
|
2663
2717
|
|
|
2664
|
-
const { passthrough, env: resolvedEnv } =
|
|
2718
|
+
const { passthrough, env: resolvedEnv } = command === 'secrets'
|
|
2719
|
+
? resolveSecretsPaths(tail, { cwd, env })
|
|
2720
|
+
: { passthrough: tail, env: resolveLocalStoreEnv(env, cwd) };
|
|
2665
2721
|
|
|
2666
2722
|
const exitCode = await new Promise((resolvePromise, reject) => {
|
|
2667
|
-
const proc = spawnFn(binaryPath, [
|
|
2723
|
+
const proc = spawnFn(binaryPath, [command, ...passthrough], {
|
|
2668
2724
|
stdio: ['inherit', 'inherit', 'pipe'],
|
|
2669
2725
|
cwd: dirname(binaryPath),
|
|
2670
|
-
env: resolvedEnv,
|
|
2726
|
+
env: { ...resolvedEnv, C8RUN_CLI_NAME },
|
|
2671
2727
|
});
|
|
2672
2728
|
|
|
2673
2729
|
let stderrTail = '';
|
|
@@ -2681,7 +2737,11 @@ export async function runClusterSecrets(
|
|
|
2681
2737
|
reject(new Error(`Failed to spawn c8run: ${err.message}`));
|
|
2682
2738
|
});
|
|
2683
2739
|
proc.on('close', (code) => {
|
|
2684
|
-
const hint =
|
|
2740
|
+
const hint = command === 'secrets'
|
|
2741
|
+
? mapSecretsFailure(code ?? 1, stderrTail, version)
|
|
2742
|
+
: code !== 0 && /unsupported operation:\s*tenants/i.test(stderrTail)
|
|
2743
|
+
? `c8run ${version} does not support "tenants" yet. Install a Camunda 8.10+ c8run build containing physical-tenant CLI support with "c8ctl cluster install 8.10"; older cached builds may predate this feature.`
|
|
2744
|
+
: null;
|
|
2685
2745
|
if (hint) {
|
|
2686
2746
|
logger.error(hint);
|
|
2687
2747
|
}
|
|
@@ -3169,6 +3229,16 @@ export function parsePluginArgs(args) {
|
|
|
3169
3229
|
while (i < args.length) {
|
|
3170
3230
|
const arg = args[i];
|
|
3171
3231
|
|
|
3232
|
+
if (arg === '--physical-tenants' || arg.startsWith('--physical-tenants=')) {
|
|
3233
|
+
const value = arg === '--physical-tenants' ? args[i + 1] : arg.slice('--physical-tenants='.length);
|
|
3234
|
+
if (!value || value.startsWith('-')) throw new Error('--physical-tenants requires comma-separated tenant IDs');
|
|
3235
|
+
result.startArgs ??= [];
|
|
3236
|
+
result.startArgs.push(arg);
|
|
3237
|
+
if (arg === '--physical-tenants') { result.startArgs.push(value); i++; }
|
|
3238
|
+
i++;
|
|
3239
|
+
continue;
|
|
3240
|
+
}
|
|
3241
|
+
|
|
3172
3242
|
if (arg === '--c8-version') {
|
|
3173
3243
|
const next = args[i + 1];
|
|
3174
3244
|
if (!next || next.startsWith('-')) {
|
|
@@ -3221,6 +3291,9 @@ export function parsePluginArgs(args) {
|
|
|
3221
3291
|
i += 1;
|
|
3222
3292
|
}
|
|
3223
3293
|
|
|
3294
|
+
if (result.startArgs && result.subcommand !== 'start') {
|
|
3295
|
+
throw new Error('--physical-tenants can only be used with the start subcommand');
|
|
3296
|
+
}
|
|
3224
3297
|
return result;
|
|
3225
3298
|
}
|
|
3226
3299
|
|
|
@@ -3237,20 +3310,32 @@ export const commands = {
|
|
|
3237
3310
|
'cluster': async (args, _flags, ctx) => {
|
|
3238
3311
|
const logger = getLogger();
|
|
3239
3312
|
|
|
3240
|
-
//
|
|
3313
|
+
// Local management passthrough is intercepted before parsePluginArgs:
|
|
3241
3314
|
// its arguments (verbs, flags, positionals) belong to c8run, not to
|
|
3242
3315
|
// c8ctl's own version/--debug/--purge parsing.
|
|
3243
|
-
if (args[0] === 'secrets') {
|
|
3244
|
-
|
|
3316
|
+
if (args[0] === 'secrets' || args[0] === 'tenants') {
|
|
3317
|
+
const command = args[0];
|
|
3318
|
+
let parsedLocal;
|
|
3245
3319
|
try {
|
|
3246
|
-
|
|
3320
|
+
parsedLocal = parseSecretsArgs(withForwardedYes(args.slice(1), ctx, command), command);
|
|
3247
3321
|
} catch (error) {
|
|
3248
3322
|
logger.error(error.message);
|
|
3249
3323
|
process.exit(1);
|
|
3250
3324
|
return;
|
|
3251
3325
|
}
|
|
3252
|
-
|
|
3253
|
-
|
|
3326
|
+
if (ctx?.dryRun) {
|
|
3327
|
+
// Local-only lookup (no download) so the preview shows the c8run that would run.
|
|
3328
|
+
let version = null;
|
|
3329
|
+
try {
|
|
3330
|
+
version = await selectSecretsVersion(getCacheDir(), { explicit: parsedLocal.version });
|
|
3331
|
+
} catch {
|
|
3332
|
+
version = parsedLocal.version;
|
|
3333
|
+
}
|
|
3334
|
+
console.log(JSON.stringify({ dryRun: true, command: `cluster ${command}`, version, args: parsedLocal.passthrough }));
|
|
3335
|
+
return;
|
|
3336
|
+
}
|
|
3337
|
+
await runClusterLocalCommand(command, getCacheDir(), parsedLocal.passthrough, {
|
|
3338
|
+
explicitVersion: parsedLocal.version,
|
|
3254
3339
|
});
|
|
3255
3340
|
return;
|
|
3256
3341
|
}
|
|
@@ -3276,6 +3361,7 @@ export const commands = {
|
|
|
3276
3361
|
console.log(' c8ctl cluster delete <version>');
|
|
3277
3362
|
console.log(' c8ctl cluster purge <version>');
|
|
3278
3363
|
console.log(' c8ctl cluster secrets [--c8-version <version>] <set|list|path|delete|import|...>');
|
|
3364
|
+
console.log(' c8ctl cluster tenants [--c8-version <version>] <add|list|remove|reset|path|help>');
|
|
3279
3365
|
console.log('');
|
|
3280
3366
|
console.log('Subcommands:');
|
|
3281
3367
|
console.log(' start Download (if needed) and start a local Camunda 8 cluster');
|
|
@@ -3288,12 +3374,14 @@ export const commands = {
|
|
|
3288
3374
|
console.log(' delete Remove a locally cached version to reclaim disk space');
|
|
3289
3375
|
console.log(' purge Delete runtime data for a version (binary stays intact, next start is fresh)');
|
|
3290
3376
|
console.log(' secrets Manage local development secrets (forwarded verbatim to c8run)');
|
|
3377
|
+
console.log(' tenants Manage local physical tenants (Camunda 8.10+; forwarded to c8run)');
|
|
3291
3378
|
console.log('');
|
|
3292
3379
|
console.log('Options:');
|
|
3293
3380
|
console.log(' <version> Camunda version, alias, or major.minor (default: stable)');
|
|
3294
3381
|
console.log(' --c8-version <version> Alternative flag form for version');
|
|
3295
3382
|
console.log(' --debug Stream raw c8run output during start');
|
|
3296
3383
|
console.log(' --purge (stop only) also delete runtime data after stopping');
|
|
3384
|
+
console.log(' --physical-tenants <ids> (start only) Extra physical tenants for this run; repeatable');
|
|
3297
3385
|
console.log('');
|
|
3298
3386
|
console.log('A <version> can be:');
|
|
3299
3387
|
console.log(' stable / alpha Named aliases');
|
|
@@ -3326,6 +3414,9 @@ export const commands = {
|
|
|
3326
3414
|
console.log(' c8ctl cluster secrets list');
|
|
3327
3415
|
console.log(' c8ctl cluster secrets import .env.secrets');
|
|
3328
3416
|
console.log(' c8ctl cluster secrets delete OPENAI_API_KEY --yes');
|
|
3417
|
+
console.log(' c8ctl cluster tenants --c8-version 8.10 add sales');
|
|
3418
|
+
console.log(' c8ctl cluster start 8.10 --physical-tenants sales,hr');
|
|
3419
|
+
console.log(' c8ctl cluster secrets --tenant sales set OPENAI_API_KEY');
|
|
3329
3420
|
console.log('');
|
|
3330
3421
|
console.log('secrets forwards everything after it to c8run\'s own "secrets" command —');
|
|
3331
3422
|
console.log('c8ctl never sees or stores a secret value. Run "c8ctl cluster secrets help"');
|
|
@@ -3427,6 +3518,14 @@ export const commands = {
|
|
|
3427
3518
|
preferLocal: isStart,
|
|
3428
3519
|
cacheDir: theCacheDir,
|
|
3429
3520
|
});
|
|
3521
|
+
|
|
3522
|
+
// Dry-run start: report the version a real start would select (same
|
|
3523
|
+
// local-preferred resolution), but skip install and launch.
|
|
3524
|
+
if (ctx?.dryRun && isStart) {
|
|
3525
|
+
console.log(JSON.stringify({ dryRun: true, command: 'cluster start', version, requestedVersion: versionSpec, args: ['start', ...(parsed.startArgs || [])] }));
|
|
3526
|
+
return;
|
|
3527
|
+
}
|
|
3528
|
+
|
|
3430
3529
|
if (isVersionAlias(versionSpec)) {
|
|
3431
3530
|
logger.info(`Resolved alias "${versionSpec}" → ${version}`);
|
|
3432
3531
|
}
|
|
@@ -3452,7 +3551,7 @@ export const commands = {
|
|
|
3452
3551
|
if (parsed.subcommand === 'start') {
|
|
3453
3552
|
try {
|
|
3454
3553
|
await ensureC8RunInstalled(config);
|
|
3455
|
-
await startC8Run(config, parsed.debug);
|
|
3554
|
+
await startC8Run(config, parsed.debug, parsed.startArgs);
|
|
3456
3555
|
} catch (error) {
|
|
3457
3556
|
logger.error(`Failed to start cluster: ${formatErrorWithCause(error)}`);
|
|
3458
3557
|
process.exit(1);
|