@aws/agentcore-cdk 1.1.0 → 1.2.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.
Files changed (68) hide show
  1. package/README.md +49 -0
  2. package/dist/cdk/constructs/bundling/container/ContainerSourceAsset.d.ts +14 -10
  3. package/dist/cdk/constructs/bundling/container/ContainerSourceAsset.d.ts.map +1 -1
  4. package/dist/cdk/constructs/bundling/container/ContainerSourceAsset.js +16 -51
  5. package/dist/cdk/constructs/bundling/container/ContainerSourceAsset.js.map +1 -1
  6. package/dist/cdk/constructs/bundling/container/build-context.d.ts +36 -0
  7. package/dist/cdk/constructs/bundling/container/build-context.d.ts.map +1 -0
  8. package/dist/cdk/constructs/bundling/container/build-context.js +96 -0
  9. package/dist/cdk/constructs/bundling/container/build-context.js.map +1 -0
  10. package/dist/cdk/constructs/components/container/ContainerImageBuilder.d.ts.map +1 -1
  11. package/dist/cdk/constructs/components/container/ContainerImageBuilder.js +3 -16
  12. package/dist/cdk/constructs/components/container/ContainerImageBuilder.js.map +1 -1
  13. package/dist/cdk/constructs/components/container/LocalContainerImageAsset.d.ts +14 -0
  14. package/dist/cdk/constructs/components/container/LocalContainerImageAsset.d.ts.map +1 -0
  15. package/dist/cdk/constructs/components/container/LocalContainerImageAsset.js +32 -0
  16. package/dist/cdk/constructs/components/container/LocalContainerImageAsset.js.map +1 -0
  17. package/dist/cdk/constructs/components/container/index.d.ts +2 -0
  18. package/dist/cdk/constructs/components/container/index.d.ts.map +1 -1
  19. package/dist/cdk/constructs/components/container/index.js +6 -1
  20. package/dist/cdk/constructs/components/container/index.js.map +1 -1
  21. package/dist/cdk/constructs/components/container/workload-build-metadata.d.ts +17 -0
  22. package/dist/cdk/constructs/components/container/workload-build-metadata.d.ts.map +1 -0
  23. package/dist/cdk/constructs/components/container/workload-build-metadata.js +30 -0
  24. package/dist/cdk/constructs/components/container/workload-build-metadata.js.map +1 -0
  25. package/dist/cdk/constructs/components/primitives/harness/AgentCoreHarnessRole.d.ts +2 -0
  26. package/dist/cdk/constructs/components/primitives/harness/AgentCoreHarnessRole.d.ts.map +1 -1
  27. package/dist/cdk/constructs/components/primitives/harness/AgentCoreHarnessRole.js +12 -11
  28. package/dist/cdk/constructs/components/primitives/harness/AgentCoreHarnessRole.js.map +1 -1
  29. package/dist/cdk/constructs/components/primitives/runtime/AgentCoreRuntime.d.ts +1 -1
  30. package/dist/cdk/constructs/components/primitives/runtime/AgentCoreRuntime.d.ts.map +1 -1
  31. package/dist/cdk/constructs/components/primitives/runtime/AgentCoreRuntime.js +3 -2
  32. package/dist/cdk/constructs/components/primitives/runtime/AgentCoreRuntime.js.map +1 -1
  33. package/dist/cdk/constructs/index.d.ts +3 -1
  34. package/dist/cdk/constructs/index.d.ts.map +1 -1
  35. package/dist/cdk/constructs/index.js +6 -1
  36. package/dist/cdk/constructs/index.js.map +1 -1
  37. package/dist/cdk/constructs/l3/AgentCoreApplication.d.ts.map +1 -1
  38. package/dist/cdk/constructs/l3/AgentCoreApplication.js +1 -0
  39. package/dist/cdk/constructs/l3/AgentCoreApplication.js.map +1 -1
  40. package/dist/cdk/constructs/l3/AgentCoreHarnessEnvironment.d.ts +9 -0
  41. package/dist/cdk/constructs/l3/AgentCoreHarnessEnvironment.d.ts.map +1 -1
  42. package/dist/cdk/constructs/l3/AgentCoreHarnessEnvironment.js +62 -25
  43. package/dist/cdk/constructs/l3/AgentCoreHarnessEnvironment.js.map +1 -1
  44. package/dist/cdk/constructs/l3/RuntimeEnvironment.d.ts.map +1 -1
  45. package/dist/cdk/constructs/l3/RuntimeEnvironment.js +21 -0
  46. package/dist/cdk/constructs/l3/RuntimeEnvironment.js.map +1 -1
  47. package/dist/cdk/constructs/l3/index.d.ts +1 -1
  48. package/dist/cdk/constructs/l3/index.d.ts.map +1 -1
  49. package/dist/cdk/constructs/l3/index.js.map +1 -1
  50. package/dist/cdk/index.d.ts +1 -1
  51. package/dist/cdk/index.d.ts.map +1 -1
  52. package/dist/cdk/index.js +4 -1
  53. package/dist/cdk/index.js.map +1 -1
  54. package/dist/index.d.ts +1 -1
  55. package/dist/index.d.ts.map +1 -1
  56. package/dist/index.js +4 -1
  57. package/dist/index.js.map +1 -1
  58. package/dist/schema/schemas/agent-env.d.ts +4 -0
  59. package/dist/schema/schemas/agent-env.d.ts.map +1 -1
  60. package/dist/schema/schemas/agent-env.js +12 -5
  61. package/dist/schema/schemas/agent-env.js.map +1 -1
  62. package/dist/schema/schemas/agentcore-project.d.ts +1 -0
  63. package/dist/schema/schemas/agentcore-project.d.ts.map +1 -1
  64. package/dist/schema/schemas/primitives/harness.d.ts +21 -0
  65. package/dist/schema/schemas/primitives/harness.d.ts.map +1 -1
  66. package/dist/schema/schemas/primitives/harness.js +38 -10
  67. package/dist/schema/schemas/primitives/harness.js.map +1 -1
  68. package/package.json +1 -1
