@go-to-k/cdkd 0.290.48 → 0.290.49
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/{asg-provider-CTrrSFjd.js → asg-provider-06Q6iut6.js} +2 -2
- package/dist/{asg-provider-CTrrSFjd.js.map → asg-provider-06Q6iut6.js.map} +1 -1
- package/dist/cli.js +2 -2
- package/dist/{deploy-engine-Defy0tTm.js → deploy-engine-Cs0cRQIM.js} +226 -33
- package/dist/deploy-engine-Cs0cRQIM.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/{program-DZoyIJCj.js → program-DGTp7UIn.js} +7 -7
- package/dist/{program-DZoyIJCj.js.map → program-DGTp7UIn.js.map} +1 -1
- package/dist/{version-78yzIsS6.js → version-usurnP89.js} +2 -2
- package/dist/{version-78yzIsS6.js.map → version-usurnP89.js.map} +1 -1
- package/package.json +1 -1
- package/dist/deploy-engine-Defy0tTm.js.map +0 -1
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { n as isVersionOnlyInvocation, t as getCdkdVersion } from "./version-
|
|
2
|
+
import { n as isVersionOnlyInvocation, t as getCdkdVersion } from "./version-usurnP89.js";
|
|
3
3
|
|
|
4
4
|
//#region src/cli/pipe-close-handler.ts
|
|
5
5
|
/**
|
|
@@ -74,7 +74,7 @@ async function main() {
|
|
|
74
74
|
console.log(getCdkdVersion());
|
|
75
75
|
return;
|
|
76
76
|
}
|
|
77
|
-
const { buildProgram } = await import("./program-
|
|
77
|
+
const { buildProgram } = await import("./program-DGTp7UIn.js");
|
|
78
78
|
const program = buildProgram();
|
|
79
79
|
const args = reorderArgs(process.argv);
|
|
80
80
|
await program.parseAsync(args);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { C as displayAwsMessage, D as truncateCodePoints, E as isPasteableIdent, S as UNRENDERABLE, T as displaySafe, d as applyDefaultNameForFallback, f as explicitNamePropertyFor, g as looksLikeCdkdGeneratedName, h as getCurrentStackName, m as generateResourceNameWithFallback, n as getLogger, p as generateResourceName, r as isStdoutReservedForPayload, s as getLiveRenderer, v as withStackName, w as displayIdent, x as STACK_REF_MAX_CODE_POINTS, y as withoutGeneratedFallbackName } from "./logger-GASr9bAF.js";
|
|
2
2
|
import { a as setAssumedRoleCredentials, i as getPreAssumeEnvCredentials, n as awsClientDefaults, o as setPreAssumeEnvCredentials, r as getAssumedRoleCredentials, t as SECOND_ROLE_PUBLISH_REFUSAL } from "./aws-client-defaults-BoIxyCir.js";
|
|
3
|
-
import { t as getCdkdVersion } from "./version-
|
|
3
|
+
import { t as getCdkdVersion } from "./version-usurnP89.js";
|
|
4
4
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
5
5
|
import { createHash, randomUUID } from "node:crypto";
|
|
6
6
|
import { CreateBucketCommand, DeleteObjectCommand, DeleteObjectsCommand, GetBucketLocationCommand, GetBucketReplicationCommand, GetObjectCommand, HeadBucketCommand, HeadObjectCommand, ListObjectVersionsCommand, ListObjectsV2Command, NoSuchKey, PutBucketEncryptionCommand, PutBucketPolicyCommand, PutObjectCommand, PutPublicAccessBlockCommand, S3Client, S3ServiceException } from "@aws-sdk/client-s3";
|
|
@@ -35,6 +35,7 @@ import { GetHostedZoneCommand, ListHostedZonesByNameCommand, Route53Client } fro
|
|
|
35
35
|
import { DescribeListenersCommand, DescribeLoadBalancersCommand, ElasticLoadBalancingV2Client } from "@aws-sdk/client-elastic-load-balancing-v2";
|
|
36
36
|
import { KMSClient, ListAliasesCommand } from "@aws-sdk/client-kms";
|
|
37
37
|
import { readFile } from "fs/promises";
|
|
38
|
+
import { isAbsolute as isAbsolute$1, resolve as resolve$1 } from "path";
|
|
38
39
|
import { CreateRepositoryCommand, DescribeImagesCommand as DescribeImagesCommand$1, DescribeRepositoriesCommand, ECRClient, GetAuthorizationTokenCommand, PutImageTagMutabilityCommand } from "@aws-sdk/client-ecr";
|
|
39
40
|
import { inspect } from "node:util";
|
|
40
41
|
import { hostname } from "os";
|
|
@@ -3031,18 +3032,30 @@ function resolveAssemblyPath(dir, candidate, options) {
|
|
|
3031
3032
|
* empty `path.relative` means "names the directory rather than a file inside
|
|
3032
3033
|
* it". An asset path legitimately names a DIRECTORY, so a value equal to the
|
|
3033
3034
|
* bound is inside it and reporting it as outside would be a false statement.
|
|
3035
|
+
*
|
|
3036
|
+
* **The real-path walk runs on the ACCEPTING side too, not only to find a
|
|
3037
|
+
* symlink escape.** The two paths arrive here INDEPENDENTLY — the bound from
|
|
3038
|
+
* `-a` or the assembly's own `directoryName`, the target from the manifest —
|
|
3039
|
+
* so they can be two spellings of one directory (`/var/…` and `/private/var/…`
|
|
3040
|
+
* on macOS). `resolveAssemblyPath` never meets that, its candidate being built
|
|
3041
|
+
* by joining onto the base. Left alone it warned "outside the assembly" about
|
|
3042
|
+
* an ordinary `cdk synth --no-staging` asset, and a warning that cries wolf is
|
|
3043
|
+
* worse than none.
|
|
3034
3044
|
*/
|
|
3035
3045
|
function absoluteAssemblyPathEscape(bound, absolutePath) {
|
|
3036
3046
|
const resolvedBound = path.resolve(bound);
|
|
3037
3047
|
const target = path.resolve(absolutePath);
|
|
3038
|
-
if (!isInside(resolvedBound, target) && target !== resolvedBound) return {
|
|
3039
|
-
contained: false,
|
|
3040
|
-
escape: "lexical",
|
|
3041
|
-
path: target
|
|
3042
|
-
};
|
|
3043
3048
|
const realBound = resolveThroughLinks(resolvedBound);
|
|
3049
|
+
const realTarget = resolveThroughLinks(target);
|
|
3050
|
+
if (!isInside(resolvedBound, target) && target !== resolvedBound) {
|
|
3051
|
+
if (realBound === void 0 || realTarget === void 0 || !isInside(realBound, realTarget) && realTarget !== realBound) return {
|
|
3052
|
+
contained: false,
|
|
3053
|
+
escape: "lexical",
|
|
3054
|
+
path: target
|
|
3055
|
+
};
|
|
3056
|
+
return;
|
|
3057
|
+
}
|
|
3044
3058
|
if (realBound !== void 0) {
|
|
3045
|
-
const realTarget = resolveThroughLinks(target);
|
|
3046
3059
|
if (realTarget !== void 0 && !isInside(realBound, realTarget) && realTarget !== realBound) return {
|
|
3047
3060
|
contained: false,
|
|
3048
3061
|
escape: "symlink",
|
|
@@ -3052,6 +3065,38 @@ function absoluteAssemblyPathEscape(bound, absolutePath) {
|
|
|
3052
3065
|
}
|
|
3053
3066
|
}
|
|
3054
3067
|
/**
|
|
3068
|
+
* Whether `candidate` names the SAME DIRECTORY as `bound`, by any spelling.
|
|
3069
|
+
*
|
|
3070
|
+
* It lives here, beside {@link absoluteAssemblyPathEscape}, because it asks
|
|
3071
|
+
* that function's question one step further on and must use its machinery to
|
|
3072
|
+
* answer: `path.resolve` equality is a LEXICAL test, and the two paths reach a
|
|
3073
|
+
* caller independently — the bound from `-a` or the assembly's own
|
|
3074
|
+
* `directoryName`, the candidate from the manifest — so one directory has
|
|
3075
|
+
* several spellings. `/tmp/cdk.out` and `/private/tmp/cdk.out` on macOS;
|
|
3076
|
+
* `<cdk.out>/self` where `self` is a symlink to `cdk.out`; both at once.
|
|
3077
|
+
*
|
|
3078
|
+
* **A caller that re-spells this as `resolve(a) === resolve(b)` gets a test
|
|
3079
|
+
* that misses every spelling but one**, which is how
|
|
3080
|
+
* [#3532](https://github.com/go-to-k/cdkd/issues/3532)'s asset resolvers first
|
|
3081
|
+
* shipped their whole-assembly warning: `absoluteAssemblyPathEscape`
|
|
3082
|
+
* exonerates a second spelling of the bound as INSIDE — correctly — and the
|
|
3083
|
+
* lexical equality beside it then said "not the bound", so the one value
|
|
3084
|
+
* meaning "the entire assembly is this asset" passed both tests in silence.
|
|
3085
|
+
* Ask this instead; do not re-derive it.
|
|
3086
|
+
*
|
|
3087
|
+
* Conservative on failure: an unresolvable side answers from the lexical
|
|
3088
|
+
* comparison alone, so it can only ever say "not the same", never wrongly
|
|
3089
|
+
* claim identity.
|
|
3090
|
+
*/
|
|
3091
|
+
function namesTheSameDirectory(bound, candidate) {
|
|
3092
|
+
const resolvedBound = path.resolve(bound);
|
|
3093
|
+
const target = path.resolve(candidate);
|
|
3094
|
+
if (target === resolvedBound) return true;
|
|
3095
|
+
const realBound = resolveThroughLinks(resolvedBound);
|
|
3096
|
+
const realTarget = resolveThroughLinks(target);
|
|
3097
|
+
return realBound !== void 0 && realTarget !== void 0 && realBound === realTarget;
|
|
3098
|
+
}
|
|
3099
|
+
/**
|
|
3055
3100
|
* The shared tail of every containment refusal: what the value resolved to,
|
|
3056
3101
|
* what it escaped, and why that means the assembly is not CDK-generated. Each
|
|
3057
3102
|
* call site supplies its own subject ("Stack 'X' has templateFile='...' which
|
|
@@ -7020,6 +7065,36 @@ function setsEqual(a, b) {
|
|
|
7020
7065
|
return true;
|
|
7021
7066
|
}
|
|
7022
7067
|
|
|
7068
|
+
//#endregion
|
|
7069
|
+
//#region src/assets/absolute-asset-path-warning.ts
|
|
7070
|
+
/**
|
|
7071
|
+
* The one OTHER thing worth a line: the source resolves to the app's output
|
|
7072
|
+
* directory ITSELF, so the sink gets the whole assembly — every template and
|
|
7073
|
+
* every staged asset — rather than one asset directory.
|
|
7074
|
+
*
|
|
7075
|
+
* It is a WARNING and not a refusal for the same reason its sibling is, and it
|
|
7076
|
+
* must not be silent for a reason the sibling does not share: both resolvers
|
|
7077
|
+
* accept this value (issue
|
|
7078
|
+
* [#3532](https://github.com/go-to-k/cdkd/issues/3532)) because the absolute
|
|
7079
|
+
* arm treats the bound as inside and the two arms must agree, and because the
|
|
7080
|
+
* local twin legitimately bind-mounts a directory. But on THIS layer the sink
|
|
7081
|
+
* is an upload or an image build, so "package the whole output directory and
|
|
7082
|
+
* send it to a bucket this manifest named" is exactly the sentence a user
|
|
7083
|
+
* needs and exactly the one an accept-silently arm withholds. No real `cdk
|
|
7084
|
+
* synth` emits `source.path: "."`, so this costs a legitimate run nothing.
|
|
7085
|
+
*/
|
|
7086
|
+
function warnWholeAssemblyAsSource(w) {
|
|
7087
|
+
getLogger().child("assets").warn(`${w.subject} has ${w.field} naming the output directory ITSELF: '${displaySafe(w.outdir)}'. cdkd will ${w.sink} — that is the WHOLE assembly, every template and every staged asset, not one asset directory. No CDK synth emits this, so treat this assembly as untrusted unless you wrote that path yourself.`);
|
|
7088
|
+
}
|
|
7089
|
+
/**
|
|
7090
|
+
* Emit it. Deliberately `warn`, never `throw`: the one producer of this shape
|
|
7091
|
+
* is a real `cdk synth --no-staging`, and refusing rejects the output of a
|
|
7092
|
+
* documented CDK CLI flag.
|
|
7093
|
+
*/
|
|
7094
|
+
function warnAbsoluteAssetPath(w) {
|
|
7095
|
+
getLogger().child("assets").warn(`${w.subject} has an absolute ${w.field} pointing outside the assembly: '${displaySafe(w.absolute)}'` + (w.escape.escape === "symlink" ? ` (through a symbolic link to '${displaySafe(w.escape.realPath)}')` : "") + `. cdkd will ${w.sink}. This is what cdk synth --no-staging emits, and is expected for it; if you did not synthesize with that flag, treat this assembly as untrusted: an absolute source path is honoured as written, so nothing but this line stands between it and that step.`);
|
|
7096
|
+
}
|
|
7097
|
+
|
|
7023
7098
|
//#endregion
|
|
7024
7099
|
//#region src/assets/asset-manifest-loader.ts
|
|
7025
7100
|
/**
|
|
@@ -7034,9 +7109,80 @@ function setsEqual(a, b) {
|
|
|
7034
7109
|
* primitive with the caller's own credentials, which is the harm the manifest
|
|
7035
7110
|
* FILE's own containment check cites. One function so the loader and the
|
|
7036
7111
|
* publisher cannot disagree about which file is published.
|
|
7037
|
-
|
|
7038
|
-
|
|
7112
|
+
*
|
|
7113
|
+
* **An ABSOLUTE `source.path` is HONOURED, and warned about when it leaves
|
|
7114
|
+
* `assetOutdir`** (issue
|
|
7115
|
+
* [#3532](https://github.com/go-to-k/cdkd/issues/3532)). It used to be neither
|
|
7116
|
+
* honoured nor refused: `resolveAssemblyPath` joins with `path.join`, which
|
|
7117
|
+
* does not honour a leading separator, so an absolute value was folded INTO
|
|
7118
|
+
* the outdir, read as CONTAINED, and died later at `statSync` with an `ENOENT`
|
|
7119
|
+
* naming a path that exists nowhere and that the user never wrote. Three
|
|
7120
|
+
* things decide the arm:
|
|
7121
|
+
*
|
|
7122
|
+
* - `cdk synth --no-staging` emits exactly this shape. Under
|
|
7123
|
+
* `aws:cdk:disable-asset-staging` upstream `AssetStaging.relativeStagedPath`
|
|
7124
|
+
* returns the staged path verbatim, so every `files[*].source.path` is the
|
|
7125
|
+
* asset's absolute SOURCE directory, normally outside the outdir. Refusing it
|
|
7126
|
+
* rejects the output of a documented CDK CLI flag.
|
|
7127
|
+
* - Upstream `cdk deploy` resolves the field with `path.resolve(manifestDir,
|
|
7128
|
+
* p)`, which honours an absolute value and publishes it. Refusing here would
|
|
7129
|
+
* make cdkd diverge from the CLI it is meant to complement.
|
|
7130
|
+
* - So for an ABSOLUTE value the warning is the whole signal, and no
|
|
7131
|
+
* containment boundary is left.
|
|
7132
|
+
*
|
|
7133
|
+
* **State plainly what that gave up, because the first version of this comment
|
|
7134
|
+
* did not and was wrong.** It copied the local twin's line — "the relative arm
|
|
7135
|
+
* buys nothing against an adversary, who would write the absolute spelling" —
|
|
7136
|
+
* which is TRUE there and FALSE here, and the difference is the whole point.
|
|
7137
|
+
* `resolveAssetCodeDirectory` already honoured absolute paths before
|
|
7138
|
+
* [#3494](https://github.com/go-to-k/cdkd/issues/3494), so that change only
|
|
7139
|
+
* added a warning to an open door. HERE the door was SHUT: measured on
|
|
7140
|
+
* `path.resolve(path.join(base, c))`, `/Users/victim/.aws`, `/etc/passwd`,
|
|
7141
|
+
* `//etc/passwd` and `/etc/./passwd` all folded INSIDE the outdir and died at
|
|
7142
|
+
* `statSync`, `/../etc/passwd` was refused lexically, and a planted symlink
|
|
7143
|
+
* was refused by the symlink arm — so NO spelling reached an arbitrary host
|
|
7144
|
+
* file. Accidentally, but completely.
|
|
7145
|
+
*
|
|
7146
|
+
* What this opens, therefore, is real and new: a hand-written manifest can now
|
|
7147
|
+
* have any readable directory zipped to a bucket it names, with the operator's
|
|
7148
|
+
* credentials, gated only by the warning. It is accepted because upstream
|
|
7149
|
+
* `@aws-cdk/cdk-assets-lib` does the same with no containment at all
|
|
7150
|
+
* (`path.resolve(this.workDir, source.path)`, `private/handlers/files.js`), so
|
|
7151
|
+
* cdkd stays strictly MORE protective than the CLI it complements while still
|
|
7152
|
+
* running what `cdk synth --no-staging` emits. The relative arm still catches
|
|
7153
|
+
* an accidental or legacy `..` and costs nothing, which is why it stays — but
|
|
7154
|
+
* it is no longer a boundary against anyone who chose the value. The docs say
|
|
7155
|
+
* this to users in the same words; do not soften either copy.
|
|
7156
|
+
*/
|
|
7157
|
+
function resolveFileAssetSourcePath(manifestDir, asset, assetOutdir, sink) {
|
|
7158
|
+
if (isAbsolute$1(asset.source.path)) {
|
|
7159
|
+
const absolute = resolve$1(asset.source.path);
|
|
7160
|
+
const escape = absoluteAssemblyPathEscape(assetOutdir, absolute);
|
|
7161
|
+
if (escape !== void 0) warnAbsoluteAssetPath({
|
|
7162
|
+
subject: `File asset '${displaySafe(asset.displayName)}'`,
|
|
7163
|
+
field: "source.path",
|
|
7164
|
+
absolute,
|
|
7165
|
+
escape,
|
|
7166
|
+
sink
|
|
7167
|
+
});
|
|
7168
|
+
else if (namesTheSameDirectory(assetOutdir, absolute)) warnWholeAssemblyAsSource({
|
|
7169
|
+
subject: `File asset '${displaySafe(asset.displayName)}'`,
|
|
7170
|
+
field: "source.path",
|
|
7171
|
+
outdir: absolute,
|
|
7172
|
+
sink
|
|
7173
|
+
});
|
|
7174
|
+
return absolute;
|
|
7175
|
+
}
|
|
7039
7176
|
const resolved = resolveAssemblyPath(manifestDir, asset.source.path, { containWithin: assetOutdir });
|
|
7177
|
+
if (!resolved.contained && namesTheSameDirectory(assetOutdir, resolved.path)) {
|
|
7178
|
+
warnWholeAssemblyAsSource({
|
|
7179
|
+
subject: `File asset '${displaySafe(asset.displayName)}'`,
|
|
7180
|
+
field: "source.path",
|
|
7181
|
+
outdir: resolved.path,
|
|
7182
|
+
sink
|
|
7183
|
+
});
|
|
7184
|
+
return resolved.path;
|
|
7185
|
+
}
|
|
7040
7186
|
if (!resolved.contained) throw new Error(`File asset '${displaySafe(asset.displayName)}' has source.path='${displaySafe(asset.source.path)}' which ${renderAssemblyPathEscape(resolved, assetOutdir, "publish it")}`);
|
|
7041
7187
|
return resolved.path;
|
|
7042
7188
|
}
|
|
@@ -7110,18 +7256,26 @@ var AssetManifestLoader = class {
|
|
|
7110
7256
|
/**
|
|
7111
7257
|
* Get asset source path (absolute path)
|
|
7112
7258
|
*
|
|
7113
|
-
* Refuses a `source.path` resolving outside `
|
|
7114
|
-
* [#3489](https://github.com/go-to-k/cdkd/issues/3489))
|
|
7115
|
-
*
|
|
7116
|
-
*
|
|
7117
|
-
*
|
|
7259
|
+
* Refuses a RELATIVE `source.path` resolving outside `assetOutdir` (issue
|
|
7260
|
+
* [#3489](https://github.com/go-to-k/cdkd/issues/3489)); an ABSOLUTE one is
|
|
7261
|
+
* honoured and warned about instead (issue
|
|
7262
|
+
* [#3532](https://github.com/go-to-k/cdkd/issues/3532)) — see
|
|
7263
|
+
* {@link resolveFileAssetSourcePath} for why the two arms differ. The
|
|
7264
|
+
* manifest is assembly-supplied and `cdkd deploy -a <dir>` consumes a
|
|
7265
|
+
* pre-synthesized one, so a `source.path` of `../../../home/<user>/.aws`
|
|
7266
|
+
* would otherwise be packaged and uploaded to a bucket the SAME manifest
|
|
7267
|
+
* names.
|
|
7118
7268
|
*
|
|
7119
7269
|
* @param cdkOutputDir CDK output directory
|
|
7120
7270
|
* @param asset File asset
|
|
7271
|
+
* @param assetOutdir The app's outdir — the containment / warning bound.
|
|
7272
|
+
* REQUIRED for the reason {@link resolveFileAssetSourcePath}'s own
|
|
7273
|
+
* parameter is: a dropped bound narrows to the manifest directory and
|
|
7274
|
+
* silently refuses every Stage asset.
|
|
7121
7275
|
* @returns Absolute path to asset source
|
|
7122
7276
|
*/
|
|
7123
|
-
getAssetSourcePath(cdkOutputDir, asset, assetOutdir) {
|
|
7124
|
-
return resolveFileAssetSourcePath(cdkOutputDir, asset, assetOutdir
|
|
7277
|
+
getAssetSourcePath(cdkOutputDir, asset, assetOutdir, sink) {
|
|
7278
|
+
return resolveFileAssetSourcePath(cdkOutputDir, asset, assetOutdir, sink);
|
|
7125
7279
|
}
|
|
7126
7280
|
/**
|
|
7127
7281
|
* Resolve asset destination values (replace ${AWS::AccountId}, ${AWS::Region}, etc.)
|
|
@@ -7211,10 +7365,16 @@ var FileAssetPublisher = class {
|
|
|
7211
7365
|
* @param cdkOutputDir CDK output directory (cdk.out)
|
|
7212
7366
|
* @param accountId AWS account ID
|
|
7213
7367
|
* @param region AWS region
|
|
7214
|
-
*
|
|
7368
|
+
*
|
|
7369
|
+
* There is deliberately NO `profile` parameter. It was unused, and being
|
|
7370
|
+
* OPTIONAL and last it let a pre-go-to-k/cdkd#3532 call
|
|
7371
|
+
* `(…, accountId, region, profile)` keep compiling with the profile NAME
|
|
7372
|
+
* bound to `assetOutdir` — the required bound catches a DROP, not a SWAP,
|
|
7373
|
+
* so the parameter that made the swap expressible is gone instead.
|
|
7215
7374
|
*/
|
|
7216
|
-
async publish(assetHash, asset, cdkOutputDir, accountId, region,
|
|
7217
|
-
const
|
|
7375
|
+
async publish(assetHash, asset, cdkOutputDir, accountId, region, assetOutdir) {
|
|
7376
|
+
const destinations = Object.values(asset.destinations).map((d) => `s3://${this.resolvePlaceholders(d.bucketName, accountId, region)}/${this.resolvePlaceholders(d.objectKey, accountId, region)}`).map((u) => displaySafe(u));
|
|
7377
|
+
const sourcePath = resolveFileAssetSourcePath(cdkOutputDir, asset, assetOutdir, destinations.length > 0 ? `package that path and upload it to ${destinations.join(", ")}` : "package that path, though this manifest names no destination for it");
|
|
7218
7378
|
for (const [, dest] of Object.entries(asset.destinations)) {
|
|
7219
7379
|
const bucketName = this.resolvePlaceholders(dest.bucketName, accountId, region);
|
|
7220
7380
|
const objectKey = this.resolvePlaceholders(dest.objectKey, accountId, region);
|
|
@@ -8548,9 +8708,12 @@ function describeDockerCapturedOutput(error, args, fallback) {
|
|
|
8548
8708
|
//#endregion
|
|
8549
8709
|
//#region src/assets/docker-build.ts
|
|
8550
8710
|
/**
|
|
8551
|
-
* Where a Docker asset's build context lives, refusing a
|
|
8552
|
-
* that resolves outside `
|
|
8553
|
-
* [#3489](https://github.com/go-to-k/cdkd/issues/3489))
|
|
8711
|
+
* Where a Docker asset's build context lives, refusing a RELATIVE
|
|
8712
|
+
* `source.directory` that resolves outside `assetOutdir` (issue
|
|
8713
|
+
* [#3489](https://github.com/go-to-k/cdkd/issues/3489)) and HONOURING an
|
|
8714
|
+
* ABSOLUTE one with a warning when it leaves that bound (issue
|
|
8715
|
+
* [#3532](https://github.com/go-to-k/cdkd/issues/3532); the reasoning is in
|
|
8716
|
+
* `resolveFileAssetSourcePath`, and the two must not diverge).
|
|
8554
8717
|
*
|
|
8555
8718
|
* The field is assembly-supplied and used BOTH as the executable's cwd and as
|
|
8556
8719
|
* the `docker build` cwd, so an escaping value sends a directory from outside
|
|
@@ -8564,11 +8727,42 @@ function describeDockerCapturedOutput(error, args, fallback) {
|
|
|
8564
8727
|
* Twin of `resolveFileAssetSourcePath` and `resolveVerboseTemplatePath`.
|
|
8565
8728
|
* Exported for unit testing.
|
|
8566
8729
|
*/
|
|
8567
|
-
function resolveDockerContextDirectory(manifestDir, directory, wrapError, assetOutdir
|
|
8730
|
+
function resolveDockerContextDirectory(manifestDir, directory, wrapError, assetOutdir, sink, assetId) {
|
|
8731
|
+
if (isAbsolute$1(directory)) {
|
|
8732
|
+
const absolute = resolve$1(directory);
|
|
8733
|
+
const escape = absoluteAssemblyPathEscape(assetOutdir, absolute);
|
|
8734
|
+
if (escape !== void 0) warnAbsoluteAssetPath({
|
|
8735
|
+
subject: dockerSubject(assetId),
|
|
8736
|
+
field: "source.directory",
|
|
8737
|
+
absolute,
|
|
8738
|
+
escape,
|
|
8739
|
+
sink
|
|
8740
|
+
});
|
|
8741
|
+
else if (namesTheSameDirectory(assetOutdir, absolute)) warnWholeAssemblyAsSource({
|
|
8742
|
+
subject: dockerSubject(assetId),
|
|
8743
|
+
field: "source.directory",
|
|
8744
|
+
outdir: absolute,
|
|
8745
|
+
sink
|
|
8746
|
+
});
|
|
8747
|
+
return absolute;
|
|
8748
|
+
}
|
|
8568
8749
|
const resolved = resolveAssemblyPath(manifestDir, directory, { containWithin: assetOutdir });
|
|
8750
|
+
if (!resolved.contained && namesTheSameDirectory(assetOutdir, resolved.path)) {
|
|
8751
|
+
warnWholeAssemblyAsSource({
|
|
8752
|
+
subject: dockerSubject(assetId),
|
|
8753
|
+
field: "source.directory",
|
|
8754
|
+
outdir: resolved.path,
|
|
8755
|
+
sink
|
|
8756
|
+
});
|
|
8757
|
+
return resolved.path;
|
|
8758
|
+
}
|
|
8569
8759
|
if (!resolved.contained) throw wrapError(`asset source.directory='${displaySafe(directory)}' which ${renderAssemblyPathEscape(resolved, assetOutdir, "build it")}`);
|
|
8570
8760
|
return resolved.path;
|
|
8571
8761
|
}
|
|
8762
|
+
/** One spelling of the warning subject, so the two arms cannot drift. */
|
|
8763
|
+
function dockerSubject(assetId) {
|
|
8764
|
+
return assetId === void 0 ? "A Docker asset" : `Docker asset '${displaySafe(assetId)}'`;
|
|
8765
|
+
}
|
|
8572
8766
|
/**
|
|
8573
8767
|
* Build a Docker image from a CDK asset source. Returns the local image
|
|
8574
8768
|
* tag the caller should use for `docker tag` / `docker push` (publisher)
|
|
@@ -8587,11 +8781,11 @@ function resolveDockerContextDirectory(manifestDir, directory, wrapError, assetO
|
|
|
8587
8781
|
async function buildDockerImage(asset, cdkOutDir, options) {
|
|
8588
8782
|
const source = asset.source;
|
|
8589
8783
|
const logger = getLogger().child("docker-build");
|
|
8590
|
-
const contextDirectory = (directory) => resolveDockerContextDirectory(cdkOutDir, directory, options.wrapError, options.assetOutdir);
|
|
8784
|
+
const contextDirectory = (directory, sink) => resolveDockerContextDirectory(cdkOutDir, directory, options.wrapError, options.assetOutdir ?? cdkOutDir, sink, options.tag);
|
|
8591
8785
|
if (source.executable && source.executable.length > 0) {
|
|
8592
8786
|
const [cmd, ...args] = source.executable;
|
|
8593
8787
|
if (!cmd) throw options.wrapError("asset source.executable[] is empty");
|
|
8594
|
-
const cwd = source.directory ? contextDirectory(source.directory) : cdkOutDir;
|
|
8788
|
+
const cwd = source.directory ? contextDirectory(source.directory, "run this asset's source.executable with that directory as its working directory") : cdkOutDir;
|
|
8595
8789
|
const shownExecutable = redactDockerArgvValues(source.executable).join(" ");
|
|
8596
8790
|
logger.debug(`Building Docker image via executable: ${shownExecutable} (cwd=${cwd})`);
|
|
8597
8791
|
let result;
|
|
@@ -8615,7 +8809,7 @@ async function buildDockerImage(asset, cdkOutDir, options) {
|
|
|
8615
8809
|
}
|
|
8616
8810
|
if (!options.tag) throw options.wrapError("buildDockerImage(directory mode) requires options.tag");
|
|
8617
8811
|
const buildArgs = buildDockerBuildCommand(source, options.tag, options.platform);
|
|
8618
|
-
const contextDir = contextDirectory(source.directory);
|
|
8812
|
+
const contextDir = contextDirectory(source.directory, "send that directory to BuildKit as the build context and bake it into the image pushed to the repository this manifest names");
|
|
8619
8813
|
buildArgs.push(".");
|
|
8620
8814
|
logger.debug(`${getDockerCmd()} ${redactDockerArgvValues(buildArgs).join(" ")} (cwd=${displaySafe(contextDir)})`);
|
|
8621
8815
|
try {
|
|
@@ -8730,7 +8924,7 @@ var DockerAssetPublisher = class {
|
|
|
8730
8924
|
continue;
|
|
8731
8925
|
}
|
|
8732
8926
|
const localTag = `cdkd-asset-${assetHash}`;
|
|
8733
|
-
await this.buildImage(asset, cdkOutputDir, localTag);
|
|
8927
|
+
await this.buildImage(asset, cdkOutputDir, localTag, cdkOutputDir);
|
|
8734
8928
|
await this.tagAndPushWithLazyLogin(client, localTag, ecrUri, accountId, destRegion);
|
|
8735
8929
|
this.logger.debug(`✅ Published: ${ecrUri}`);
|
|
8736
8930
|
} finally {
|
|
@@ -8807,7 +9001,7 @@ var DockerAssetPublisher = class {
|
|
|
8807
9001
|
async buildImage(asset, cdkOutputDir, tag, assetOutdir) {
|
|
8808
9002
|
const actualTag = await buildDockerImage(asset, cdkOutputDir, {
|
|
8809
9003
|
tag,
|
|
8810
|
-
|
|
9004
|
+
assetOutdir,
|
|
8811
9005
|
wrapError: (stderr) => new AssetError(`Docker build failed: ${stderr}`)
|
|
8812
9006
|
});
|
|
8813
9007
|
if (actualTag !== tag) {
|
|
@@ -10199,8 +10393,7 @@ var AssetPublisher = class {
|
|
|
10199
10393
|
cdkOutputDir,
|
|
10200
10394
|
assetOutdir,
|
|
10201
10395
|
accountId: options.accountId,
|
|
10202
|
-
region: options.region
|
|
10203
|
-
...options.profile && { profile: options.profile }
|
|
10396
|
+
region: options.region
|
|
10204
10397
|
}
|
|
10205
10398
|
});
|
|
10206
10399
|
nodeIds.push(nodeId);
|
|
@@ -10247,7 +10440,7 @@ var AssetPublisher = class {
|
|
|
10247
10440
|
*/
|
|
10248
10441
|
async executeNode(node) {
|
|
10249
10442
|
const data = node.data;
|
|
10250
|
-
if (data.kind === "file") await this.filePublisher.publish(data.hash, data.asset, data.cdkOutputDir, data.accountId, data.region, data.
|
|
10443
|
+
if (data.kind === "file") await this.filePublisher.publish(data.hash, data.asset, data.cdkOutputDir, data.accountId, data.region, data.assetOutdir);
|
|
10251
10444
|
else if (data.kind === "docker-build") await this.dockerPublisher.build(data.asset, data.cdkOutputDir, data.localTag, data.assetOutdir);
|
|
10252
10445
|
else if (data.kind === "docker-publish") await this.dockerPublisher.push(data.asset, data.accountId, data.region, data.localTag);
|
|
10253
10446
|
this.logger.debug(`✅ ${node.id}`);
|
|
@@ -34669,7 +34862,7 @@ var CloudControlProvider = class {
|
|
|
34669
34862
|
const indeterminateGuard = await this.confirmDeleteTargetIdentity(logicalId, resourceType, physicalId, context);
|
|
34670
34863
|
if (context?.removeProtection === true && resourceType === "AWS::AutoScaling::AutoScalingGroup") {
|
|
34671
34864
|
this.logger.debug(`Delegating protected AutoScalingGroup ${logicalId} delete to the SDK ASGProvider (Cloud Control cannot force-delete a protected ASG)`);
|
|
34672
|
-
const { ASGProvider } = await import("./asg-provider-
|
|
34865
|
+
const { ASGProvider } = await import("./asg-provider-06Q6iut6.js").then((n) => n.n);
|
|
34673
34866
|
const asgProvider = new ASGProvider();
|
|
34674
34867
|
return withIndeterminateGuard(await asgProvider.delete(logicalId, physicalId, resourceType, _properties, context), indeterminateGuard);
|
|
34675
34868
|
}
|
|
@@ -48379,4 +48572,4 @@ var DeployEngine = class DeployEngine {
|
|
|
48379
48572
|
|
|
48380
48573
|
//#endregion
|
|
48381
48574
|
export { yellow as $, AssemblyReader as $i, safeStackName as $n, assertAssetBucketRegion as $r, requireConfigObject as $t, createPreDeleteFinalSnapshot as A, ProvisioningError as Aa, resolveCaptureObservedState as Ai, malformedOutputsRefusalMessage as An, formatLockExpiry as Ar, carriesDynamicReference as At, isStatefulRecreateTargetSync as B, withErrorHandling as Ba, MIGRATE_TMP_PREFIX as Bi, refuseMalformedOrphansForDestroy as Bn, isReadableBag as Br, isSettledInstanceState as Bt, namesAnyDeclaredParameter as C, IntrinsicResolutionRefusalError as Ca, getDockerImageBySourceHash as Ci, isReadableResourceEntry as Cn, LockManager as Cr, slowCcOperationTimeoutMs as Ct, PRE_DELETE_SNAPSHOT_TYPES as D, MalformedProducerRecordRefusalError as Da, getLegacyStateBucketName as Di, malformedOrphanRecordsWarning as Dn, buildForceUnlockCommand as Dr, disableInstanceApiTermination as Dt, ATOMIC_FINAL_SNAPSHOT_TYPES as E, LockError as Ea, getDefaultStateBucketName as Ei, malformedLocalOutputsWarning as En, UNREPRODUCIBLE_LOCK_CLAUSE as Er, deleteSkipReason as Et, extractDeploymentEventError as F, StateError as Fa, stateBucketExistenceConfirmed as Fi, malformedResourcesWarning as Fn, hasReadableExportSet as Fr, isImpossibleEmptyStoredAttribute as Ft, toCfnInteger as G, markNonRetryable as Ga, injectiveKeyPrefix as Gi, refuseMalformedResourcesForDestroy as Gn, stringifyValue as Gr, coerceCfnBoolean as Gt, WARM_THROUGHPUT_MEMBERS as H, isRetryableTransientError as Ha, uploadCfnTemplate as Hi, refuseMalformedOutputsForDestroy as Hn, orphansCarriedFrom as Hr, normalizeAwsTagsToCfn as Ht, makeSiblingClaimReader as I, SynthesisError as Ia, warnDeprecatedNoPrefixCliFlag as Ii, malformedStateRefusalMessage as In, hasReasonlessBaselineRefusal as Ir, isNamelessDynamicReferenceError as It, bold as J, describeAwsFailure as Ja, decodeListingKey as Ji, repairMalformedOutputsForReadOnly as Jn, createAssetRedirectResolver as Jr, configIntegerRefusal as Jt, toFiniteNumber as K, markRedactedCause as Ka, producerCoordinateKey as Ki, refuseMalformedState as Kn, WorkGraph as Kr, coerceCfnInteger as Kt, planOrphanAdoption as L, formatError as La, ssmResolvedValueType as Li, refuseDivergentRecordRegionForDestroy as Ln, hasUnverifiableParameterRefusal as Lr, isUnboundTemplateParameter as Lt, refusesFinalSnapshot as M, ResourceUpdateNotSupportedError as Ma, resolveStateBucketWithDefault as Mi, malformedRenderedContainersWarning as Mn, CUSTOM_RESOURCE_RESPONSE_PREFIX as Mr, cfnRefValueFromPhysicalId as Mt, unsupportedFinalSnapshotError as N, StackHasActiveImportsError as Na, resolveStateBucketWithDefaultAndSource as Ni, malformedResourceEntriesWarning as Nn, DEFAULT_STATE_PREFIX as Nr, coerceParameterTypedValue as Nt, buildFinalSnapshotIdentifier as O, NestedStackChildDirectDestroyError as Oa, resolveApp as Oi, malformedOrphansRefusalMessage as On, buildLockContentionMessage as Or, isTerminationProtectionPropagationError as Ot, makeCanonicalizePropertiesFn as P, StackTerminationProtectionError as Pa, resolveUseCdkBootstrapAssets as Pi, malformedResourcePropertiesWarning as Pn, exportNamesCarriedFrom as Pr, getAccountInfo as Pt, red as Q, derivePartitionAndUrlSuffix as Qi, safeRegion as Qn, BOOTSTRAP_MARKER_PREFIX as Qr, requireConfigArray as Qt, MULTI_REGION_RECREATE_BLOCKED_TYPES as R, isCdkdError as Ra, CFN_TEMPLATE_BODY_LIMIT as Ri, refuseMalformedNestedChildOutputs as Rn, importableOutputKeys as Rr, parameterTypeMayLoseSecretIdentity as Rt, computeParameterTaint as S, DynamicReferenceRegionAmbiguousError as Sa, AssetManifestLoader as Si, hasReadableResources as Sn, scrubResourceRecord as Sr, isWaitAbandonedError as St, resourcesNamingDeclaredParameter as T, LocalStartServiceError as Ta, synthesisStatusMessage as Ti, malformedExportSourceWarning as Tn, rebuildClientForBucketRegion as Tr, deleteIndeterminateGuards as Tt, coerceWarmThroughput as U, isThrottlingError as Ua, CUSTOM_RESOURCE_RESPONSE_OBJECT_DESCRIPTION as Ui, refuseMalformedResourceEntries as Un, shouldRetainResource as Ur, resolveExplicitPhysicalId as Ut, renderStatefulReason as V, isMarkedNonRetryable as Va, findLargeInlineResources as Vi, refuseMalformedOutputs as Vn, orphansAfterRollback as Vr, WAFv2WebACLProvider as Vt, isWarmThroughputDecrease as W, isTransientServerError as Wa, injectiveKey as Wi, refuseMalformedResourcePropertiesForOrphan as Wn, AssetPublisher as Wr, assertRegionMatch as Wt, gray as X, __exportAll as Xa, PARTITION_TABLE as Xi, repairMalformedResourcePropertiesForReadOnly as Xn, rewriteTemplateAssetReferences as Xr, readConfigString as Xt, cyan as Y, safeStringify$1 as Ya, expectedOwnerParam as Yi, repairMalformedResourceEntriesForReadOnly as Yn, loadPublishableAssetManifest as Yr, configStringRefusal as Yt, green as Z, canonicalizeRegion as Zi, repairMalformedResourcesForReadOnly as Zn, AssetModeResolver as Zr, replayWarn as Zt, bagHoldsSecretExpression as _, CdkdError as _a, redactDockerArgvValues as _i, UNREADABLE_ORPHANS_CONTAINER_ROW as _n, maskSecretsInError as _r, endCommandInterruptScope as _t, DeploymentEventsStore as a, nullPrototypeRecord as aa, validateAssetBucketName as ai, s3BucketDomainName as an, TemplateParser as ar, secretBearingStateKeyWarning as at, mergeNoChangeOutputs as b, DependencyError as ba, escapeRegExp$1 as bi, hasReadableOrphans as bn, recoverMaskedOutput as br, startInterruptWatch as bt, replayFailedOperations as c, renderAssemblyPathEscape as ca, buildDockerImage as ci, s3BucketWebsiteUrl as cn, STATE_SOURCED_READBACK_RULES as cr, IAMRoleProvider as ct, updatePartialMessage as d, resolveBucketRegion as da, describeDockerExecFailure as di, applyCallerIdentityCredentials as dn, createSecretMasker as dr, ProviderRegistry as dt, failedStageNote as ea, ensureAssetStorage as ei, requireConfigString as en, findActionableSilentDrops as er, collectDeclaredOutputNames as et, updatePartialReason as f, AwsClients as fa, describeDockerFailure as fi, callerEnvCredentials as fn, dynamicReferenceTokens as fr, wouldReturnToSdkProvider as ft, computeImplicitDeleteEdges as g, AssetError as ga, partitionSensitiveEnv as gi, STATE_RESOURCES_MALFORMED as gn, markSameGenerationBag as gr, beginCommandInterruptScope as gt, IMPLICIT_DELETE_DEPENDENCIES as h, setAwsClients as ha, getDockerCmd as hi, INTRINSIC_KEYS as hn, isSingleDynamicReferenceToken as hr, maskerOrIdentity as ht, DeploymentEventsReader as i, hasPlainPrototype$1 as ia, readBootstrapMarkerBody as ii, s3BucketArn as in, DagBuilder as ir, secretBearing as it, isFinalSnapshotError as j, ResourceTimeoutError as ja, resolveSkipPrefix as ji, malformedOutputsWarning as jn, shellQuote as jr, carriesFetchableDynamicReference as jt, ccRoutedFinalSnapshotError as k, PartialFailureError as ka, resolveAutoAssetStorage as ki, malformedOrphansWarning as kn, forceQuitRecoveryClause as kr, IntrinsicFunctionResolver as kt, replayRollback as l, resolveAssemblyPath as la, resolveDockerContextDirectory as li, applyRoleArnIfSet as ln, TEMPLATE_SOURCED_RULES as lr, collectInlinePolicyNamesManagedBySiblings as lt, maskingRetryLogger as m, resetAwsClients as ma, formatDockerLoginError as mi, DiffCalculator as mn, identityKeyFor as mr, maskDeep as mt, DEFAULT_RESOURCE_WARN_AFTER_MS as n, defineOwnKey as na, isCrossRegionRedirect as ni, producerRegionsFromState as nn, describeTypeWithThrottleRetry as nr, exportAliasCollisionScrubWarning as nt, planFailedOps as o, ownValue as oa, validateContainerRepoName as oi, s3BucketDualStackDomainName as on, STATE_SOURCED_BASELINE_RULES as or, secretSafeKeyDisplay as ot, withResourceDeadline as p, getAwsClients as pa, dockerSpawnEnvWithSensitive as pi, envCredentialsAreAssumedRole as pn, errorCauseChain as pr, createMaskedRetryLogger as pt, formatResourceLine as q, retryClassificationText as qa, producerRecordKey as qi, repairMalformedOrphansForReadOnly as qn, buildAssetRedirectMap as qr, configBooleanRefusal as qt, DeployEngine as r, hasOwnKey as ra, parseBootstrapMarker as ri, withSharedDrainBudget as rn, withRetry as rr, isExportAliasCollision as rt, planRollback as s, absoluteAssemblyPathEscape as sa, buildDenyExternalAccessPolicy as si, s3BucketRegionalDomainName as sn, STATE_SOURCED_CROSS_GENERATION_RULES as sr, getCurrentResourceSecrets as st, DEFAULT_RESOURCE_TIMEOUT_MS as t, processStackMessages as ta, getBootstrapMarkerKey as ti, classifyReplaySecretRegion as tn, findSilentDropProperties as tr, collectPublishedOutputNames as tt, resolveReplacementOldType as u, clearBucketRegionCache as ua, describeDockerCapturedOutput as ui, AWS_CREDENTIAL_ENV_KEYS as un, carriesSecretMask as ur, clearOnUpdateRemoval as ut, isSecretBearingReferenceString as v, ConfigError as va, runDockerForeground as vi, UNREADABLE_RESOURCES_MAP_ROW as vn, maskSecretsInText as vr, interruptWatchListenerCount as vt, reachableDivergentParameters as w, LocalInvokeBuildError as wa, Synthesizer as wi, malformedExportNamesWarning as wn, S3StateBackend as wr, UNSPECIFIED_SKIP_REASON as wt, bindingSkippedOutputs as x, DeployCancelledError as xa, stripControlChars as xi, hasReadableOutputs as xn, redactSecretsForState as xr, CloudControlProvider as xt, keptWholeReasonText as y, CrossAccountSecretRefusalError as ya, runDockerStreaming as yi, displayLogicalId as yn, recordMaskOnlyValue as yr, isInterruptedWaitError as yt, isStatefulRecreateTargetForReplace as z, normalizeAwsError as za, CFN_TEMPLATE_URL_LIMIT as zi, refuseMalformedOrphans as zn, importableOutputs as zr, refStateLookupFromResource as zt };
|
|
48382
|
-
//# sourceMappingURL=deploy-engine-
|
|
48575
|
+
//# sourceMappingURL=deploy-engine-Cs0cRQIM.js.map
|