@go-to-k/cdkd 0.167.2 → 0.168.0
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/dist/cli.js +65 -20
- package/dist/cli.js.map +1 -1
- package/dist/{deploy-engine-BQkk03hJ.js → deploy-engine-Cux0aKqI.js} +45 -11
- package/dist/deploy-engine-Cux0aKqI.js.map +1 -0
- package/dist/index.d.ts +8 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/deploy-engine-BQkk03hJ.js.map +0 -1
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { _ as withSkipPrefix, a as runDockerStreaming, c as getLogger, d as getLiveRenderer, f as PATTERN_B_NAME_PROPERTIES, g as generateResourceNameWithFallback, h as generateResourceName, i as runDockerForeground, n as formatDockerLoginError, p as PATTERN_B_RESOURCE_TYPES, r as getDockerCmd, u as runStackBuffered, v as withStackName } from "./docker-cmd-iDMcWcre.js";
|
|
3
|
-
import { A as S3StateBackend, B as resolveCaptureObservedState, C as assertRegionMatch, D as DagBuilder, E as DiffCalculator, F as buildDockerImage, G as CFN_TEMPLATE_BODY_LIMIT, H as resolveStateBucketWithDefault, I as Synthesizer, J as findLargeInlineResources, K as CFN_TEMPLATE_URL_LIMIT, L as getDefaultStateBucketName, M as AssetPublisher, N as stringifyValue, O as TemplateParser, P as WorkGraph, Q as resolveBucketRegion, R as getLegacyStateBucketName, S as CloudControlProvider, T as applyRoleArnIfSet, U as resolveStateBucketWithDefaultAndSource, V as resolveSkipPrefix, W as warnDeprecatedNoPrefixCliFlag, X as AssemblyReader, Y as uploadCfnTemplate, _ as matchesCdkPath, a as withRetry, at as LocalStartServiceError, b as ProviderRegistry, bt as normalizeAwsError, c as bold, ct as NestedStackChildDirectDestroyError, d as green, dt as ResourceTimeoutError, et as CdkdError, f as red, ft as ResourceUpdateNotSupportedError, g as CDK_PATH_TAG, h as collectInlinePolicyNamesManagedBySiblings, ht as StackTerminationProtectionError, i as withResourceDeadline, it as LocalMigrateError, j as shouldRetainResource, k as LockManager, l as cyan, lt as PartialFailureError, m as IAMRoleProvider, mt as StackHasActiveImportsError, n as DEFAULT_RESOURCE_WARN_AFTER_MS, o as IMPLICIT_DELETE_DEPENDENCIES, p as yellow, pt as RouteDiscoveryError, q as MIGRATE_TMP_PREFIX, r as DeployEngine, rt as LocalInvokeBuildError, s as formatResourceLine, st as MissingCdkCliError, t as DEFAULT_RESOURCE_TIMEOUT_MS, u as gray, ut as ProvisioningError, v as normalizeAwsTagsToCfn, w as IntrinsicFunctionResolver, x as findActionableSilentDrops, xt as withErrorHandling, y as resolveExplicitPhysicalId, z as resolveApp } from "./deploy-engine-
|
|
3
|
+
import { A as S3StateBackend, B as resolveCaptureObservedState, C as assertRegionMatch, D as DagBuilder, E as DiffCalculator, F as buildDockerImage, G as CFN_TEMPLATE_BODY_LIMIT, H as resolveStateBucketWithDefault, I as Synthesizer, J as findLargeInlineResources, K as CFN_TEMPLATE_URL_LIMIT, L as getDefaultStateBucketName, M as AssetPublisher, N as stringifyValue, O as TemplateParser, P as WorkGraph, Q as resolveBucketRegion, R as getLegacyStateBucketName, S as CloudControlProvider, T as applyRoleArnIfSet, U as resolveStateBucketWithDefaultAndSource, V as resolveSkipPrefix, W as warnDeprecatedNoPrefixCliFlag, X as AssemblyReader, Y as uploadCfnTemplate, _ as matchesCdkPath, a as withRetry, at as LocalStartServiceError, b as ProviderRegistry, bt as normalizeAwsError, c as bold, ct as NestedStackChildDirectDestroyError, d as green, dt as ResourceTimeoutError, et as CdkdError, f as red, ft as ResourceUpdateNotSupportedError, g as CDK_PATH_TAG, h as collectInlinePolicyNamesManagedBySiblings, ht as StackTerminationProtectionError, i as withResourceDeadline, it as LocalMigrateError, j as shouldRetainResource, k as LockManager, l as cyan, lt as PartialFailureError, m as IAMRoleProvider, mt as StackHasActiveImportsError, n as DEFAULT_RESOURCE_WARN_AFTER_MS, o as IMPLICIT_DELETE_DEPENDENCIES, p as yellow, pt as RouteDiscoveryError, q as MIGRATE_TMP_PREFIX, r as DeployEngine, rt as LocalInvokeBuildError, s as formatResourceLine, st as MissingCdkCliError, t as DEFAULT_RESOURCE_TIMEOUT_MS, u as gray, ut as ProvisioningError, v as normalizeAwsTagsToCfn, w as IntrinsicFunctionResolver, x as findActionableSilentDrops, xt as withErrorHandling, y as resolveExplicitPhysicalId, z as resolveApp } from "./deploy-engine-Cux0aKqI.js";
|
|
4
4
|
import { a as setAwsClients, i as resetAwsClients, r as getAwsClients, t as AwsClients } from "./aws-clients-B15NAPbL.js";
|
|
5
5
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
6
6
|
import { createHash, createHmac, createPublicKey, createVerify, randomBytes, randomUUID, timingSafeEqual } from "node:crypto";
|
|
@@ -1369,16 +1369,28 @@ async function findDownstreamConsumers(input) {
|
|
|
1369
1369
|
const region = ref.region ?? input.baseRegion;
|
|
1370
1370
|
if (ref.stackName === input.producerStack && region === input.producerRegion) return null;
|
|
1371
1371
|
try {
|
|
1372
|
-
const
|
|
1373
|
-
if (!
|
|
1374
|
-
const
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1372
|
+
const got = await input.stateBackend.getState(ref.stackName, region);
|
|
1373
|
+
if (!got) return null;
|
|
1374
|
+
const out = [];
|
|
1375
|
+
const imports = got.state.imports;
|
|
1376
|
+
if (imports && imports.length > 0) {
|
|
1377
|
+
for (const entry of imports) if (entry.sourceStack === input.producerStack && entry.sourceRegion === input.producerRegion) out.push({
|
|
1378
|
+
consumerStack: ref.stackName,
|
|
1379
|
+
consumerRegion: region,
|
|
1380
|
+
exportName: entry.exportName,
|
|
1381
|
+
intrinsic: "ImportValue"
|
|
1382
|
+
});
|
|
1383
|
+
}
|
|
1384
|
+
const outputReads = got.state.outputReads;
|
|
1385
|
+
if (outputReads && outputReads.length > 0) {
|
|
1386
|
+
for (const entry of outputReads) if (entry.sourceStack === input.producerStack && entry.sourceRegion === input.producerRegion) out.push({
|
|
1387
|
+
consumerStack: ref.stackName,
|
|
1388
|
+
consumerRegion: region,
|
|
1389
|
+
exportName: entry.outputName,
|
|
1390
|
+
intrinsic: "GetStackOutput"
|
|
1391
|
+
});
|
|
1392
|
+
}
|
|
1393
|
+
return out.length > 0 ? out : null;
|
|
1382
1394
|
} catch (err) {
|
|
1383
1395
|
logger.debug(`findDownstreamConsumers: skip ${ref.stackName} (${region}); ${err instanceof Error ? err.message : String(err)}`);
|
|
1384
1396
|
return null;
|
|
@@ -33933,7 +33945,7 @@ async function deployCommand(stacks, options) {
|
|
|
33933
33945
|
validation: validateRecreateTargets({
|
|
33934
33946
|
template: stackInfo.template,
|
|
33935
33947
|
state: stateForRecreateCheck?.state ?? {
|
|
33936
|
-
version:
|
|
33948
|
+
version: 8,
|
|
33937
33949
|
stackName: stackInfo.stackName,
|
|
33938
33950
|
region: stackRegion,
|
|
33939
33951
|
resources: {},
|
|
@@ -34940,7 +34952,7 @@ async function loadStateOrEmpty(stackName, region, stateBackend) {
|
|
|
34940
34952
|
region,
|
|
34941
34953
|
resources: {},
|
|
34942
34954
|
outputs: {},
|
|
34943
|
-
version:
|
|
34955
|
+
version: 8,
|
|
34944
34956
|
lastModified: Date.now()
|
|
34945
34957
|
};
|
|
34946
34958
|
}
|
|
@@ -41656,7 +41668,7 @@ function buildStackState(stackName, region, rows, templateParser, template, exis
|
|
|
41656
41668
|
};
|
|
41657
41669
|
}
|
|
41658
41670
|
return {
|
|
41659
|
-
version:
|
|
41671
|
+
version: 8,
|
|
41660
41672
|
stackName,
|
|
41661
41673
|
region,
|
|
41662
41674
|
resources,
|
|
@@ -56904,7 +56916,8 @@ async function runEcsTask(task, options, state) {
|
|
|
56904
56916
|
sidecarIp: state.network.sidecarIp,
|
|
56905
56917
|
...options.skipHostPortPublish ? { skipHostPortPublish: true } : {},
|
|
56906
56918
|
...options.addHostFlags && options.addHostFlags.length > 0 ? { addHostFlags: options.addHostFlags } : {},
|
|
56907
|
-
...(options.networkAliasesByContainer?.get(container.name)?.length ?? 0) > 0 ? { networkAliases: options.networkAliasesByContainer.get(container.name) } : {}
|
|
56919
|
+
...(options.networkAliasesByContainer?.get(container.name)?.length ?? 0) > 0 ? { networkAliases: options.networkAliasesByContainer.get(container.name) } : {},
|
|
56920
|
+
...options.profileCredentialsFile && { profileCredentialsFile: options.profileCredentialsFile }
|
|
56908
56921
|
}));
|
|
56909
56922
|
}
|
|
56910
56923
|
const startedByName = /* @__PURE__ */ new Map();
|
|
@@ -57236,6 +57249,7 @@ function buildDockerRunArgs(opts) {
|
|
|
57236
57249
|
const hostPort = pm.hostPort ?? pm.containerPort;
|
|
57237
57250
|
args.push("-p", `${containerHost}:${hostPort}:${pm.containerPort}/${pm.protocol}`);
|
|
57238
57251
|
}
|
|
57252
|
+
if (opts.profileCredentialsFile) args.push("-v", `${opts.profileCredentialsFile.hostPath}:${opts.profileCredentialsFile.containerPath}:ro`);
|
|
57239
57253
|
for (const mp of container.mountPoints) {
|
|
57240
57254
|
const v = volumeByName.get(mp.sourceVolume);
|
|
57241
57255
|
if (!v) continue;
|
|
@@ -57257,6 +57271,10 @@ function buildDockerRunArgs(opts) {
|
|
|
57257
57271
|
...opts.sidecarIp !== void 0 && { sidecarIp: opts.sidecarIp }
|
|
57258
57272
|
});
|
|
57259
57273
|
Object.assign(finalEnv, metaEnv);
|
|
57274
|
+
if (opts.profileCredentialsFile) {
|
|
57275
|
+
finalEnv["AWS_SHARED_CREDENTIALS_FILE"] = opts.profileCredentialsFile.containerPath;
|
|
57276
|
+
finalEnv["AWS_PROFILE"] = opts.profileCredentialsFile.profileName;
|
|
57277
|
+
}
|
|
57260
57278
|
Object.assign(finalEnv, container.environment);
|
|
57261
57279
|
for (const s of secrets) finalEnv[s.name] = s.value;
|
|
57262
57280
|
const overrides = opts.envOverrides;
|
|
@@ -57326,6 +57344,7 @@ async function localRunTaskCommand(target, options) {
|
|
|
57326
57344
|
let sigintHandler;
|
|
57327
57345
|
let sigintCount = 0;
|
|
57328
57346
|
let stateProvider;
|
|
57347
|
+
let profileCredsFile;
|
|
57329
57348
|
let cleanupPromise;
|
|
57330
57349
|
const cleanup = async () => {
|
|
57331
57350
|
if (!cleanupPromise) cleanupPromise = (async () => {
|
|
@@ -57334,6 +57353,11 @@ async function localRunTaskCommand(target, options) {
|
|
|
57334
57353
|
} catch (err) {
|
|
57335
57354
|
getLogger().debug(`cleanup failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
57336
57355
|
}
|
|
57356
|
+
if (profileCredsFile) try {
|
|
57357
|
+
await profileCredsFile.dispose();
|
|
57358
|
+
} catch (err) {
|
|
57359
|
+
getLogger().debug(`Failed to remove profile credentials tmpdir ${profileCredsFile.hostPath}: ${err instanceof Error ? err.message : String(err)}`);
|
|
57360
|
+
}
|
|
57337
57361
|
})();
|
|
57338
57362
|
await cleanupPromise;
|
|
57339
57363
|
};
|
|
@@ -57395,6 +57419,7 @@ async function localRunTaskCommand(target, options) {
|
|
|
57395
57419
|
assumedCredentials = await assumeTaskRole$1(resolvedRoleArn, options.region);
|
|
57396
57420
|
}
|
|
57397
57421
|
const sidecarCredentials = await resolveSidecarCredentials(options, assumedCredentials);
|
|
57422
|
+
if (options.profile && sidecarCredentials && !assumedCredentials) profileCredsFile = await writeProfileCredentialsFile(options.profile, sidecarCredentials);
|
|
57398
57423
|
const envOverrides = readEnvOverridesFile$2(options.envVars);
|
|
57399
57424
|
const runOpts = {
|
|
57400
57425
|
cluster: options.cluster,
|
|
@@ -57409,6 +57434,11 @@ async function localRunTaskCommand(target, options) {
|
|
|
57409
57434
|
if (options.platform) runOpts.platformOverride = options.platform;
|
|
57410
57435
|
if (options.region) runOpts.region = options.region;
|
|
57411
57436
|
if (options.ecrRoleArn) runOpts.ecrRoleArn = options.ecrRoleArn;
|
|
57437
|
+
if (profileCredsFile) runOpts.profileCredentialsFile = {
|
|
57438
|
+
hostPath: profileCredsFile.hostPath,
|
|
57439
|
+
containerPath: profileCredsFile.containerPath,
|
|
57440
|
+
profileName: profileCredsFile.profileName
|
|
57441
|
+
};
|
|
57412
57442
|
const result = await runEcsTask(task, runOpts, state);
|
|
57413
57443
|
if (options.detach) {
|
|
57414
57444
|
logger.info("Task containers started in detached mode; cdkd is exiting.");
|
|
@@ -58659,6 +58689,7 @@ async function localStartServiceCommand(targets, options) {
|
|
|
58659
58689
|
let sigintHandler;
|
|
58660
58690
|
let sigintCount = 0;
|
|
58661
58691
|
let sharedNetwork;
|
|
58692
|
+
let profileCredsFile;
|
|
58662
58693
|
const cleanup = singleFlight(async () => {
|
|
58663
58694
|
await Promise.allSettled(perTarget.map(async (pt) => {
|
|
58664
58695
|
if (pt.controller) await pt.controller.shutdown();
|
|
@@ -58667,6 +58698,14 @@ async function localStartServiceCommand(targets, options) {
|
|
|
58667
58698
|
await Promise.allSettled(pt.runState.replicas.map((r) => cleanupEcsRun(r.state, { keepRunning: false }).catch(() => void 0)));
|
|
58668
58699
|
}
|
|
58669
58700
|
}));
|
|
58701
|
+
if (profileCredsFile) {
|
|
58702
|
+
try {
|
|
58703
|
+
await profileCredsFile.dispose();
|
|
58704
|
+
} catch (err) {
|
|
58705
|
+
getLogger().warn(`Failed to remove profile credentials tmpdir ${profileCredsFile.hostPath}: ${err instanceof Error ? err.message : String(err)}`);
|
|
58706
|
+
}
|
|
58707
|
+
profileCredsFile = void 0;
|
|
58708
|
+
}
|
|
58670
58709
|
if (sharedNetwork) {
|
|
58671
58710
|
try {
|
|
58672
58711
|
await destroyTaskNetwork(sharedNetwork);
|
|
@@ -58715,6 +58754,7 @@ async function localStartServiceCommand(targets, options) {
|
|
|
58715
58754
|
} catch (err) {
|
|
58716
58755
|
throw new LocalStartServiceError(`Failed to create shared service network: ${err instanceof Error ? err.message : String(err)}`);
|
|
58717
58756
|
}
|
|
58757
|
+
if (options.profile && sidecarCredentials) profileCredsFile = await writeProfileCredentialsFile(options.profile, sidecarCredentials);
|
|
58718
58758
|
const discovery = {
|
|
58719
58759
|
registry,
|
|
58720
58760
|
cloudMapIndexByStack,
|
|
@@ -58731,7 +58771,7 @@ async function localStartServiceCommand(targets, options) {
|
|
|
58731
58771
|
};
|
|
58732
58772
|
process.on("SIGINT", sigintHandler);
|
|
58733
58773
|
process.on("SIGTERM", sigintHandler);
|
|
58734
|
-
for (const pt of perTarget) pt.controller = await bootOneTarget(pt.target, pt.runState, stacks, options, discovery, skipPull);
|
|
58774
|
+
for (const pt of perTarget) pt.controller = await bootOneTarget(pt.target, pt.runState, stacks, options, discovery, skipPull, profileCredsFile);
|
|
58735
58775
|
const summary = perTarget.map((pt) => `${pt.controller.service.serviceName} (${pt.controller.activeReplicaCount()} replica(s))`).join(", ");
|
|
58736
58776
|
logger.info(`Service(s) running: ${summary}. Press ^C to shut down.`);
|
|
58737
58777
|
await Promise.all(perTarget.map((pt) => pt.controller.waitForShutdown()));
|
|
@@ -58749,16 +58789,16 @@ async function localStartServiceCommand(targets, options) {
|
|
|
58749
58789
|
* options) is scoped locally. Returns the started controller for the
|
|
58750
58790
|
* outer code to wait + tear down.
|
|
58751
58791
|
*/
|
|
58752
|
-
async function bootOneTarget(target, runState, stacks, options, discovery, skipPull) {
|
|
58792
|
+
async function bootOneTarget(target, runState, stacks, options, discovery, skipPull, profileCredsFile) {
|
|
58753
58793
|
const candidate = pickCandidateStack(parseEcsTarget(target).stackPattern, stacks);
|
|
58754
58794
|
const stateProvider = createLocalStateProvider(options, candidate?.stackName ?? "", candidate?.region);
|
|
58755
58795
|
try {
|
|
58756
|
-
return await runOneTarget(target, runState, stacks, options, discovery, skipPull, stateProvider);
|
|
58796
|
+
return await runOneTarget(target, runState, stacks, options, discovery, skipPull, stateProvider, profileCredsFile);
|
|
58757
58797
|
} finally {
|
|
58758
58798
|
if (stateProvider) stateProvider.dispose();
|
|
58759
58799
|
}
|
|
58760
58800
|
}
|
|
58761
|
-
async function runOneTarget(target, runState, stacks, options, discovery, skipPull, stateProvider) {
|
|
58801
|
+
async function runOneTarget(target, runState, stacks, options, discovery, skipPull, stateProvider, profileCredsFile) {
|
|
58762
58802
|
const logger = getLogger();
|
|
58763
58803
|
const imageContext = await buildEcsImageResolutionContext(target, stacks, options, stateProvider);
|
|
58764
58804
|
const service = resolveEcsServiceTarget(target, stacks, imageContext);
|
|
@@ -58804,6 +58844,11 @@ async function runOneTarget(target, runState, stacks, options, discovery, skipPu
|
|
|
58804
58844
|
if (options.platform) taskOpts.platformOverride = options.platform;
|
|
58805
58845
|
if (options.region) taskOpts.region = options.region;
|
|
58806
58846
|
if (options.ecrRoleArn) taskOpts.ecrRoleArn = options.ecrRoleArn;
|
|
58847
|
+
if (profileCredsFile && !assumedCredentials) taskOpts.profileCredentialsFile = {
|
|
58848
|
+
hostPath: profileCredsFile.hostPath,
|
|
58849
|
+
containerPath: profileCredsFile.containerPath,
|
|
58850
|
+
profileName: profileCredsFile.profileName
|
|
58851
|
+
};
|
|
58807
58852
|
return startEcsService(service, {
|
|
58808
58853
|
maxTasks: options.maxTasks,
|
|
58809
58854
|
restartPolicy: options.restartPolicy,
|
|
@@ -60882,7 +60927,7 @@ function reorderArgs(argv) {
|
|
|
60882
60927
|
*/
|
|
60883
60928
|
async function main() {
|
|
60884
60929
|
const program = new Command();
|
|
60885
|
-
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.
|
|
60930
|
+
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.168.0");
|
|
60886
60931
|
program.addCommand(createBootstrapCommand());
|
|
60887
60932
|
program.addCommand(createSynthCommand());
|
|
60888
60933
|
program.addCommand(createListCommand());
|