@go-to-k/cdkd 0.167.2 → 0.167.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/dist/cli.js +39 -6
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -56904,7 +56904,8 @@ async function runEcsTask(task, options, state) {
|
|
|
56904
56904
|
sidecarIp: state.network.sidecarIp,
|
|
56905
56905
|
...options.skipHostPortPublish ? { skipHostPortPublish: true } : {},
|
|
56906
56906
|
...options.addHostFlags && options.addHostFlags.length > 0 ? { addHostFlags: options.addHostFlags } : {},
|
|
56907
|
-
...(options.networkAliasesByContainer?.get(container.name)?.length ?? 0) > 0 ? { networkAliases: options.networkAliasesByContainer.get(container.name) } : {}
|
|
56907
|
+
...(options.networkAliasesByContainer?.get(container.name)?.length ?? 0) > 0 ? { networkAliases: options.networkAliasesByContainer.get(container.name) } : {},
|
|
56908
|
+
...options.profileCredentialsFile && { profileCredentialsFile: options.profileCredentialsFile }
|
|
56908
56909
|
}));
|
|
56909
56910
|
}
|
|
56910
56911
|
const startedByName = /* @__PURE__ */ new Map();
|
|
@@ -57236,6 +57237,7 @@ function buildDockerRunArgs(opts) {
|
|
|
57236
57237
|
const hostPort = pm.hostPort ?? pm.containerPort;
|
|
57237
57238
|
args.push("-p", `${containerHost}:${hostPort}:${pm.containerPort}/${pm.protocol}`);
|
|
57238
57239
|
}
|
|
57240
|
+
if (opts.profileCredentialsFile) args.push("-v", `${opts.profileCredentialsFile.hostPath}:${opts.profileCredentialsFile.containerPath}:ro`);
|
|
57239
57241
|
for (const mp of container.mountPoints) {
|
|
57240
57242
|
const v = volumeByName.get(mp.sourceVolume);
|
|
57241
57243
|
if (!v) continue;
|
|
@@ -57257,6 +57259,10 @@ function buildDockerRunArgs(opts) {
|
|
|
57257
57259
|
...opts.sidecarIp !== void 0 && { sidecarIp: opts.sidecarIp }
|
|
57258
57260
|
});
|
|
57259
57261
|
Object.assign(finalEnv, metaEnv);
|
|
57262
|
+
if (opts.profileCredentialsFile) {
|
|
57263
|
+
finalEnv["AWS_SHARED_CREDENTIALS_FILE"] = opts.profileCredentialsFile.containerPath;
|
|
57264
|
+
finalEnv["AWS_PROFILE"] = opts.profileCredentialsFile.profileName;
|
|
57265
|
+
}
|
|
57260
57266
|
Object.assign(finalEnv, container.environment);
|
|
57261
57267
|
for (const s of secrets) finalEnv[s.name] = s.value;
|
|
57262
57268
|
const overrides = opts.envOverrides;
|
|
@@ -57326,6 +57332,7 @@ async function localRunTaskCommand(target, options) {
|
|
|
57326
57332
|
let sigintHandler;
|
|
57327
57333
|
let sigintCount = 0;
|
|
57328
57334
|
let stateProvider;
|
|
57335
|
+
let profileCredsFile;
|
|
57329
57336
|
let cleanupPromise;
|
|
57330
57337
|
const cleanup = async () => {
|
|
57331
57338
|
if (!cleanupPromise) cleanupPromise = (async () => {
|
|
@@ -57334,6 +57341,11 @@ async function localRunTaskCommand(target, options) {
|
|
|
57334
57341
|
} catch (err) {
|
|
57335
57342
|
getLogger().debug(`cleanup failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
57336
57343
|
}
|
|
57344
|
+
if (profileCredsFile) try {
|
|
57345
|
+
await profileCredsFile.dispose();
|
|
57346
|
+
} catch (err) {
|
|
57347
|
+
getLogger().debug(`Failed to remove profile credentials tmpdir ${profileCredsFile.hostPath}: ${err instanceof Error ? err.message : String(err)}`);
|
|
57348
|
+
}
|
|
57337
57349
|
})();
|
|
57338
57350
|
await cleanupPromise;
|
|
57339
57351
|
};
|
|
@@ -57395,6 +57407,7 @@ async function localRunTaskCommand(target, options) {
|
|
|
57395
57407
|
assumedCredentials = await assumeTaskRole$1(resolvedRoleArn, options.region);
|
|
57396
57408
|
}
|
|
57397
57409
|
const sidecarCredentials = await resolveSidecarCredentials(options, assumedCredentials);
|
|
57410
|
+
if (options.profile && sidecarCredentials && !assumedCredentials) profileCredsFile = await writeProfileCredentialsFile(options.profile, sidecarCredentials);
|
|
57398
57411
|
const envOverrides = readEnvOverridesFile$2(options.envVars);
|
|
57399
57412
|
const runOpts = {
|
|
57400
57413
|
cluster: options.cluster,
|
|
@@ -57409,6 +57422,11 @@ async function localRunTaskCommand(target, options) {
|
|
|
57409
57422
|
if (options.platform) runOpts.platformOverride = options.platform;
|
|
57410
57423
|
if (options.region) runOpts.region = options.region;
|
|
57411
57424
|
if (options.ecrRoleArn) runOpts.ecrRoleArn = options.ecrRoleArn;
|
|
57425
|
+
if (profileCredsFile) runOpts.profileCredentialsFile = {
|
|
57426
|
+
hostPath: profileCredsFile.hostPath,
|
|
57427
|
+
containerPath: profileCredsFile.containerPath,
|
|
57428
|
+
profileName: profileCredsFile.profileName
|
|
57429
|
+
};
|
|
57412
57430
|
const result = await runEcsTask(task, runOpts, state);
|
|
57413
57431
|
if (options.detach) {
|
|
57414
57432
|
logger.info("Task containers started in detached mode; cdkd is exiting.");
|
|
@@ -58659,6 +58677,7 @@ async function localStartServiceCommand(targets, options) {
|
|
|
58659
58677
|
let sigintHandler;
|
|
58660
58678
|
let sigintCount = 0;
|
|
58661
58679
|
let sharedNetwork;
|
|
58680
|
+
let profileCredsFile;
|
|
58662
58681
|
const cleanup = singleFlight(async () => {
|
|
58663
58682
|
await Promise.allSettled(perTarget.map(async (pt) => {
|
|
58664
58683
|
if (pt.controller) await pt.controller.shutdown();
|
|
@@ -58667,6 +58686,14 @@ async function localStartServiceCommand(targets, options) {
|
|
|
58667
58686
|
await Promise.allSettled(pt.runState.replicas.map((r) => cleanupEcsRun(r.state, { keepRunning: false }).catch(() => void 0)));
|
|
58668
58687
|
}
|
|
58669
58688
|
}));
|
|
58689
|
+
if (profileCredsFile) {
|
|
58690
|
+
try {
|
|
58691
|
+
await profileCredsFile.dispose();
|
|
58692
|
+
} catch (err) {
|
|
58693
|
+
getLogger().warn(`Failed to remove profile credentials tmpdir ${profileCredsFile.hostPath}: ${err instanceof Error ? err.message : String(err)}`);
|
|
58694
|
+
}
|
|
58695
|
+
profileCredsFile = void 0;
|
|
58696
|
+
}
|
|
58670
58697
|
if (sharedNetwork) {
|
|
58671
58698
|
try {
|
|
58672
58699
|
await destroyTaskNetwork(sharedNetwork);
|
|
@@ -58715,6 +58742,7 @@ async function localStartServiceCommand(targets, options) {
|
|
|
58715
58742
|
} catch (err) {
|
|
58716
58743
|
throw new LocalStartServiceError(`Failed to create shared service network: ${err instanceof Error ? err.message : String(err)}`);
|
|
58717
58744
|
}
|
|
58745
|
+
if (options.profile && sidecarCredentials) profileCredsFile = await writeProfileCredentialsFile(options.profile, sidecarCredentials);
|
|
58718
58746
|
const discovery = {
|
|
58719
58747
|
registry,
|
|
58720
58748
|
cloudMapIndexByStack,
|
|
@@ -58731,7 +58759,7 @@ async function localStartServiceCommand(targets, options) {
|
|
|
58731
58759
|
};
|
|
58732
58760
|
process.on("SIGINT", sigintHandler);
|
|
58733
58761
|
process.on("SIGTERM", sigintHandler);
|
|
58734
|
-
for (const pt of perTarget) pt.controller = await bootOneTarget(pt.target, pt.runState, stacks, options, discovery, skipPull);
|
|
58762
|
+
for (const pt of perTarget) pt.controller = await bootOneTarget(pt.target, pt.runState, stacks, options, discovery, skipPull, profileCredsFile);
|
|
58735
58763
|
const summary = perTarget.map((pt) => `${pt.controller.service.serviceName} (${pt.controller.activeReplicaCount()} replica(s))`).join(", ");
|
|
58736
58764
|
logger.info(`Service(s) running: ${summary}. Press ^C to shut down.`);
|
|
58737
58765
|
await Promise.all(perTarget.map((pt) => pt.controller.waitForShutdown()));
|
|
@@ -58749,16 +58777,16 @@ async function localStartServiceCommand(targets, options) {
|
|
|
58749
58777
|
* options) is scoped locally. Returns the started controller for the
|
|
58750
58778
|
* outer code to wait + tear down.
|
|
58751
58779
|
*/
|
|
58752
|
-
async function bootOneTarget(target, runState, stacks, options, discovery, skipPull) {
|
|
58780
|
+
async function bootOneTarget(target, runState, stacks, options, discovery, skipPull, profileCredsFile) {
|
|
58753
58781
|
const candidate = pickCandidateStack(parseEcsTarget(target).stackPattern, stacks);
|
|
58754
58782
|
const stateProvider = createLocalStateProvider(options, candidate?.stackName ?? "", candidate?.region);
|
|
58755
58783
|
try {
|
|
58756
|
-
return await runOneTarget(target, runState, stacks, options, discovery, skipPull, stateProvider);
|
|
58784
|
+
return await runOneTarget(target, runState, stacks, options, discovery, skipPull, stateProvider, profileCredsFile);
|
|
58757
58785
|
} finally {
|
|
58758
58786
|
if (stateProvider) stateProvider.dispose();
|
|
58759
58787
|
}
|
|
58760
58788
|
}
|
|
58761
|
-
async function runOneTarget(target, runState, stacks, options, discovery, skipPull, stateProvider) {
|
|
58789
|
+
async function runOneTarget(target, runState, stacks, options, discovery, skipPull, stateProvider, profileCredsFile) {
|
|
58762
58790
|
const logger = getLogger();
|
|
58763
58791
|
const imageContext = await buildEcsImageResolutionContext(target, stacks, options, stateProvider);
|
|
58764
58792
|
const service = resolveEcsServiceTarget(target, stacks, imageContext);
|
|
@@ -58804,6 +58832,11 @@ async function runOneTarget(target, runState, stacks, options, discovery, skipPu
|
|
|
58804
58832
|
if (options.platform) taskOpts.platformOverride = options.platform;
|
|
58805
58833
|
if (options.region) taskOpts.region = options.region;
|
|
58806
58834
|
if (options.ecrRoleArn) taskOpts.ecrRoleArn = options.ecrRoleArn;
|
|
58835
|
+
if (profileCredsFile && !assumedCredentials) taskOpts.profileCredentialsFile = {
|
|
58836
|
+
hostPath: profileCredsFile.hostPath,
|
|
58837
|
+
containerPath: profileCredsFile.containerPath,
|
|
58838
|
+
profileName: profileCredsFile.profileName
|
|
58839
|
+
};
|
|
58807
58840
|
return startEcsService(service, {
|
|
58808
58841
|
maxTasks: options.maxTasks,
|
|
58809
58842
|
restartPolicy: options.restartPolicy,
|
|
@@ -60882,7 +60915,7 @@ function reorderArgs(argv) {
|
|
|
60882
60915
|
*/
|
|
60883
60916
|
async function main() {
|
|
60884
60917
|
const program = new Command();
|
|
60885
|
-
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.167.
|
|
60918
|
+
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.167.3");
|
|
60886
60919
|
program.addCommand(createBootstrapCommand());
|
|
60887
60920
|
program.addCommand(createSynthCommand());
|
|
60888
60921
|
program.addCommand(createListCommand());
|