package/README.md CHANGED
@@ -382,6 +382,55 @@ new AgentCoreApplication(this, 'App', {
382
382
 
383
383
  See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information.
384
384
 
385
+ ## Container build context
386
+
387
+ Runtime and Harness container builds (`Container` and `ContainerLocal`) filter the build context the same way, in this
388
+ order (last match wins):
389
+
390
+ 1. Default exclusions: `.env`, `.git`, `node_modules`, and similar; the AgentCore CLI state (`agentcore/.cli`, at any
391
+ depth); and directories named `cdk.out` (at any depth).
392
+ 2. The Docker ignore file. As in Docker, it is `<Dockerfile>.dockerignore` (next to the Dockerfile) when it exists, and
393
+ the build context's `.dockerignore` otherwise. `!pattern` lines can re-include paths excluded by step 1, for example
394
+ `!src/cdk.out` for a source directory that happens to be named `cdk.out`.
395
+ 3. The Dockerfile itself is always kept. This does not re-include other files in its directory.
396
+ 4. The CDK app's output directory, when it is inside the build context, is always excluded. No `!pattern` can re-include
397
+ it, because staging a context that contains the cloud assembly would copy the assembly into itself.
398
+
399
+ Symlinks are handled differently by the two build types:
400
+
401
+ - `ContainerLocal`: symlinks are staged as links, as `docker build` sends them, so a link pointing outside the build
402
+ context is not followed and the file it points to is not part of the build.
403
+ - `Container` (CodeBuild): the uploaded S3 asset follows symlinks, as before. A link to a file outside the build context
404
+ is uploaded with that file's content, and changing that file changes the asset hash and rebuilds the image. Remove
405
+ such links if their targets must not leave the machine.
406
+
407
+ Harness build contexts were previously uploaded unfiltered, so the first deploy after upgrading may rebuild the Harness
408
+ image once. Old vended Harness apps that build their own image (no `hasDockerfile`) are unchanged. Likewise, a Runtime
409
+ `Container` build context that contains `agentcore/.cli` or a `cdk.out` directory no longer uploads those paths, so its
410
+ asset hash changes and its image is rebuilt once on the next deploy.
411
+
412
+ ## Local container builds
413
+
414
+ Runtimes and Harnesses with a Dockerfile can set `build: 'ContainerLocal'` to build the image on the machine running
415
+ `cdk deploy` instead of in CodeBuild. Harness `build` is optional and defaults to `Container` (CodeBuild).
416
+
417
+ - The image is a CDK `DockerImageAsset` built for `linux/arm64`. The CDK Toolkit builds it and pushes it to the CDK
418
+ bootstrap ECR repository. Docker (or a compatible tool) must be available where you deploy.
419
+ - No CodeBuild project, S3 source asset, image-builder custom resource, per-workload ECR repository, or KMS key is
420
+ created. VPC build settings (`networkConfig.vpcId`, the 5 security group limit) do not apply.
421
+ - The build context is filtered the same way as `Container` builds. Runtime uses `buildContextPath ?? codeLocation`;
422
+ Harness uses its directory or a project-relative `buildContextPath`. Unlike `Container`, a relative context directory
423
+ is an error.
424
+ - `customDockerBuildArgs` are passed to `docker build`. They are not secret and can appear in the image.
425
+ - The execution role gets pull access to the bootstrap repository by ARN. That repository is shared with other CDK
426
+ assets in the account and region. Imported execution roles need their own pull permissions.
427
+ - Each workload's build type is recorded in the template metadata under `agentcore:builds` (`runtime/<name>`,
428
+ `harness/<name>`). The CLI uses this to block switching an already-deployed workload between `ContainerLocal` and
429
+ another build type. Direct CDK users should avoid that switch as well.
430
+ - Each `ContainerLocal` workload's image asset hash is recorded under `agentcore:localImages`, with the same keys. The
431
+ hash is the image's key under `dockerImages` in the stack's asset manifest. The metadata key constants and the
432
+ `WorkloadBuildMode` and `WorkloadKey` types are exported from the package root.
433
+
385
434
  ## License
386
435
 
387
436
  This project is licensed under the Apache-2.0 License.
@@ -21,17 +21,21 @@ export interface ContainerSourceAssetProps {
21
21
  * `codeLocation`.
22
22
  *
23
23
  * The uploaded context's `exclude` list (evaluated with `IgnoreMode.DOCKER`, last match wins) layers:
24
- * 1. {@link CONTAINER_CONTEXT_SECRET_EXCLUDES} — an unconditional secret/junk baseline applied to
25
- * BOTH `codeLocation` and `buildContextPath` builds, so a stray `.env` / `.git` / `node_modules`
26
- * is never persisted to the assets bucket or baked into the image (mirrors the CodeZip guard);
27
- * 2. the user's own build-context-root `.dockerignore`, so they can exclude more or re-include a
28
- * baseline path with a `!pattern` line;
29
- * 3. {@link forceKeepDockerfilePatterns} — a force-keep of the Dockerfile (+ ancestor dirs) so an
30
- * allowlist-style `.dockerignore` can't drop the file CodeBuild builds with.
24
+ * 1. the baseline excludes: `.env`, `.git`, `node_modules`, and other private or generated files, the
25
+ * AgentCore CLI state (`agentcore/.cli`, at any depth), and directories named `cdk.out`;
26
+ * 2. the user's Docker ignore file: `<Dockerfile>.dockerignore` when it exists, otherwise the
27
+ * build context's `.dockerignore`. Users can exclude more or re-include a layer 1 path with
28
+ * a `!pattern` line;
29
+ * 3. a force-keep of the Dockerfile itself (not its parent directories) so an allowlist-style
30
+ * ignore file can't drop the file CodeBuild builds with;
31
+ * 4. the CDK app's output directory when it is inside the context. No `!pattern` can re-include it:
32
+ * staging the cloud assembly into itself fails synth with ENAMETOOLONG.
31
33
  *
32
- * NOTE: applying the baseline unconditionally changes the asset hash for pre-existing container stacks
33
- * (which previously uploaded the raw directory), so the first deploy after upgrade re-uploads the
34
- * context and rebuilds the image once. This is intentional — it is what closes the secret-leak.
34
+ * Symlinks keep the S3 asset default: the asset follows them, so a link to a file outside the context
35
+ * uploads that file's content, and the asset hash covers the target's content (changing the target
36
+ * rebuilds the image). Unlike `ContainerLocal`, this does not match `docker build`, which sends the
37
+ * link itself. Changes to the exclude rules change the asset hash of an affected context, which
38
+ * rebuilds its image once on the next deploy.
35
39
  *
36
40
  * Unlike BundledCodeZipAsset which packages code into a zip with dependencies, this uploads the
37
41
  * directory as-is; CodeBuild uses the Dockerfile within it to build the container image.
@@ -1 +1 @@
1
- {"version":3,"file":"ContainerSourceAsset.d.ts","sourceRoot":"","sources":["../../../../../src/cdk/constructs/bundling/container/ContainerSourceAsset.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAIvC,MAAM,WAAW,yBAAyB;IACxC;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAE9B;;;OAGG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAsCD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAAa,oBAAqB,SAAQ,SAAS;IACjD;;OAEG;IACH,SAAgB,KAAK,EAAE,KAAK,CAAC;gBAEjB,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,yBAAyB;CAmB3E"}
1
+ {"version":3,"file":"ContainerSourceAsset.d.ts","sourceRoot":"","sources":["../../../../../src/cdk/constructs/bundling/container/ContainerSourceAsset.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGvD,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,MAAM,WAAW,yBAAyB;IACxC;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAE9B;;;OAGG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,qBAAa,oBAAqB,SAAQ,SAAS;IACjD;;OAEG;IACH,SAAgB,KAAK,EAAE,KAAK,CAAC;gBAEjB,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,yBAAyB;CAe3E"}
@@ -2,45 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ContainerSourceAsset = void 0;
4
4
  const lib_1 = require("../../../../lib");
5
+ const build_context_1 = require("./build-context");
5
6
  const aws_cdk_lib_1 = require("aws-cdk-lib");
6
7
  const aws_s3_assets_1 = require("aws-cdk-lib/aws-s3-assets");
7
8
  const constructs_1 = require("constructs");
8
- const fs_1 = require("fs");
9
- const path_1 = require("path");
10
- /**
11
- * Read the `.dockerignore` at the build-context root and return its patterns (comments and blank
12
- * lines stripped). Paired with `IgnoreMode.DOCKER` on the `Asset`, this makes the uploaded deploy
13
- * context honor exactly what a local `docker build` from the same context would — the CDK `Asset`
14
- * does not read `.dockerignore` on its own. Returns `[]` when there is no `.dockerignore`.
15
- */
16
- function readDockerignorePatterns(contextRoot) {
17
- const dockerignorePath = (0, path_1.join)(contextRoot, '.dockerignore');
18
- if (!(0, fs_1.existsSync)(dockerignorePath)) {
19
- return [];
20
- }
21
- return (0, fs_1.readFileSync)(dockerignorePath, 'utf-8')
22
- .split(/\r?\n/)
23
- .map(line => line.trim())
24
- .filter(line => line.length > 0 && !line.startsWith('#'));
25
- }
26
- /**
27
- * Force-keep the Dockerfile (and each of its ancestor directories) so an allowlist-style
28
- * `.dockerignore` (`*` then `!keep`) — or any baseline/user pattern — can never drop the very file
29
- * CodeBuild builds with (`-f`). Docker will not re-include a file whose parent directory is excluded,
30
- * so each ancestor segment is negated too. Emitted last; in Docker semantics the last matching pattern
31
- * wins, so these negations override any preceding exclude.
32
- */
33
- function forceKeepDockerfilePatterns(dockerfileRelPath) {
34
- const segments = dockerfileRelPath.split('/').filter(segment => segment.length > 0);
35
- const patterns = [];
36
- for (let i = 1; i < segments.length; i++) {
37
- patterns.push(`!${segments.slice(0, i).join('/')}`);
38
- }
39
- if (segments.length > 0) {
40
- patterns.push(`!${segments.join('/')}`);
41
- }
42
- return patterns;
43
- }
44
9
  /**
45
10
  * Packages the Docker build context (including the Dockerfile) as an S3 asset for CodeBuild.
46
11
  *
@@ -50,17 +15,21 @@ function forceKeepDockerfilePatterns(dockerfileRelPath) {
50
15
  * `codeLocation`.
51
16
  *
52
17
  * The uploaded context's `exclude` list (evaluated with `IgnoreMode.DOCKER`, last match wins) layers:
53
- * 1. {@link CONTAINER_CONTEXT_SECRET_EXCLUDES} — an unconditional secret/junk baseline applied to
54
- * BOTH `codeLocation` and `buildContextPath` builds, so a stray `.env` / `.git` / `node_modules`
55
- * is never persisted to the assets bucket or baked into the image (mirrors the CodeZip guard);
56
- * 2. the user's own build-context-root `.dockerignore`, so they can exclude more or re-include a
57
- * baseline path with a `!pattern` line;
58
- * 3. {@link forceKeepDockerfilePatterns} — a force-keep of the Dockerfile (+ ancestor dirs) so an
59
- * allowlist-style `.dockerignore` can't drop the file CodeBuild builds with.
18
+ * 1. the baseline excludes: `.env`, `.git`, `node_modules`, and other private or generated files, the
19
+ * AgentCore CLI state (`agentcore/.cli`, at any depth), and directories named `cdk.out`;
20
+ * 2. the user's Docker ignore file: `<Dockerfile>.dockerignore` when it exists, otherwise the
21
+ * build context's `.dockerignore`. Users can exclude more or re-include a layer 1 path with
22
+ * a `!pattern` line;
23
+ * 3. a force-keep of the Dockerfile itself (not its parent directories) so an allowlist-style
24
+ * ignore file can't drop the file CodeBuild builds with;
25
+ * 4. the CDK app's output directory when it is inside the context. No `!pattern` can re-include it:
26
+ * staging the cloud assembly into itself fails synth with ENAMETOOLONG.
60
27
  *
61
- * NOTE: applying the baseline unconditionally changes the asset hash for pre-existing container stacks
62
- * (which previously uploaded the raw directory), so the first deploy after upgrade re-uploads the
63
- * context and rebuilds the image once. This is intentional — it is what closes the secret-leak.
28
+ * Symlinks keep the S3 asset default: the asset follows them, so a link to a file outside the context
29
+ * uploads that file's content, and the asset hash covers the target's content (changing the target
30
+ * rebuilds the image). Unlike `ContainerLocal`, this does not match `docker build`, which sends the
31
+ * link itself. Changes to the exclude rules change the asset hash of an affected context, which
32
+ * rebuilds its image once on the next deploy.
64
33
  *
65
34
  * Unlike BundledCodeZipAsset which packages code into a zip with dependencies, this uploads the
66
35
  * directory as-is; CodeBuild uses the Dockerfile within it to build the container image.
@@ -75,11 +44,7 @@ class ContainerSourceAsset extends constructs_1.Construct {
75
44
  const buildContext = props.config.buildContextPath ?? props.config.codeLocation;
76
45
  const resolvedBuildContext = (0, lib_1.resolveCodeLocation)(buildContext, props.configRoot);
77
46
  const dockerfileRelPath = props.config.dockerfile ?? 'Dockerfile';
78
- const exclude = [
79
- ...lib_1.CONTAINER_CONTEXT_SECRET_EXCLUDES,
80
- ...readDockerignorePatterns(resolvedBuildContext),
81
- ...forceKeepDockerfilePatterns(dockerfileRelPath),
82
- ];
47
+ const { exclude } = (0, build_context_1.containerBuildContext)(this, resolvedBuildContext, { dockerfile: dockerfileRelPath });
83
48
  this.asset = new aws_s3_assets_1.Asset(this, 'SourceAsset', {
84
49
  path: resolvedBuildContext,
85
50
  exclude,
@@ -1 +1 @@
1
- {"version":3,"file":"ContainerSourceAsset.js","sourceRoot":"","sources":["../../../../../src/cdk/constructs/bundling/container/ContainerSourceAsset.ts"],"names":[],"mappings":";;;AAAA,yCAAyF;AAEzF,6CAAyC;AACzC,6DAAkD;AAClD,2CAAuC;AACvC,2BAA8C;AAC9C,+BAA4B;AAe5B;;;;;GAKG;AACH,SAAS,wBAAwB,CAAC,WAAmB;IACnD,MAAM,gBAAgB,GAAG,IAAA,WAAI,EAAC,WAAW,EAAE,eAAe,CAAC,CAAC;IAC5D,IAAI,CAAC,IAAA,eAAU,EAAC,gBAAgB,CAAC,EAAE,CAAC;QAClC,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,OAAO,IAAA,iBAAY,EAAC,gBAA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,CAAC,YAAY,CAAC;QAChF,MAAM,oBAAoB,GAAG,IAAA,yBAAmB,EAAC,YAAY,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;QACjF,MAAM,iBAAiB,GAAG,KAAK,CAAC,MAAM,CAAC,UAAU,IAAI,YAAY,CAAC;QAElE,MAAM,OAAO,GAAG;YACd,GAAG,uCAAiC;YACpC,GAAG,wBAAwB,CAAC,oBAAoB,CAAC;YACjD,GAAG,2BAA2B,CAAC,iBAAiB,CAAC;SAClD,CAAC;QAEF,IAAI,CAAC,KAAK,GAAG,IAAI,qBAAK,CAAC,IAAI,EAAE,aAAa,EAAE;YAC1C,IAAI,EAAE,oBAAoB;YAC1B,OAAO;YACP,UAAU,EAAE,wBAAU,CAAC,MAAM;SAC9B,CAAC,CAAC;IACL,CAAC;CACF;AAzBD,oDAyBC"}
1
+ {"version":3,"file":"ContainerSourceAsset.js","sourceRoot":"","sources":["../../../../../src/cdk/constructs/bundling/container/ContainerSourceAsset.ts"],"names":[],"mappings":";;;AAAA,yCAAsD;AAEtD,mDAAwD;AACxD,6CAAyC;AACzC,6DAAkD;AAClD,2CAAuC;AAevC;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAa,oBAAqB,SAAQ,sBAAS;IACjD;;OAEG;IACa,KAAK,CAAQ;IAE7B,YAAY,KAAgB,EAAE,EAAU,EAAE,KAAgC;QACxE,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAEjB,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,gBAAgB,IAAI,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC;QAChF,MAAM,oBAAoB,GAAG,IAAA,yBAAmB,EAAC,YAAY,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;QACjF,MAAM,iBAAiB,GAAG,KAAK,CAAC,MAAM,CAAC,UAAU,IAAI,YAAY,CAAC;QAElE,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,qCAAqB,EAAC,IAAI,EAAE,oBAAoB,EAAE,EAAE,UAAU,EAAE,iBAAiB,EAAE,CAAC,CAAC;QAEzG,IAAI,CAAC,KAAK,GAAG,IAAI,qBAAK,CAAC,IAAI,EAAE,aAAa,EAAE;YAC1C,IAAI,EAAE,oBAAoB;YAC1B,OAAO;YACP,UAAU,EAAE,wBAAU,CAAC,MAAM;SAC9B,CAAC,CAAC;IACL,CAAC;CACF;AArBD,oDAqBC"}
@@ -0,0 +1,36 @@
1
+ import type { Construct } from 'constructs';
2
+ export interface ContainerBuildContextOptions {
3
+ /** Dockerfile path relative to the build context. @default 'Dockerfile' */
4
+ readonly dockerfile?: string;
5
+ /**
6
+ * `'strict'` turns a relative context directory into an error instead of a warning. New
7
+ * `ContainerLocal` builds use it because they have no existing users to keep working.
8
+ * @default 'warn'
9
+ */
10
+ readonly validation?: 'strict' | 'warn';
11
+ }
12
+ /**
13
+ * Resolve the ordered context filters for a container build: the baseline excludes (secrets, CLI
14
+ * state, `cdk.out` directories), then the Docker ignore file, then a force-keep of the Dockerfile,
15
+ * then the app's output directory when it is inside the context, which the ignore file cannot
16
+ * override: staging a context that contains the cloud assembly copies the assembly into itself and
17
+ * fails synth with ENAMETOOLONG. As in Docker (BuildKit), the ignore file is
18
+ * `<Dockerfile>.dockerignore` when it exists and the context's `.dockerignore` otherwise. Only the
19
+ * Dockerfile itself is force-kept, not its parent directories: re-including a parent would also
20
+ * re-include excluded siblings such as `docker/.env`. Under `IgnoreMode.DOCKER`, CDK still walks
21
+ * into an excluded parent to find the force-kept file. A relative context directory resolves
22
+ * against the working directory and emits a warning on `scope` (an error with `validation: 'strict'`).
23
+ */
24
+ export declare function containerBuildContext(scope: Construct, directory: string, options?: ContainerBuildContextOptions): {
25
+ directory: string;
26
+ dockerfile: string;
27
+ exclude: string[];
28
+ };
29
+ /** Build args as an object with sorted keys, for `DockerImageAsset.buildArgs`. */
30
+ export declare function sortedBuildArgs(args?: Record<string, string>): Record<string, string> | undefined;
31
+ /**
32
+ * Build args as JSON with sorted keys, for the CodeBuild image tag and the custom resource's
33
+ * `BuildArgs` property. The build Lambda `JSON.parse`s it back into a name-to-value map.
34
+ */
35
+ export declare function serializeBuildArgs(args?: Record<string, string>): string;
36
+ //# sourceMappingURL=build-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-context.d.ts","sourceRoot":"","sources":["../../../../../src/cdk/constructs/bundling/container/build-context.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAiB5C,MAAM,WAAW,4BAA4B;IAC3C,2EAA2E;IAC3E,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;CACzC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,GAAE,4BAAiC;;;;EA+CpH;AAOD,kFAAkF;AAClF,wBAAgB,eAAe,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAEjG;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAKxE"}
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.containerBuildContext = containerBuildContext;
4
+ exports.sortedBuildArgs = sortedBuildArgs;
5
+ exports.serializeBuildArgs = serializeBuildArgs;
6
+ const lib_1 = require("../../../../lib");
7
+ const aws_cdk_lib_1 = require("aws-cdk-lib");
8
+ const fs_1 = require("fs");
9
+ const path_1 = require("path");
10
+ /**
11
+ * AgentCore CLI state under the project's `agentcore/` directory, at the context root or nested (for a
12
+ * context above the project). Excluded by default; a user `!pattern` can re-include it.
13
+ */
14
+ const CLI_STATE_EXCLUDES = ['agentcore/.cli', '**/agentcore/.cli'];
15
+ /**
16
+ * Directories named `cdk.out`, including the project's own `agentcore/cdk/cdk.out`. Excluded by default; a
17
+ * user `!pattern` can re-include one (for example a source directory that happens to be named `cdk.out`).
18
+ * The app's actual output directory is excluded separately and cannot be re-included.
19
+ */
20
+ const CDK_OUTPUT_EXCLUDES = ['cdk.out', '**/cdk.out'];
21
+ /**
22
+ * Resolve the ordered context filters for a container build: the baseline excludes (secrets, CLI
23
+ * state, `cdk.out` directories), then the Docker ignore file, then a force-keep of the Dockerfile,
24
+ * then the app's output directory when it is inside the context, which the ignore file cannot
25
+ * override: staging a context that contains the cloud assembly copies the assembly into itself and
26
+ * fails synth with ENAMETOOLONG. As in Docker (BuildKit), the ignore file is
27
+ * `<Dockerfile>.dockerignore` when it exists and the context's `.dockerignore` otherwise. Only the
28
+ * Dockerfile itself is force-kept, not its parent directories: re-including a parent would also
29
+ * re-include excluded siblings such as `docker/.env`. Under `IgnoreMode.DOCKER`, CDK still walks
30
+ * into an excluded parent to find the force-kept file. A relative context directory resolves
31
+ * against the working directory and emits a warning on `scope` (an error with `validation: 'strict'`).
32
+ */
33
+ function containerBuildContext(scope, directory, options = {}) {
34
+ const dockerfile = options.dockerfile ?? 'Dockerfile';
35
+ if (!(0, path_1.isAbsolute)(directory)) {
36
+ if (options.validation === 'strict')
37
+ throw new Error(`The container build context "${directory}" must be an absolute path.`);
38
+ aws_cdk_lib_1.Annotations.of(scope).addWarningV2('@aws/agentcore-cdk:containerRelativeBuildContext', `The container build context "${directory}" is relative and resolves against the working directory. Use an absolute path.`);
39
+ }
40
+ const root = (0, path_1.resolve)(directory);
41
+ const file = (0, path_1.relative)(root, (0, path_1.resolve)(root, dockerfile)).replaceAll('\\', '/');
42
+ if ((0, path_1.isAbsolute)(dockerfile) || file === '..' || file.startsWith('../')) {
43
+ throw new Error('The Dockerfile must be relative to and inside the build context.');
44
+ }
45
+ if ((0, fs_1.existsSync)((0, path_1.join)(root, file)) && !(0, fs_1.statSync)((0, path_1.join)(root, file)).isFile()) {
46
+ throw new Error(`The Dockerfile path must name a file: ${(0, path_1.join)(root, file)}`);
47
+ }
48
+ const dockerfileIgnore = `${file}.dockerignore`;
49
+ const usesDockerfileIgnore = (0, fs_1.existsSync)((0, path_1.join)(root, dockerfileIgnore));
50
+ const ignorePath = (0, path_1.join)(root, usesDockerfileIgnore ? dockerfileIgnore : '.dockerignore');
51
+ const patterns = (0, fs_1.existsSync)(ignorePath)
52
+ ? (0, fs_1.readFileSync)(ignorePath, 'utf8')
53
+ .split(/\r?\n/)
54
+ .map(line => line.trim())
55
+ .filter(line => line.length > 0 && !line.startsWith('#'))
56
+ : [];
57
+ // Keep the Dockerfile-specific ignore file so the build applies the same rules to the staged context.
58
+ const keep = [`!${file}`, ...(usesDockerfileIgnore ? [`!${dockerfileIgnore}`] : [])];
59
+ // The app's output directory, relative to the context. Excluded last when inside it, so no `!pattern` re-includes it.
60
+ const outdir = aws_cdk_lib_1.App.of(scope)?.outdir ?? aws_cdk_lib_1.Stage.of(scope)?.outdir;
61
+ const assembly = outdir ? (0, path_1.relative)(root, (0, path_1.resolve)(outdir)).replaceAll('\\', '/') : '';
62
+ const assemblyInContext = assembly && !(0, path_1.isAbsolute)(assembly) && assembly !== '..' && !assembly.startsWith('../');
63
+ // Match the directory literally: escape the pattern characters (and a leading `!`) a path can contain.
64
+ const assemblyPattern = assembly.replace(/[\\*?[\]{}!]/g, '\\$&');
65
+ return {
66
+ directory: root,
67
+ dockerfile: file,
68
+ exclude: [
69
+ ...lib_1.CONTAINER_CONTEXT_SECRET_EXCLUDES,
70
+ ...CLI_STATE_EXCLUDES,
71
+ ...CDK_OUTPUT_EXCLUDES,
72
+ ...patterns,
73
+ ...keep,
74
+ ...(assemblyInContext ? [assemblyPattern] : []),
75
+ ],
76
+ };
77
+ }
78
+ /** Build-arg names in a stable order, so reordering them in the config never changes an image hash or tag. */
79
+ function sortedBuildArgKeys(args) {
80
+ return Object.keys(args).sort();
81
+ }
82
+ /** Build args as an object with sorted keys, for `DockerImageAsset.buildArgs`. */
83
+ function sortedBuildArgs(args) {
84
+ return args && Object.fromEntries(sortedBuildArgKeys(args).map(key => [key, args[key]]));
85
+ }
86
+ /**
87
+ * Build args as JSON with sorted keys, for the CodeBuild image tag and the custom resource's
88
+ * `BuildArgs` property. The build Lambda `JSON.parse`s it back into a name-to-value map.
89
+ */
90
+ function serializeBuildArgs(args) {
91
+ // The replacer-array form emits only the listed keys, in that order. Build-arg values are strings,
92
+ // so there are no nested objects for the replacer to prune.
93
+ const safe = args ?? {};
94
+ return JSON.stringify(safe, sortedBuildArgKeys(safe));
95
+ }
96
+ //# sourceMappingURL=build-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-context.js","sourceRoot":"","sources":["../../../../../src/cdk/constructs/bundling/container/build-context.ts"],"names":[],"mappings":";;AA0CA,sDA+CC;AAQD,0CAEC;AAMD,gDAKC;AA9GD,yCAAoE;AACpE,6CAAsD;AAEtD,2BAAwD;AACxD,+BAA2D;AAE3D;;;GAGG;AACH,MAAM,kBAAkB,GAAG,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,CAAC;AAEnE;;;;GAIG;AACH,MAAM,mBAAmB,GAAG,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;AAatD;;;;;;;;;;;GAWG;AACH,SAAgB,qBAAqB,CAAC,KAAgB,EAAE,SAAiB,EAAE,UAAwC,EAAE;IACnH,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,YAAY,CAAC;IACtD,IAAI,CAAC,IAAA,iBAAU,EAAC,SAAS,CAAC,EAAE,CAAC;QAC3B,IAAI,OAAO,CAAC,UAAU,KAAK,QAAQ;YACjC,MAAM,IAAI,KAAK,CAAC,gCAAgC,SAAS,6BAA6B,CAAC,CAAC;QAC1F,yBAAW,CAAC,EAAE,CAAC,KAAK,CAAC,CAA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KACF,CAAC;AACJ,CAAC;AAED,8GAA8G;AAC9G,SAAS,kBAAkB,CAAC,IAA4B;IACtD,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;AAClC,CAAC;AAED,kFAAkF;AAClF,SAAgB,eAAe,CAAC,IAA6B;IAC3D,OAAO,IAAI,IAAI,MAAM,CAAC,WAAW,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAE,CAAC,CAAC,CAAC,CAAC;AAC5F,CAAC;AAED;;;GAGG;AACH,SAAgB,kBAAkB,CAAC,IAA6B;IAC9D,mGAAmG;IACnG,4DAA4D;IAC5D,MAAM,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;IACxB,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC;AACxD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ContainerImageBuilder.d.ts","sourceRoot":"","sources":["../../../../../src/cdk/constructs/components/container/ContainerImageBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAKjE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGvC,MAAM,WAAW,0BAA0B;IACzC;;OAEG;IACH,YAAY,EAAE,qBAAqB,CAAC;IAEpC;;OAEG;IACH,WAAW,EAAE;QAAE,KAAK,EAAE,KAAK,CAAA;KAAE,CAAC;IAE9B;;OAEG;IACH,UAAU,EAAE,mBAAmB,CAAC;IAEhC;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEnC;;;;OAIG;IACH,aAAa,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,EAAE,CAAC;QAAC,cAAc,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;CACjE;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,qBAAsB,SAAQ,SAAS;IAClD,SAAgB,YAAY,EAAE,MAAM,CAAC;gBAEzB,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,0BAA0B;CAkE5E"}
1
+ {"version":3,"file":"ContainerImageBuilder.d.ts","sourceRoot":"","sources":["../../../../../src/cdk/constructs/components/container/ContainerImageBuilder.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAKjE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGvC,MAAM,WAAW,0BAA0B;IACzC;;OAEG;IACH,YAAY,EAAE,qBAAqB,CAAC;IAEpC;;OAEG;IACH,WAAW,EAAE;QAAE,KAAK,EAAE,KAAK,CAAA;KAAE,CAAC;IAE9B;;OAEG;IACH,UAAU,EAAE,mBAAmB,CAAC;IAEhC;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEnC;;;;OAIG;IACH,aAAa,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,EAAE,CAAC;QAAC,cAAc,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;CACjE;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,qBAAsB,SAAQ,SAAS;IAClD,SAAgB,YAAY,EAAE,MAAM,CAAC;gBAEzB,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,0BAA0B;CAkE5E"}
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.ContainerImageBuilder = void 0;
37
+ const build_context_1 = require("../../bundling/container/build-context");
37
38
  const container_build_handler_1 = require("./container-build-handler");
38
39
  const cdk = __importStar(require("aws-cdk-lib"));
39
40
  const iam = __importStar(require("aws-cdk-lib/aws-iam"));
@@ -87,7 +88,7 @@ class ContainerImageBuilder extends constructs_1.Construct {
87
88
  // With no build args the tag is exactly the asset hash, so existing deployments don't churn.
88
89
  const imageTag = hasBuildArgs
89
90
  ? (0, crypto_1.createHash)('sha256')
90
- .update(`${sourceAsset.asset.assetHash}:${canonicalBuildArgs(buildArgs)}`)
91
+ .update(`${sourceAsset.asset.assetHash}:${(0, build_context_1.serializeBuildArgs)(buildArgs)}`)
91
92
  .digest('hex')
92
93
  : sourceAsset.asset.assetHash;
93
94
  const imageUri = `${repository.repository.repositoryUri}:${imageTag}`;
@@ -104,25 +105,11 @@ class ContainerImageBuilder extends constructs_1.Construct {
104
105
  // Only emitted when set, so existing container stacks (no build args) see no property change.
105
106
  // Canonicalized (keys sorted) so merely reordering build-arg keys doesn't change the property
106
107
  // and trigger a no-op rebuild — matching the order-insensitive image tag.
107
- ...(hasBuildArgs && { BuildArgs: canonicalBuildArgs(buildArgs) }),
108
+ ...(hasBuildArgs && { BuildArgs: (0, build_context_1.serializeBuildArgs)(buildArgs) }),
108
109
  },
109
110
  });
110
111
  this.containerUri = cr.getAttString('ContainerUri');
111
112
  }
112
113
  }
113
114
  exports.ContainerImageBuilder = ContainerImageBuilder;
114
- /**
115
- * Deterministic JSON serialization of build args with keys sorted, used both for folding into the
116
- * image tag and for the custom-resource BuildArgs property. Key order in the source config must not
117
- * change the output (no spurious rebuild); a changed name or value must. Emitted as a JSON object so
118
- * the build Lambda can `JSON.parse` it straight back into a name->value map.
119
- */
120
- function canonicalBuildArgs(args) {
121
- // The replacer-array form of JSON.stringify emits only the listed keys, in the array's order, so
122
- // sorting the keys yields a canonical (order-insensitive) serialization in one call. Safe here
123
- // because build-arg values are strings (BuildArgValueSchema) — no nested objects for the replacer
124
- // to prune.
125
- const safe = args ?? {};
126
- return JSON.stringify(safe, Object.keys(safe).sort());
127
- }
128
115
  //# sourceMappingURL=ContainerImageBuilder.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ContainerImageBuilder.js","sourceRoot":"","sources":["../../../../../src/cdk/constructs/components/container/ContainerImageBuilder.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,uEAAyE;AACzE,iDAAmC;AACnC,yDAA2C;AAC3C,+DAAiD;AAEjD,2CAAuC;AACvC,mCAAoC;AAwCpC;;;;;;;;;;;GAWG;AACH,MAAa,qBAAsB,SAAQ,sBAAS;IAClC,YAAY,CAAS;IAErC,YAAY,KAAgB,EAAE,EAAU,EAAE,KAAiC;QACzE,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAEjB,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;QAC/E,MAAM,YAAY,GAAG,SAAS,KAAK,SAAS,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;QAElF,MAAM,OAAO,GAAG,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,uBAAuB,EAAE;YACjE,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,WAAW;YACnC,OAAO,EAAE,eAAe;YACxB,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,sDAA4B,CAAC;YAC1D,OAAO,EAAE,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;YACjC,UA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AY,CAAC,OAAO,CAAC,WAAW;gBAC7C,YAAY,EAAE,WAAW,CAAC,KAAK,CAAC,YAAY;gBAC5C,SAAS,EAAE,WAAW,CAAC,KAAK,CAAC,WAAW;gBACxC,QAAQ,EAAE,QAAQ;gBAClB,cAAc,EAAE,UAAU;gBAC1B,WAAW,EAAE,GAAG,GAAG,CAAC,GAAG,CAAC,UAAU,YAAY,GAAG,CAAC,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,GAAG,CAAC,UAAU,EAAE;gBACpF,UAAU,EAAE,WAAW,CAAC,KAAK,CAAC,SAAS;gBACvC,8FAA8F;gBAC9F,8FAA8F;gBAC9F,0EAA0E;gBAC1E,GAAG,CAAC,YAAY,IAAI,EAAE,SAAS,EAAE,kBAAkB,CAAC,SAAS,CAAC,EAAE,CAAC;aAClE;SACF,CAAC,CAAC;QAEH,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC;IACtD,CAAC;CACF;AArED,sDAqEC;AAED;;;;;GAKG;AACH,SAAS,kBAAkB,CAAC,IAAwC;IAClE,iGAAiG;IACjG,+FAA+F;IAC/F,kGAAkG;IAClG,YAAY;IACZ,MAAM,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;IACxB,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;AACxD,CAAC"}
1
+ {"version":3,"file":"ContainerImageBuilder.js","sourceRoot":"","sources":["../../../../../src/cdk/constructs/components/container/ContainerImageBuilder.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0EAA4E;AAG5E,uEAAyE;AACzE,iDAAmC;AACnC,yDAA2C;AAC3C,+DAAiD;AAEjD,2CAAuC;AACvC,mCAAoC;AAwCpC;;;;;;;;;;;GAWG;AACH,MAAa,qBAAsB,SAAQ,sBAAS;IAClC,YAAY,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C;CACF;AArED,sDAqEC"}
@@ -0,0 +1,14 @@
1
+ import type { AgentEnvSpec } from '../../../../schema';
2
+ import { DockerImageAsset } from 'aws-cdk-lib/aws-ecr-assets';
3
+ import { Construct } from 'constructs';
4
+ export interface LocalContainerImageAssetProps {
5
+ /** Resolved context directory; never inferred from the process working directory. */
6
+ readonly directory: string;
7
+ readonly config: Pick<AgentEnvSpec, 'dockerfile' | 'customDockerBuildArgs'>;
8
+ }
9
+ /** Registers an ARM64 image asset. CDK Toolkit builds and publishes it during deployment. */
10
+ export declare class LocalContainerImageAsset extends Construct {
11
+ readonly image: DockerImageAsset;
12
+ constructor(scope: Construct, id: string, props: LocalContainerImageAssetProps);
13
+ }
14
+ //# sourceMappingURL=LocalContainerImageAsset.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LocalContainerImageAsset.d.ts","sourceRoot":"","sources":["../../../../../src/cdk/constructs/components/container/LocalContainerImageAsset.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGvD,OAAO,EAAE,gBAAgB,EAAY,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,MAAM,WAAW,6BAA6B;IAC5C,qFAAqF;IACrF,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,YAAY,EAAE,YAAY,GAAG,uBAAuB,CAAC,CAAC;CAC7E;AAED,6FAA6F;AAC7F,qBAAa,wBAAyB,SAAQ,SAAS;IACrD,SAAgB,KAAK,EAAE,gBAAgB,CAAC;gBAE5B,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,6BAA6B;CAmB/E"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LocalContainerImageAsset = void 0;
4
+ const build_context_1 = require("../../bundling/container/build-context");
5
+ const aws_cdk_lib_1 = require("aws-cdk-lib");
6
+ const aws_ecr_assets_1 = require("aws-cdk-lib/aws-ecr-assets");
7
+ const constructs_1 = require("constructs");
8
+ /** Registers an ARM64 image asset. CDK Toolkit builds and publishes it during deployment. */
9
+ class LocalContainerImageAsset extends constructs_1.Construct {
10
+ image;
11
+ constructor(scope, id, props) {
12
+ super(scope, id);
13
+ const context = (0, build_context_1.containerBuildContext)(this, props.directory, {
14
+ dockerfile: props.config.dockerfile,
15
+ validation: 'strict',
16
+ });
17
+ this.image = new aws_ecr_assets_1.DockerImageAsset(this, 'Image', {
18
+ directory: context.directory,
19
+ file: context.dockerfile,
20
+ platform: aws_ecr_assets_1.Platform.LINUX_ARM64,
21
+ buildArgs: (0, build_context_1.sortedBuildArgs)(props.config.customDockerBuildArgs),
22
+ ignoreMode: aws_cdk_lib_1.IgnoreMode.DOCKER,
23
+ // Stage symlinks as links, as `docker build` does, instead of copying in targets outside the context.
24
+ followSymlinks: aws_cdk_lib_1.SymlinkFollowMode.NEVER,
25
+ // DockerImageAsset prepends the context's .dockerignore. Reset it with `!**` so only our ordered
26
+ // list applies, which uses <Dockerfile>.dockerignore instead when that file exists.
27
+ exclude: ['!**', ...context.exclude],
28
+ });
29
+ }
30
+ }
31
+ exports.LocalContainerImageAsset = LocalContainerImageAsset;
32
+ //# sourceMappingURL=LocalContainerImageAsset.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LocalContainerImageAsset.js","sourceRoot":"","sources":["../../../../../src/cdk/constructs/components/container/LocalContainerImageAsset.ts"],"names":[],"mappings":";;;AACA,0EAAgG;AAChG,6CAA4D;AAC5D,+DAAwE;AACxE,2CAAuC;AAQvC,6FAA6F;AAC7F,MAAa,wBAAyB,SAAQ,sBAAS;IACrC,KAAK,CAAmB;IAExC,YAAY,KAAgB,EAAE,EAAU,EAAE,KAAoC;QAC5E,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACjB,MAAM,OAAO,GAAG,IAAA,qCAAqB,EAAC,IAAI,EAAE,KAAK,CAAC,SAAS,EAAE;YAC3D,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,UAAU;YACnC,UAAU,EAAE,QAAQ;SACrB,CAAC,CAAC;QACH,IAAI,CAAC,KAAK,GAAG,IAAI,iCAAgB,CAAC,IAAI,EAAE,OAAO,EAAE;YAC/C,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,IAAI,EAAE,OAAO,CAAC,UAAU;YACxB,QAAQ,EAAE,yBAAQ,CAAC,WAAW;YAC9B,SAAS,EAAE,IAAA,+BAAe,EAAC,KAAK,CAAC,MAAM,CAAC,qBAAqB,CAAC;YAC9D,UAAU,EAAE,wBAAU,CAAC,MAAM;YAC7B,sGAAsG;YACtG,cAAc,EAAE,+BAAiB,CAAC,KAAK;YACvC,iGAAiG;YACjG,oFAAoF;YACpF,OAAO,EAAE,CAAC,KAAK,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;SACrC,CAAC,CAAC;IACL,CAAC;CACF;AAtBD,4DAsBC"}
@@ -1,4 +1,6 @@
1
1
  export { ContainerRepository, type ContainerRepositoryProps } from './ContainerRepository';
2
2
  export { ContainerBuildProject } from './ContainerBuildProject';
3
3
  export { ContainerImageBuilder, type ContainerImageBuilderProps } from './ContainerImageBuilder';
4
+ export { LocalContainerImageAsset, type LocalContainerImageAssetProps } from './LocalContainerImageAsset';
5
+ export { LOCAL_IMAGES_METADATA_KEY, WORKLOAD_BUILDS_METADATA_KEY, type WorkloadBuildMode, type WorkloadKey, } from './workload-build-metadata';
4
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/cdk/constructs/components/container/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,KAAK,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAC3F,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,KAAK,0BAA0B,EAAE,MAAM,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/cdk/constructs/components/container/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,KAAK,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAC3F,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,KAAK,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AACjG,OAAO,EAAE,wBAAwB,EAAE,KAAK,6BAA6B,EAAE,MAAM,4BAA4B,CAAC;AAC1G,OAAO,EACL,yBAAyB,EACzB,4BAA4B,EAC5B,KAAK,iBAAiB,EACtB,KAAK,WAAW,GACjB,MAAM,2BAA2B,CAAC"}
@@ -1,10 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ContainerImageBuilder = exports.ContainerBuildProject = exports.ContainerRepository = void 0;
3
+ exports.WORKLOAD_BUILDS_METADATA_KEY = exports.LOCAL_IMAGES_METADATA_KEY = exports.LocalContainerImageAsset = exports.ContainerImageBuilder = exports.ContainerBuildProject = exports.ContainerRepository = void 0;
4
4
  var ContainerRepository_1 = require("./ContainerRepository");
5
5
  Object.defineProperty(exports, "ContainerRepository", { enumerable: true, get: function () { return ContainerRepository_1.ContainerRepository; } });
6
6
  var ContainerBuildProject_1 = require("./ContainerBuildProject");
7
7
  Object.defineProperty(exports, "ContainerBuildProject", { enumerable: true, get: function () { return ContainerBuildProject_1.ContainerBuildProject; } });
8
8
  var ContainerImageBuilder_1 = require("./ContainerImageBuilder");
9
9
  Object.defineProperty(exports, "ContainerImageBuilder", { enumerable: true, get: function () { return ContainerImageBuilder_1.ContainerImageBuilder; } });
10
+ var LocalContainerImageAsset_1 = require("./LocalContainerImageAsset");
11
+ Object.defineProperty(exports, "LocalContainerImageAsset", { enumerable: true, get: function () { return LocalContainerImageAsset_1.LocalContainerImageAsset; } });
12
+ var workload_build_metadata_1 = require("./workload-build-metadata");
13
+ Object.defineProperty(exports, "LOCAL_IMAGES_METADATA_KEY", { enumerable: true, get: function () { return workload_build_metadata_1.LOCAL_IMAGES_METADATA_KEY; } });
14
+ Object.defineProperty(exports, "WORKLOAD_BUILDS_METADATA_KEY", { enumerable: true, get: function () { return workload_build_metadata_1.WORKLOAD_BUILDS_METADATA_KEY; } });
10
15
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/cdk/constructs/components/container/index.ts"],"names":[],"mappings":";;;AAAA,6DAA2F;AAAlF,0HAAA,mBAAmB,OAAA;AAC5B,iEAAgE;AAAvD,8HAAA,qBAAqB,OAAA;AAC9B,iEAAiG;AAAxF,8HAAA,qBAAqB,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/cdk/constructs/components/container/index.ts"],"names":[],"mappings":";;;AAAA,6DAA2F;AAAlF,0HAAA,mBAAmB,OAAA;AAC5B,iEAAgE;AAAvD,8HAAA,qBAAqB,OAAA;AAC9B,iEAAiG;AAAxF,8HAAA,qBAAqB,OAAA;AAC9B,uEAA0G;AAAjG,oIAAA,wBAAwB,OAAA;AACjC,qEAKmC;AAJjC,oIAAA,yBAAyB,OAAA;AACzB,uIAAA,4BAA4B,OAAA"}
@@ -0,0 +1,17 @@
1
+ import type { Construct } from 'constructs';
2
+ /** Template metadata key mapping each workload to its build mode. Read by the CLI's migration guard. */
3
+ export declare const WORKLOAD_BUILDS_METADATA_KEY = "agentcore:builds";
4
+ /** Template metadata key mapping each `ContainerLocal` workload to its image asset hash. */
5
+ export declare const LOCAL_IMAGES_METADATA_KEY = "agentcore:localImages";
6
+ /** Every value written under {@link WORKLOAD_BUILDS_METADATA_KEY}. */
7
+ export type WorkloadBuildMode = 'CodeZip' | 'Container' | 'ContainerLocal' | 'ContainerUri' | 'Managed';
8
+ /** A workload's key in the template metadata maps: `runtime/<name>` or `harness/<name>` (spec names). */
9
+ export type WorkloadKey = `runtime/${string}` | `harness/${string}`;
10
+ /** Record a workload's build mode for the CLI's read-only, pre-deployment migration guard. */
11
+ export declare function recordWorkloadBuild(scope: Construct, key: WorkloadKey, build: WorkloadBuildMode): void;
12
+ /**
13
+ * Record a `ContainerLocal` workload's image asset hash, the key of its entry under `dockerImages`
14
+ * in the stack's asset manifest, so the CLI can find the image without parsing construct paths.
15
+ */
16
+ export declare function recordLocalImage(scope: Construct, key: WorkloadKey, assetHash: string): void;
17
+ //# sourceMappingURL=workload-build-metadata.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workload-build-metadata.d.ts","sourceRoot":"","sources":["../../../../../src/cdk/constructs/components/container/workload-build-metadata.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,wGAAwG;AACxG,eAAO,MAAM,4BAA4B,qBAAqB,CAAC;AAC/D,4FAA4F;AAC5F,eAAO,MAAM,yBAAyB,0BAA0B,CAAC;AAEjE,sEAAsE;AACtE,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,WAAW,GAAG,gBAAgB,GAAG,cAAc,GAAG,SAAS,CAAC;AACxG,yGAAyG;AACzG,MAAM,MAAM,WAAW,GAAG,WAAW,MAAM,EAAE,GAAG,WAAW,MAAM,EAAE,CAAC;AAWpE,8FAA8F;AAC9F,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE,iBAAiB,GAAG,IAAI,CAEtG;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAE5F"}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LOCAL_IMAGES_METADATA_KEY = exports.WORKLOAD_BUILDS_METADATA_KEY = void 0;
4
+ exports.recordWorkloadBuild = recordWorkloadBuild;
5
+ exports.recordLocalImage = recordLocalImage;
6
+ const aws_cdk_lib_1 = require("aws-cdk-lib");
7
+ /** Template metadata key mapping each workload to its build mode. Read by the CLI's migration guard. */
8
+ exports.WORKLOAD_BUILDS_METADATA_KEY = 'agentcore:builds';
9
+ /** Template metadata key mapping each `ContainerLocal` workload to its image asset hash. */
10
+ exports.LOCAL_IMAGES_METADATA_KEY = 'agentcore:localImages';
11
+ function recordMetadata(scope, metadataKey, key, value) {
12
+ const stack = aws_cdk_lib_1.Stack.of(scope);
13
+ const metadata = stack.templateOptions.metadata ?? {};
14
+ stack.templateOptions.metadata = {
15
+ ...metadata,
16
+ [metadataKey]: { ...metadata[metadataKey], [key]: value },
17
+ };
18
+ }
19
+ /** Record a workload's build mode for the CLI's read-only, pre-deployment migration guard. */
20
+ function recordWorkloadBuild(scope, key, build) {
21
+ recordMetadata(scope, exports.WORKLOAD_BUILDS_METADATA_KEY, key, build);
22
+ }
23
+ /**
24
+ * Record a `ContainerLocal` workload's image asset hash, the key of its entry under `dockerImages`
25
+ * in the stack's asset manifest, so the CLI can find the image without parsing construct paths.
26
+ */
27
+ function recordLocalImage(scope, key, assetHash) {
28
+ recordMetadata(scope, exports.LOCAL_IMAGES_METADATA_KEY, key, assetHash);
29
+ }
30
+ //# sourceMappingURL=workload-build-metadata.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workload-build-metadata.js","sourceRoot":"","sources":["../../../../../src/cdk/constructs/components/container/workload-build-metadata.ts"],"names":[],"mappings":";;;AAuBA,kDAEC;AAMD,4CAEC;AAjCD,6CAAoC;AAGpC,wGAAwG;AAC3F,QAAA,4BAA4B,GAAG,kBAAkB,CAAC;AAC/D,4FAA4F;AAC/E,QAAA,yBAAyB,GAAG,uBAAuB,CAAC;AAOjE,SAAS,cAAc,CAAC,KAAgB,EAAE,WAAmB,EAAE,GAAgB,EAAE,KAAa;IAC5F,MAAM,KAAK,GAAG,mBAAK,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;IAC9B,MAAM,QAAQ,GAAG,KAAK,CAAC,eAAe,CAAC,QAAQ,IAAI,EAAE,CAAC;IACtD,KAAK,CAAC,eAAe,CAAC,QAAQ,GAAG;QAC/B,GAAG,QAAQ;QACX,CAAC,WAAW,CAAC,EAAE,EAAE,GAAI,QAAQ,CAAC,WAAW,CAAwC,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE;KAClG,CAAC;AACJ,CAAC;AAED,8FAA8F;AAC9F,SAAgB,mBAAmB,CAAC,KAAgB,EAAE,GAAgB,EAAE,KAAwB;IAC9F,cAAc,CAAC,KAAK,EAAE,oCAA4B,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;AAClE,CAAC;AAED;;;GAGG;AACH,SAAgB,gBAAgB,CAAC,KAAgB,EAAE,GAAgB,EAAE,SAAiB;IACpF,cAAc,CAAC,KAAK,EAAE,iCAAyB,EAAE,GAAG,EAAE,SAAS,CAAC,CAAC;AACnE,CAAC"}
@@ -39,6 +39,8 @@ export interface AgentCoreHarnessRoleProps extends AgentCoreComponentProps {
39
39
  readonly credentials?: Record<string, {
40
40
  credentialProviderArn: string;
41
41
  }>;
42
+ /** Explicit image repository reference; image asset URIs can contain unresolved CDK tokens. */
43
+ readonly ecrRepositoryArn?: string;
42
44
  }
43
45
  /**
44
46
  * AgentCore Harness Role construct.
@@ -1 +1 @@
1
- {"version":3,"file":"AgentCoreHarnessRole.d.ts","sourceRoot":"","sources":["../../../../../../src/cdk/constructs/components/primitives/harness/AgentCoreHarnessRole.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,gBAAgB,EAChB,YAAY,EACZ,WAAW,EAEZ,MAAM,kDAAkD,CAAC;AAG1D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAchE,OAAO,EAAE,OAAO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BAAqB,SAAQ,SAAU,YAAW,GAAG,CAAC,UAAU;IAC3E,SAAgB,IAAI,EAAE,GAAG,CAAC,KAAK,CAAC;IAChC,SAAgB,OAAO,EAAE,MAAM,CAAC;IAChC,oGAAoG;IACpG,SAAgB,cAAc,EAAE,GAAG,CAAC,UAAU,CAAC;gBAEnC,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,yBAAyB;IAgX1E;;;;;;;;;OASG;IACI,WAAW,CAAC,SAAS,EAAE,GAAG,CAAC,eAAe,GAAG,IAAI;CAGzD"}
1
+ {"version":3,"file":"AgentCoreHarnessRole.d.ts","sourceRoot":"","sources":["../../../../../../src/cdk/constructs/components/primitives/harness/AgentCoreHarnessRole.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,gBAAgB,EAChB,YAAY,EACZ,WAAW,EAEZ,MAAM,kDAAkD,CAAC;AAG1D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAchE,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,WAAW,CAAC;AAQ5C,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC;;;;;;OAMG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,UAAU,CAA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