@go-to-k/cdkd 0.71.0 → 0.72.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/README.md +5 -0
- package/dist/cli.js +66 -37
- package/dist/cli.js.map +3 -3
- package/dist/go-to-k-cdkd-0.72.0.tgz +0 -0
- package/package.json +1 -1
- package/dist/go-to-k-cdkd-0.71.0.tgz +0 -0
package/README.md
CHANGED
|
@@ -613,6 +613,11 @@ cdkd local invoke MyStack/Handler --env-vars env.json
|
|
|
613
613
|
# Skip docker pull when iterating
|
|
614
614
|
cdkd local invoke MyStack/Handler --no-pull
|
|
615
615
|
|
|
616
|
+
# Skip the local docker build for container Lambdas (Code.ImageUri).
|
|
617
|
+
# Reuses the deterministic cdkd-local-invoke-<hash> tag from a prior
|
|
618
|
+
# build. Errors clearly when the tag is missing.
|
|
619
|
+
cdkd local invoke MyStack/ContainerHandler --no-build
|
|
620
|
+
|
|
616
621
|
# Run with the deployed function's narrow execution role (otherwise the
|
|
617
622
|
# developer's shell credentials are forwarded — SAM-compatible default)
|
|
618
623
|
cdkd local invoke MyStack/Handler --assume-role arn:aws:iam::123456789012:role/MyApi-handler-role
|
package/dist/cli.js
CHANGED
|
@@ -70703,41 +70703,6 @@ function runForeground(cmd, args) {
|
|
|
70703
70703
|
|
|
70704
70704
|
// src/local/docker-image-builder.ts
|
|
70705
70705
|
import { createHash as createHash2 } from "node:crypto";
|
|
70706
|
-
async function buildContainerImage(asset, cdkOutDir, options) {
|
|
70707
|
-
const tag = computeLocalTag(asset.source);
|
|
70708
|
-
const platform = architectureToPlatform(options.architecture);
|
|
70709
|
-
const logger = getLogger().child("local-invoke-build");
|
|
70710
|
-
logger.info(`Building container image (platform=${platform})...`);
|
|
70711
|
-
logger.debug(`Local tag: ${tag}`);
|
|
70712
|
-
await buildDockerImage(asset, cdkOutDir, tag, {
|
|
70713
|
-
platform,
|
|
70714
|
-
wrapError: (stderr) => new LocalInvokeBuildError(
|
|
70715
|
-
`docker build failed for container Lambda asset (${asset.source.directory}): ${stderr}`
|
|
70716
|
-
)
|
|
70717
|
-
});
|
|
70718
|
-
return tag;
|
|
70719
|
-
}
|
|
70720
|
-
function architectureToPlatform(architecture) {
|
|
70721
|
-
return architecture === "arm64" ? "linux/arm64" : "linux/amd64";
|
|
70722
|
-
}
|
|
70723
|
-
function computeLocalTag(source) {
|
|
70724
|
-
const hash = createHash2("sha256");
|
|
70725
|
-
hash.update(source.directory);
|
|
70726
|
-
hash.update("\0");
|
|
70727
|
-
hash.update(source.dockerFile ?? "");
|
|
70728
|
-
hash.update("\0");
|
|
70729
|
-
hash.update(source.dockerBuildTarget ?? "");
|
|
70730
|
-
hash.update("\0");
|
|
70731
|
-
if (source.dockerBuildArgs) {
|
|
70732
|
-
for (const [k, v] of Object.entries(source.dockerBuildArgs)) {
|
|
70733
|
-
hash.update(k);
|
|
70734
|
-
hash.update("=");
|
|
70735
|
-
hash.update(v);
|
|
70736
|
-
hash.update("\0");
|
|
70737
|
-
}
|
|
70738
|
-
}
|
|
70739
|
-
return `cdkd-local-invoke-${hash.digest("hex").slice(0, 16)}`;
|
|
70740
|
-
}
|
|
70741
70706
|
|
|
70742
70707
|
// src/local/ecr-puller.ts
|
|
70743
70708
|
import { execFile as execFile4, spawn as spawn4 } from "node:child_process";
|
|
@@ -70845,6 +70810,14 @@ async function verifyImageInLocalCache(imageUri) {
|
|
|
70845
70810
|
);
|
|
70846
70811
|
}
|
|
70847
70812
|
}
|
|
70813
|
+
async function isImageInLocalCache(imageRef) {
|
|
70814
|
+
try {
|
|
70815
|
+
await execFileAsync4("docker", ["image", "inspect", imageRef]);
|
|
70816
|
+
return true;
|
|
70817
|
+
} catch {
|
|
70818
|
+
return false;
|
|
70819
|
+
}
|
|
70820
|
+
}
|
|
70848
70821
|
function runForeground2(cmd, args) {
|
|
70849
70822
|
return new Promise((resolve6, reject) => {
|
|
70850
70823
|
const proc = spawn4(cmd, args, { stdio: "inherit" });
|
|
@@ -70858,6 +70831,53 @@ function runForeground2(cmd, args) {
|
|
|
70858
70831
|
});
|
|
70859
70832
|
}
|
|
70860
70833
|
|
|
70834
|
+
// src/local/docker-image-builder.ts
|
|
70835
|
+
async function buildContainerImage(asset, cdkOutDir, options) {
|
|
70836
|
+
const tag = computeLocalTag(asset.source);
|
|
70837
|
+
const platform = architectureToPlatform(options.architecture);
|
|
70838
|
+
const logger = getLogger().child("local-invoke-build");
|
|
70839
|
+
if (options.noBuild === true) {
|
|
70840
|
+
logger.info(`Skipping docker build (--no-build). Verifying ${tag} is in local registry...`);
|
|
70841
|
+
if (!await isImageInLocalCache(tag)) {
|
|
70842
|
+
throw new LocalInvokeBuildError(
|
|
70843
|
+
`image '${tag}' not in local registry and --no-build is set; remove --no-build or run \`docker build\` manually first.`
|
|
70844
|
+
);
|
|
70845
|
+
}
|
|
70846
|
+
logger.debug(`Local tag ${tag} is cached; skipping build.`);
|
|
70847
|
+
return tag;
|
|
70848
|
+
}
|
|
70849
|
+
logger.info(`Building container image (platform=${platform})...`);
|
|
70850
|
+
logger.debug(`Local tag: ${tag}`);
|
|
70851
|
+
await buildDockerImage(asset, cdkOutDir, tag, {
|
|
70852
|
+
platform,
|
|
70853
|
+
wrapError: (stderr) => new LocalInvokeBuildError(
|
|
70854
|
+
`docker build failed for container Lambda asset (${asset.source.directory}): ${stderr}`
|
|
70855
|
+
)
|
|
70856
|
+
});
|
|
70857
|
+
return tag;
|
|
70858
|
+
}
|
|
70859
|
+
function architectureToPlatform(architecture) {
|
|
70860
|
+
return architecture === "arm64" ? "linux/arm64" : "linux/amd64";
|
|
70861
|
+
}
|
|
70862
|
+
function computeLocalTag(source) {
|
|
70863
|
+
const hash = createHash2("sha256");
|
|
70864
|
+
hash.update(source.directory);
|
|
70865
|
+
hash.update("\0");
|
|
70866
|
+
hash.update(source.dockerFile ?? "");
|
|
70867
|
+
hash.update("\0");
|
|
70868
|
+
hash.update(source.dockerBuildTarget ?? "");
|
|
70869
|
+
hash.update("\0");
|
|
70870
|
+
if (source.dockerBuildArgs) {
|
|
70871
|
+
for (const [k, v] of Object.entries(source.dockerBuildArgs)) {
|
|
70872
|
+
hash.update(k);
|
|
70873
|
+
hash.update("=");
|
|
70874
|
+
hash.update(v);
|
|
70875
|
+
hash.update("\0");
|
|
70876
|
+
}
|
|
70877
|
+
}
|
|
70878
|
+
return `cdkd-local-invoke-${hash.digest("hex").slice(0, 16)}`;
|
|
70879
|
+
}
|
|
70880
|
+
|
|
70861
70881
|
// src/local/rie-client.ts
|
|
70862
70882
|
import { setTimeout as delay } from "node:timers/promises";
|
|
70863
70883
|
var INVOKE_PATH = "/2015-03-31/functions/function/invocations";
|
|
@@ -72895,7 +72915,11 @@ async function resolveContainerImagePlan(lambda, options) {
|
|
|
72895
72915
|
let imageRef;
|
|
72896
72916
|
if (localBuild) {
|
|
72897
72917
|
imageRef = await buildContainerImage(localBuild.asset, localBuild.cdkOutDir, {
|
|
72898
|
-
architecture: lambda.architecture
|
|
72918
|
+
architecture: lambda.architecture,
|
|
72919
|
+
// `options.build === false` triggers the no-build path: skip
|
|
72920
|
+
// `docker build` and verify the deterministic tag is already
|
|
72921
|
+
// cached. Default `true` (build as usual). Closes #233.
|
|
72922
|
+
noBuild: options.build === false
|
|
72899
72923
|
});
|
|
72900
72924
|
} else {
|
|
72901
72925
|
if (!parseEcrUri(lambda.imageUri)) {
|
|
@@ -73171,6 +73195,11 @@ function createLocalCommand() {
|
|
|
73171
73195
|
"--no-pull",
|
|
73172
73196
|
"Skip docker pull (use cached image) \u2014 no-op for IMAGE local-build path; `docker build` does not pull base layers by default"
|
|
73173
73197
|
)
|
|
73198
|
+
).addOption(
|
|
73199
|
+
new Option8(
|
|
73200
|
+
"--no-build",
|
|
73201
|
+
"Skip docker build on the IMAGE local-build path (use the previously-built tag). Requires the deterministic tag to already be in the local registry; errors with an actionable message when missing. No-op for ZIP Lambdas and the IMAGE ECR-pull path. Compatible with --no-pull."
|
|
73202
|
+
)
|
|
73174
73203
|
).addOption(new Option8("--debug-port <port>", "Node --inspect-brk port (default: off)")).addOption(
|
|
73175
73204
|
new Option8("--container-host <host>", "Host to bind the RIE port to").default("127.0.0.1")
|
|
73176
73205
|
).addOption(
|
|
@@ -73227,7 +73256,7 @@ function reorderArgs(argv) {
|
|
|
73227
73256
|
}
|
|
73228
73257
|
async function main() {
|
|
73229
73258
|
const program = new Command16();
|
|
73230
|
-
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.
|
|
73259
|
+
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.72.0");
|
|
73231
73260
|
program.addCommand(createBootstrapCommand());
|
|
73232
73261
|
program.addCommand(createSynthCommand());
|
|
73233
73262
|
program.addCommand(createListCommand());
|