@cdkd/cli 0.352.12 → 0.352.13
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/{ambient-client-defaults-zXLYCPYh.js → ambient-client-defaults-_b32vSt-.js} +3 -3
- package/dist/{ambient-client-defaults-zXLYCPYh.js.map → ambient-client-defaults-_b32vSt-.js.map} +1 -1
- package/dist/{asg-provider-vzD1uanW.js → asg-provider-DY41BqOf.js} +6 -6
- package/dist/{asg-provider-vzD1uanW.js.map → asg-provider-DY41BqOf.js.map} +1 -1
- package/dist/cli.js +3 -3
- package/dist/{custom-resource-runtime-5yuSHn1E.js → custom-resource-runtime-QfwICca8.js} +6 -6
- package/dist/{custom-resource-runtime-5yuSHn1E.js.map → custom-resource-runtime-QfwICca8.js.map} +1 -1
- package/dist/{db-associated-roles-D6FzrHrq.js → db-associated-roles-ChWaJgql.js} +2 -2
- package/dist/{db-associated-roles-D6FzrHrq.js.map → db-associated-roles-ChWaJgql.js.map} +1 -1
- package/dist/{delete-started-BYb5bEiw.js → delete-started-BAl80KJ-.js} +4 -4
- package/dist/{delete-started-BYb5bEiw.js.map → delete-started-BAl80KJ-.js.map} +1 -1
- package/dist/{deploy-engine-DIe64g1M.js → deploy-engine-BQral6za.js} +865 -855
- package/dist/deploy-engine-BQral6za.js.map +1 -0
- package/dist/{diff-calculator-e0X8wg5d.js → diff-calculator-Dj6UGllF.js} +297 -23
- package/dist/diff-calculator-Dj6UGllF.js.map +1 -0
- package/dist/{ec2-termination-protection-BhINWGSK.js → ec2-termination-protection-D1fp1UTY.js} +6 -6
- package/dist/{ec2-termination-protection-BhINWGSK.js.map → ec2-termination-protection-D1fp1UTY.js.map} +1 -1
- package/dist/{ecr-uri-B4jEXWEo.js → ecr-uri-BNOBWmtv.js} +2 -2
- package/dist/{ecr-uri-B4jEXWEo.js.map → ecr-uri-BNOBWmtv.js.map} +1 -1
- package/dist/{expected-bucket-owner-BiM4Hy8G.js → expected-bucket-owner-DvEnZMQG.js} +2 -2
- package/dist/{expected-bucket-owner-BiM4Hy8G.js.map → expected-bucket-owner-DvEnZMQG.js.map} +1 -1
- package/dist/{iam-role-provider-CRAkOXUR.js → iam-role-provider-DWk5DUSX.js} +8 -8
- package/dist/{iam-role-provider-CRAkOXUR.js.map → iam-role-provider-DWk5DUSX.js.map} +1 -1
- package/dist/{image-plan-BZ-0TCSM.js → image-plan-DQ0trmM_.js} +8 -8
- package/dist/{image-plan-BZ-0TCSM.js.map → image-plan-DQ0trmM_.js.map} +1 -1
- package/dist/index.d.ts +114 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -5
- package/dist/{logger-DGUlDiYH.js → logger-BmVyKPL2.js} +2 -2
- package/dist/{logger-DGUlDiYH.js.map → logger-BmVyKPL2.js.map} +1 -1
- package/dist/{neptune-provider-CHVuPvHJ.js → neptune-provider-CaTWycXB.js} +7 -7
- package/dist/{neptune-provider-CHVuPvHJ.js.map → neptune-provider-CaTWycXB.js.map} +1 -1
- package/dist/{program-pfwGZi1I.js → program-B8pMildk.js} +136 -24
- package/dist/program-B8pMildk.js.map +1 -0
- package/dist/{provider-classes-CaogwY3K.js → provider-classes-D3-D7HGf.js} +21 -21
- package/dist/{provider-classes-CaogwY3K.js.map → provider-classes-D3-D7HGf.js.map} +1 -1
- package/dist/{rds-provider-I6YAiIv3.js → rds-provider-BXsZQCfA.js} +10 -10
- package/dist/{rds-provider-I6YAiIv3.js.map → rds-provider-BXsZQCfA.js.map} +1 -1
- package/dist/{read-replica-BbDOKi8I.js → read-replica-CaWHwB3m.js} +3 -3
- package/dist/{read-replica-BbDOKi8I.js.map → read-replica-CaWHwB3m.js.map} +1 -1
- package/dist/{replacement-rules-DEMSUsSU.js → replacement-rules-BuvJdDDu.js} +3 -3
- package/dist/{replacement-rules-DEMSUsSU.js.map → replacement-rules-BuvJdDDu.js.map} +1 -1
- package/dist/{resource-deadline-B34RyqEU.js → resource-deadline-CB5xO4LO.js} +4 -4
- package/dist/{resource-deadline-B34RyqEU.js.map → resource-deadline-CB5xO4LO.js.map} +1 -1
- package/dist/{run-cli-D_mCCBi9.js → run-cli-DlUy-Xfz.js} +2 -2
- package/dist/{run-cli-D_mCCBi9.js.map → run-cli-DlUy-Xfz.js.map} +1 -1
- package/dist/{update-removal-Cr8BZ_MT.js → update-removal-i8K9a3aR.js} +22 -22
- package/dist/{update-removal-Cr8BZ_MT.js.map → update-removal-i8K9a3aR.js.map} +1 -1
- package/dist/{version-C3ovda8-.js → version-CK4KyY8m.js} +2 -2
- package/dist/{version-C3ovda8-.js.map → version-CK4KyY8m.js.map} +1 -1
- package/package.json +1 -1
- package/dist/deploy-engine-DIe64g1M.js.map +0 -1
- package/dist/diff-calculator-e0X8wg5d.js.map +0 -1
- package/dist/program-pfwGZi1I.js.map +0 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { A as displayStackName, C as STACK_REF_MAX_CODE_POINTS, D as displayAwsMessage, O as displayIdent, P as safeMsg, _ as shellQuote, k as displaySafe, m as proseQuoted, o as cdkdRemedy, p as plainOrDescribed, r as SHELL_ACTIVE, w as UNRENDERABLE } from "./version-
|
|
2
|
-
import { _ as currentLogLineMasker, l as describeAwsErrorDiagnostics, m as verboseAwareText, n as getLogger, p as safeStringify$1, r as isStdoutReservedForPayload, u as describeAwsFailure } from "./logger-
|
|
3
|
-
import { $ as AssetError, G as markRedactedCause, ct as SynthesisError, d as MacroExpansionError, et as CdkdError, it as LockError, k as escapeRegExp, lt as isSoftAbort, nt as DeploymentNotApprovedError, p as DependencyError, st as StateError, t as ambientClientDefaults } from "./ambient-client-defaults-
|
|
1
|
+
import { A as displayStackName, C as STACK_REF_MAX_CODE_POINTS, D as displayAwsMessage, O as displayIdent, P as safeMsg, _ as shellQuote, k as displaySafe, m as proseQuoted, o as cdkdRemedy, p as plainOrDescribed, r as SHELL_ACTIVE, w as UNRENDERABLE } from "./version-CK4KyY8m.js";
|
|
2
|
+
import { _ as currentLogLineMasker, l as describeAwsErrorDiagnostics, m as verboseAwareText, n as getLogger, p as safeStringify$1, r as isStdoutReservedForPayload, u as describeAwsFailure } from "./logger-BmVyKPL2.js";
|
|
3
|
+
import { $ as AssetError, G as markRedactedCause, ct as SynthesisError, d as MacroExpansionError, et as CdkdError, it as LockError, k as escapeRegExp, lt as isSoftAbort, nt as DeploymentNotApprovedError, p as DependencyError, st as StateError, t as ambientClientDefaults } from "./ambient-client-defaults-_b32vSt-.js";
|
|
4
4
|
import { n as awsClientDefaults, r as awsEndpointOverrideActive } from "./aws-client-defaults-DAebi99J.js";
|
|
5
5
|
import { l as s3ClientDefaults } from "./aws-clients-DOkPjjAW.js";
|
|
6
|
-
import {
|
|
7
|
-
import { A as describeJsonParseFailure, M as parseFailureDebugDetail, P as utf8ByteLength, d as getCreateOnlyPropertyPaths, j as jsonParseFailureStandIn, u as createOnlyChangeRequiresReplacement } from "./ec2-termination-protection-
|
|
6
|
+
import { Bo as promoteInPlaceAttributeDependents, Cl as isListParameterType, El as purgeNoncurrentKeyVersions, Fl as isDefaultBootstrapRepoName, Gl as warnAbsoluteAssetPath, Hl as isCfnTemplateAssetPath, Il as loadPublishableAssetManifest, Jc as withoutUnwrittenSdkUnwiredProperties, Kc as withoutAcceptedSdkUnwiredProperties, Kl as warnWholeAssemblyAsSource, Ko as referenceProvenanceOf, Ll as redirectDockerAsset, Ml as createLazyAssetModeContext, Mo as AWS_NO_VALUE, Nl as flattenAssetPlaceholders, Ol as rememberSynthesizedStacks, Pl as isDefaultBootstrapBucketName, Qc as TemplateParser, Rl as redirectFileAsset, Sl as SSM_PARAMETER_VALUE_PREFIX, Ss as movedMaskedProperties, Ul as parseAssetManifestBody, Wl as resolveFileAssetSourcePath, Wo as recordedProvenanceOf, _u as resolveAssemblyPath, as as replacementSidesForLog, au as getCdkdContainerRepoName, bs as inputFingerprinter, cs as isPlainReferenceTo, du as absoluteAssemblyPathEscape, fu as assemblyPathEscape, gl as missingStateBucketRemedy, gu as renderAssemblyPathEscape, hl as stringifyValue, hu as namesTheSameDirectory, il as rebuildClientForBucketRegion, is as markNewValueKnownAfterDeploy, iu as getCdkdAssetBucketName, lu as nullPrototypeRecord, mu as displayAssemblyPath, nc as refuseMalformedResourceProperties, ns as INTRINSIC_KEYS, os as siblingsOf, ou as defineOwnKey, pu as describeFileReadFailure, qo as referenceTokensIn, qs as refuseMalformedResourceEntriesForDeploy, rs as containsIntrinsic, tl as isKnownTokenFreeState, ts as namesRecreatedParent, wl as ssmResolvedValueType, yl as listNestedTemplateRows, ys as tryGetTopLevelWriteOnlyProperties, yu as resolveBucketRegion, zo as extractGetAttRefs } from "./deploy-engine-BQral6za.js";
|
|
7
|
+
import { A as describeJsonParseFailure, M as parseFailureDebugDetail, P as utf8ByteLength, d as getCreateOnlyPropertyPaths, j as jsonParseFailureStandIn, u as createOnlyChangeRequiresReplacement } from "./ec2-termination-protection-D1fp1UTY.js";
|
|
8
8
|
import { r as derivePartitionAndUrlSuffix } from "./aws-partition-DA0r2sr-.js";
|
|
9
|
-
import { t as
|
|
10
|
-
import {
|
|
11
|
-
import { _t as acceptedCreateOnlyDropsOf } from "./delete-started-
|
|
12
|
-
import { pn as splitGetAttStringForm, t as ReplacementRulesRegistry } from "./replacement-rules-
|
|
13
|
-
import { E as unsettledPropertiesOf } from "./resource-deadline-
|
|
9
|
+
import { $t as buildForceUnlockCommand, Qt as UNREPRODUCIBLE_LOCK_CLAUSE, Rt as maskerOrIdentity, dn as withPasteableAwsProfile, fn as injectiveKey, in as formatLockOwner, nn as formatLockExpiry, rn as formatLockOperation } from "./update-removal-i8K9a3aR.js";
|
|
10
|
+
import { t as expectedOwnerParam } from "./expected-bucket-owner-DvEnZMQG.js";
|
|
11
|
+
import { _t as acceptedCreateOnlyDropsOf } from "./delete-started-BAl80KJ-.js";
|
|
12
|
+
import { pn as splitGetAttStringForm, t as ReplacementRulesRegistry } from "./replacement-rules-BuvJdDDu.js";
|
|
13
|
+
import { E as unsettledPropertiesOf } from "./resource-deadline-CB5xO4LO.js";
|
|
14
14
|
import { randomBytes, randomUUID } from "node:crypto";
|
|
15
15
|
import { AbortMultipartUploadCommand, DeleteObjectCommand, GetObjectCommand, HeadObjectCommand, NoSuchKey, PutObjectCommand, S3Client, S3ServiceException } from "@aws-sdk/client-s3";
|
|
16
16
|
import { CloudControlClient, GetResourceCommand, ListResourcesCommand } from "@aws-sdk/client-cloudcontrol";
|
|
@@ -22,14 +22,14 @@ import { GetHostedZoneCommand, ListHostedZonesByNameCommand, Route53Client } fro
|
|
|
22
22
|
import * as fs from "node:fs";
|
|
23
23
|
import { createReadStream, existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
24
24
|
import * as path from "node:path";
|
|
25
|
-
import { basename, isAbsolute, join, resolve } from "node:path";
|
|
25
|
+
import { basename, extname, isAbsolute, join, resolve } from "node:path";
|
|
26
26
|
import { spawn } from "node:child_process";
|
|
27
27
|
import { homedir, tmpdir } from "node:os";
|
|
28
|
+
import { CreateRepositoryCommand, DescribeImagesCommand as DescribeImagesCommand$1, DescribeRepositoriesCommand, ECRClient, GetAuthorizationTokenCommand } from "@aws-sdk/client-ecr";
|
|
29
|
+
import { isAbsolute as isAbsolute$1, resolve as resolve$1 } from "path";
|
|
28
30
|
import { DescribeListenersCommand, DescribeLoadBalancersCommand, ElasticLoadBalancingV2Client } from "@aws-sdk/client-elastic-load-balancing-v2";
|
|
29
31
|
import { KMSClient, ListAliasesCommand } from "@aws-sdk/client-kms";
|
|
30
|
-
import { isAbsolute as isAbsolute$1, resolve as resolve$1 } from "path";
|
|
31
32
|
import { Upload } from "@aws-sdk/lib-storage";
|
|
32
|
-
import { DescribeImagesCommand as DescribeImagesCommand$1, ECRClient, GetAuthorizationTokenCommand } from "@aws-sdk/client-ecr";
|
|
33
33
|
import { dockerRegistryEnv } from "cdk-local/internal";
|
|
34
34
|
import { inspect } from "node:util";
|
|
35
35
|
import { hostname } from "os";
|
|
@@ -203,7 +203,7 @@ const MESSAGE_ENTRY_TYPES = {
|
|
|
203
203
|
"aws:cdk:warning": "warning",
|
|
204
204
|
"aws:cdk:info": "info"
|
|
205
205
|
};
|
|
206
|
-
function
|
|
206
|
+
function readMergedStackMetadata(assemblyDir, artifact) {
|
|
207
207
|
const merged = { ...artifact.metadata ?? {} };
|
|
208
208
|
if (artifact.additionalMetadataFile) {
|
|
209
209
|
const resolved = resolveAssemblyPath(assemblyDir, artifact.additionalMetadataFile);
|
|
@@ -221,6 +221,9 @@ function collectStackMessages(assemblyDir, artifact) {
|
|
|
221
221
|
throw new SynthesisError(`Failed to read stack metadata file ${displayAssemblyPath(metadataPath)}: ${describeFileReadFailure(error, metadataPath)}`);
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
|
+
return merged;
|
|
225
|
+
}
|
|
226
|
+
function stackMessagesFromMetadata(merged) {
|
|
224
227
|
const messages = [];
|
|
225
228
|
for (const [path, entries] of Object.entries(merged)) {
|
|
226
229
|
if (!Array.isArray(entries)) continue;
|
|
@@ -257,6 +260,241 @@ function processStackMessages(stacks, logger, options = {}) {
|
|
|
257
260
|
if (hasWarnings && failAt === "warn") throw new SynthesisError("Found warnings (--strict mode)");
|
|
258
261
|
}
|
|
259
262
|
|
|
263
|
+
// src/assets/cdk-toolkit-bucket.ts
|
|
264
|
+
var CdkToolkitBucketMissingError = class CdkToolkitBucketMissingError extends AssetError {
|
|
265
|
+
constructor(message) {
|
|
266
|
+
super(message);
|
|
267
|
+
this.name = "CdkToolkitBucketMissingError";
|
|
268
|
+
Object.setPrototypeOf(this, CdkToolkitBucketMissingError.prototype);
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
const CDK_TOOLKIT_STACK_NAME = "CDKToolkit";
|
|
272
|
+
async function lookupCdkToolkitBucket(region, accountId) {
|
|
273
|
+
const { CloudFormationClient, DescribeStacksCommand } = await import("@aws-sdk/client-cloudformation");
|
|
274
|
+
const client = new CloudFormationClient({
|
|
275
|
+
...ambientClientDefaults(),
|
|
276
|
+
region
|
|
277
|
+
});
|
|
278
|
+
const remedy = `Run ${proseQuoted(`cdk bootstrap aws://${accountId}/${region}`)}, or ${proseQuoted(cdkdRemedy("cdkd bootstrap"))} to publish them to cdkd-owned asset storage instead.`;
|
|
279
|
+
try {
|
|
280
|
+
let bucket;
|
|
281
|
+
try {
|
|
282
|
+
bucket = (await client.send(new DescribeStacksCommand({ StackName: CDK_TOOLKIT_STACK_NAME }))).Stacks?.[0]?.Outputs?.find((o) => o.OutputKey === "BucketName")?.OutputValue;
|
|
283
|
+
} catch (error) {
|
|
284
|
+
const message = error.message ?? "";
|
|
285
|
+
if (!/does not exist/.test(message)) throw new AssetError(`Could not read the ${CDK_TOOLKIT_STACK_NAME} stack in ${displaySafe(region)} to find the asset bucket for LegacyStackSynthesizer assets: ${displaySafe(message)}`, error instanceof Error ? error : void 0);
|
|
286
|
+
}
|
|
287
|
+
if (!bucket) throw new CdkToolkitBucketMissingError(`This stack uses LegacyStackSynthesizer assets, so it needs the ${CDK_TOOLKIT_STACK_NAME} stack's asset bucket in ${displaySafe(region)}, and none was found. ${remedy}`);
|
|
288
|
+
return bucket;
|
|
289
|
+
} finally {
|
|
290
|
+
client.destroy();
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
// src/assets/legacy-synthesizer-assets.ts
|
|
295
|
+
const LEGACY_DESTINATION_ID = "legacy-synthesizer";
|
|
296
|
+
const LEGACY_ASSET_METADATA_TYPE = "aws:cdk:asset";
|
|
297
|
+
const ASSET_PREFIX_SEPARATOR = "||";
|
|
298
|
+
function legacyAssetEntriesFromMetadata(metadata) {
|
|
299
|
+
const entries = [];
|
|
300
|
+
for (const list of Object.values(metadata)) {
|
|
301
|
+
if (!Array.isArray(list)) continue;
|
|
302
|
+
for (const entry of list) {
|
|
303
|
+
if (entry?.type !== "aws:cdk:asset") continue;
|
|
304
|
+
const data = entry.data;
|
|
305
|
+
if (data === null || typeof data !== "object" || Array.isArray(data)) continue;
|
|
306
|
+
entries.push(data);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
return entries;
|
|
310
|
+
}
|
|
311
|
+
function legacyEntriesNeedFileBucket(entries) {
|
|
312
|
+
return entries.some((e) => e.packaging === "file" || e.packaging === "zip");
|
|
313
|
+
}
|
|
314
|
+
function imageDestinationKey(repositoryName, imageTag) {
|
|
315
|
+
return injectiveKey(repositoryName, imageTag);
|
|
316
|
+
}
|
|
317
|
+
const LEGACY_DEFAULT_IMAGE_REPOSITORY = "aws-cdk/assets";
|
|
318
|
+
function entryLabel(entry) {
|
|
319
|
+
const id = entry["id"];
|
|
320
|
+
return typeof id === "string" ? id : "<no id>";
|
|
321
|
+
}
|
|
322
|
+
function requireString(entry, field) {
|
|
323
|
+
const value = entry[field];
|
|
324
|
+
if (typeof value !== "string" || value.length === 0) throw new AssetError(`Invalid LegacyStackSynthesizer asset metadata: field ${displayIdent(field)} is missing or not a string in asset ${displayIdent(entryLabel(entry))}`);
|
|
325
|
+
return value;
|
|
326
|
+
}
|
|
327
|
+
function buildLegacyAssetPlan(entries, target) {
|
|
328
|
+
const files = nullPrototypeRecord();
|
|
329
|
+
const dockerImages = nullPrototypeRecord();
|
|
330
|
+
const parameters = nullPrototypeRecord();
|
|
331
|
+
const repositoriesToEnsure = /* @__PURE__ */ new Set();
|
|
332
|
+
const recognizedImageDestinations = /* @__PURE__ */ new Set();
|
|
333
|
+
for (const entry of entries) switch (entry.packaging) {
|
|
334
|
+
case "zip":
|
|
335
|
+
case "file": {
|
|
336
|
+
const id = requireString(entry, "id");
|
|
337
|
+
const sourceHash = requireString(entry, "sourceHash");
|
|
338
|
+
const assetPath = requireString(entry, "path");
|
|
339
|
+
const s3BucketParameter = requireString(entry, "s3BucketParameter");
|
|
340
|
+
const s3KeyParameter = requireString(entry, "s3KeyParameter");
|
|
341
|
+
const artifactHashParameter = requireString(entry, "artifactHashParameter");
|
|
342
|
+
const bucketName = target.fileBucket;
|
|
343
|
+
if (bucketName === void 0) throw new Error("buildLegacyAssetPlan: a file asset needs fileBucket");
|
|
344
|
+
const baseName = `${sourceHash}${entry.packaging === "zip" ? ".zip" : extname(assetPath)}`;
|
|
345
|
+
const s3Prefix = target.rootKeys ? "" : id === sourceHash ? "assets/" : `assets/${id}/`;
|
|
346
|
+
files[sourceHash] = {
|
|
347
|
+
displayName: id,
|
|
348
|
+
source: {
|
|
349
|
+
path: assetPath,
|
|
350
|
+
packaging: entry.packaging
|
|
351
|
+
},
|
|
352
|
+
destinations: { [LEGACY_DESTINATION_ID]: {
|
|
353
|
+
bucketName,
|
|
354
|
+
objectKey: `${s3Prefix}${baseName}`,
|
|
355
|
+
region: target.region
|
|
356
|
+
} }
|
|
357
|
+
};
|
|
358
|
+
parameters[s3BucketParameter] = bucketName;
|
|
359
|
+
parameters[s3KeyParameter] = `${s3Prefix}${"||"}${baseName}`;
|
|
360
|
+
parameters[artifactHashParameter] = sourceHash;
|
|
361
|
+
break;
|
|
362
|
+
}
|
|
363
|
+
case "container-image": {
|
|
364
|
+
const image = entry;
|
|
365
|
+
const id = requireString(entry, "id");
|
|
366
|
+
const sourceHash = requireString(entry, "sourceHash");
|
|
367
|
+
const directory = requireString(entry, "path");
|
|
368
|
+
if (!image.imageNameParameter && (!image.repositoryName || !image.imageTag)) throw new AssetError(`Invalid Docker image asset configuration: "repositoryName" and "imageTag" are required when "imageNameParameter" is left out (asset ${displayIdent(id)})`);
|
|
369
|
+
const repositoryName = image.repositoryName ?? "cdk/" + id.replace(/[:/]/g, "-").toLowerCase();
|
|
370
|
+
const imageTag = image.imageTag ?? sourceHash;
|
|
371
|
+
dockerImages[sourceHash] = {
|
|
372
|
+
displayName: id,
|
|
373
|
+
source: {
|
|
374
|
+
directory,
|
|
375
|
+
...image.buildArgs && { dockerBuildArgs: image.buildArgs },
|
|
376
|
+
...image.buildContexts && { dockerBuildContexts: image.buildContexts },
|
|
377
|
+
...image.buildSecrets && { dockerBuildSecrets: image.buildSecrets },
|
|
378
|
+
...image.buildSsh && { dockerBuildSsh: image.buildSsh },
|
|
379
|
+
...image.target && { dockerBuildTarget: image.target },
|
|
380
|
+
...image.file && { dockerFile: image.file },
|
|
381
|
+
...image.networkMode && { networkMode: image.networkMode },
|
|
382
|
+
...image.platform && { platform: image.platform },
|
|
383
|
+
...image.outputs && { dockerOutputs: image.outputs },
|
|
384
|
+
...image.cacheFrom && { cacheFrom: image.cacheFrom },
|
|
385
|
+
...image.cacheTo && { cacheTo: image.cacheTo },
|
|
386
|
+
...image.cacheDisabled && { cacheDisabled: true }
|
|
387
|
+
},
|
|
388
|
+
destinations: { [LEGACY_DESTINATION_ID]: {
|
|
389
|
+
repositoryName,
|
|
390
|
+
imageTag,
|
|
391
|
+
region: target.region
|
|
392
|
+
} }
|
|
393
|
+
};
|
|
394
|
+
repositoriesToEnsure.add(repositoryName);
|
|
395
|
+
if (repositoryName === "aws-cdk/assets" && imageTag === sourceHash) recognizedImageDestinations.add(imageDestinationKey(repositoryName, imageTag));
|
|
396
|
+
if (image.imageNameParameter) {
|
|
397
|
+
const { urlSuffix } = derivePartitionAndUrlSuffix(target.region);
|
|
398
|
+
parameters[image.imageNameParameter] = `${target.accountId}.dkr.ecr.${target.region}.${urlSuffix}/${repositoryName}:${imageTag}`;
|
|
399
|
+
}
|
|
400
|
+
break;
|
|
401
|
+
}
|
|
402
|
+
default: {
|
|
403
|
+
const packaging = entry.packaging;
|
|
404
|
+
throw new AssetError(`Unsupported packaging type: ${displayIdent(typeof packaging === "string" ? packaging : JSON.stringify(packaging))} in a LegacyStackSynthesizer asset. cdkd publishes file, zip and container-image assets.`);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
return {
|
|
408
|
+
manifest: {
|
|
409
|
+
version: "legacy-synthesizer",
|
|
410
|
+
files,
|
|
411
|
+
dockerImages
|
|
412
|
+
},
|
|
413
|
+
parameters: { ...parameters },
|
|
414
|
+
repositoriesToEnsure,
|
|
415
|
+
recognizedImageDestinations
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
function legacyPlanAssetCount(plan) {
|
|
419
|
+
return Object.keys(plan.manifest.files).length + Object.keys(plan.manifest.dockerImages).length;
|
|
420
|
+
}
|
|
421
|
+
function bindLegacyAssetParameters(template, parameters) {
|
|
422
|
+
const declared = template.Parameters;
|
|
423
|
+
if (!declared) return 0;
|
|
424
|
+
let bound = 0;
|
|
425
|
+
for (const [name, value] of Object.entries(parameters)) {
|
|
426
|
+
if (!Object.hasOwn(declared, name)) continue;
|
|
427
|
+
const decl = declared[name];
|
|
428
|
+
if (decl === null || typeof decl !== "object") continue;
|
|
429
|
+
decl.Default = value;
|
|
430
|
+
bound++;
|
|
431
|
+
}
|
|
432
|
+
return bound;
|
|
433
|
+
}
|
|
434
|
+
function predictedAutoCreatedAssetMode(accountId, region) {
|
|
435
|
+
return {
|
|
436
|
+
mode: "cdkd-assets",
|
|
437
|
+
marker: {
|
|
438
|
+
assetBucket: getCdkdAssetBucketName(accountId, region),
|
|
439
|
+
containerRepo: getCdkdContainerRepoName(accountId, region),
|
|
440
|
+
assetSupportVersion: 1,
|
|
441
|
+
createdAt: (/* @__PURE__ */ new Date(0)).toISOString()
|
|
442
|
+
}
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
const toolkitBucketCache = /* @__PURE__ */ new Map();
|
|
446
|
+
async function prepareLegacyStackAssets(stack, opts) {
|
|
447
|
+
const legacy = stack.legacyAssets;
|
|
448
|
+
if (!legacy || legacy.entries.length === 0) return void 0;
|
|
449
|
+
if (stack.assetManifestPath && loadPublishableAssetManifest(stack.assetManifestPath)) throw new AssetError(`Stack ${displayIdent(stack.stackName)} carries both an asset manifest and LegacyStackSynthesizer asset metadata (aws:cdk:asset). No aws-cdk-lib synthesizer writes both; cdkd refuses rather than publish only one of the two sets.`);
|
|
450
|
+
let fileBucket;
|
|
451
|
+
let rootKeys = false;
|
|
452
|
+
if (legacyEntriesNeedFileBucket(legacy.entries)) {
|
|
453
|
+
const assetMode = typeof opts.assetMode === "function" ? await opts.assetMode() : opts.assetMode;
|
|
454
|
+
if (assetMode.mode === "cdkd-assets") {
|
|
455
|
+
fileBucket = assetMode.marker.assetBucket;
|
|
456
|
+
rootKeys = true;
|
|
457
|
+
} else {
|
|
458
|
+
const key = injectiveKey(opts.accountId, opts.region);
|
|
459
|
+
let pending = toolkitBucketCache.get(key);
|
|
460
|
+
if (!pending) {
|
|
461
|
+
pending = lookupCdkToolkitBucket(opts.region, opts.accountId);
|
|
462
|
+
pending.catch(() => toolkitBucketCache.delete(key));
|
|
463
|
+
toolkitBucketCache.set(key, pending);
|
|
464
|
+
}
|
|
465
|
+
fileBucket = await pending;
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
const plan = buildLegacyAssetPlan(legacy.entries, {
|
|
469
|
+
fileBucket,
|
|
470
|
+
accountId: opts.accountId,
|
|
471
|
+
region: opts.region,
|
|
472
|
+
rootKeys
|
|
473
|
+
});
|
|
474
|
+
bindLegacyAssetParameters(stack.template, plan.parameters);
|
|
475
|
+
return plan;
|
|
476
|
+
}
|
|
477
|
+
function createLegacyAssetParameterBinder(context) {
|
|
478
|
+
return async (stack, region, override) => {
|
|
479
|
+
if (!stack.legacyAssets) return void 0;
|
|
480
|
+
const accountId = await context.accountId();
|
|
481
|
+
let resolved;
|
|
482
|
+
await prepareLegacyStackAssets(stack, {
|
|
483
|
+
assetMode: async () => resolved = override?.assetMode ?? await context.resolveMode(region),
|
|
484
|
+
accountId,
|
|
485
|
+
region
|
|
486
|
+
});
|
|
487
|
+
return resolved;
|
|
488
|
+
};
|
|
489
|
+
}
|
|
490
|
+
async function bindLegacyStackAssetParameters(stack, region, opts) {
|
|
491
|
+
if (!stack.legacyAssets) return;
|
|
492
|
+
await createLegacyAssetParameterBinder(createLazyAssetModeContext({
|
|
493
|
+
...opts,
|
|
494
|
+
suppressLegacyNotice: true
|
|
495
|
+
}))(stack, region);
|
|
496
|
+
}
|
|
497
|
+
|
|
260
498
|
// src/synthesis/failed-stages.ts
|
|
261
499
|
var StageLoadError = class StageLoadError extends SynthesisError {
|
|
262
500
|
constructor(message) {
|
|
@@ -432,6 +670,8 @@ var AssemblyReader = class {
|
|
|
432
670
|
nestedTemplates[logicalId] = resolvedNested.path;
|
|
433
671
|
}
|
|
434
672
|
const lookupRoleArn = props?.lookupRole?.arn;
|
|
673
|
+
const metadata = readMergedStackMetadata(assemblyDir, artifact);
|
|
674
|
+
const legacyAssetEntries = legacyAssetEntriesFromMetadata(metadata);
|
|
435
675
|
return {
|
|
436
676
|
stackName,
|
|
437
677
|
displayName: artifact.displayName ?? stackName,
|
|
@@ -445,7 +685,11 @@ var AssemblyReader = class {
|
|
|
445
685
|
...props?.terminationProtection !== void 0 && { terminationProtection: props.terminationProtection },
|
|
446
686
|
...Object.keys(nestedTemplates).length > 0 && { nestedTemplates },
|
|
447
687
|
...typeof lookupRoleArn === "string" && { lookupRoleArn },
|
|
448
|
-
|
|
688
|
+
...legacyAssetEntries.length > 0 && { legacyAssets: {
|
|
689
|
+
entries: legacyAssetEntries,
|
|
690
|
+
assemblyDir
|
|
691
|
+
} },
|
|
692
|
+
messages: stackMessagesFromMetadata(metadata)
|
|
449
693
|
};
|
|
450
694
|
}
|
|
451
695
|
hasAssets(stackInfo) {
|
|
@@ -1755,7 +1999,7 @@ async function resolveStateBucketWithDefaultAndSource(cliBucket, region, legacyF
|
|
|
1755
1999
|
const { GetCallerIdentityCommand } = await import("@aws-sdk/client-sts");
|
|
1756
2000
|
const { S3Client, HeadBucketCommand, ListObjectsV2Command } = await import("@aws-sdk/client-s3");
|
|
1757
2001
|
const { getAwsClients } = await import("./aws-clients-DOkPjjAW.js").then((n) => n.n);
|
|
1758
|
-
const { expectedOwnerParam, recordResolvedAccountId } = await import("./expected-bucket-owner-
|
|
2002
|
+
const { expectedOwnerParam, recordResolvedAccountId } = await import("./expected-bucket-owner-DvEnZMQG.js").then((n) => n.n);
|
|
1759
2003
|
const probeDeps = {
|
|
1760
2004
|
HeadBucketCommand,
|
|
1761
2005
|
ListObjectsV2Command,
|
|
@@ -3197,7 +3441,7 @@ var DockerAssetPublisher = class {
|
|
|
3197
3441
|
refuseDockerAssetUnderAwsEmulator(asset.displayName || localTag);
|
|
3198
3442
|
await this.buildImage(asset, cdkOutputDir, localTag, assetOutdir);
|
|
3199
3443
|
}
|
|
3200
|
-
async push(asset, accountId, region, localTag) {
|
|
3444
|
+
async push(asset, accountId, region, localTag, ensureRepository = false) {
|
|
3201
3445
|
refuseDockerAssetUnderAwsEmulator(asset.displayName || localTag);
|
|
3202
3446
|
for (const [, dest] of Object.entries(asset.destinations)) {
|
|
3203
3447
|
const repositoryName = this.resolvePlaceholders(dest.repositoryName, accountId, region);
|
|
@@ -3210,6 +3454,7 @@ var DockerAssetPublisher = class {
|
|
|
3210
3454
|
region: destRegion
|
|
3211
3455
|
});
|
|
3212
3456
|
try {
|
|
3457
|
+
if (ensureRepository) await this.ensureRepositoryExists(client, repositoryName);
|
|
3213
3458
|
if (await this.imageExists(client, repositoryName, imageTag)) {
|
|
3214
3459
|
this.logger.debug(`Image already exists, skipping: ${ecrUri}`);
|
|
3215
3460
|
continue;
|
|
@@ -3221,6 +3466,26 @@ var DockerAssetPublisher = class {
|
|
|
3221
3466
|
}
|
|
3222
3467
|
}
|
|
3223
3468
|
}
|
|
3469
|
+
async ensureRepositoryExists(client, repositoryName) {
|
|
3470
|
+
try {
|
|
3471
|
+
if (((await client.send(new DescribeRepositoriesCommand({ repositoryNames: [repositoryName] }))).repositories?.length ?? 0) > 0) return;
|
|
3472
|
+
} catch (error) {
|
|
3473
|
+
if (error.name !== "RepositoryNotFoundException") throw error;
|
|
3474
|
+
}
|
|
3475
|
+
this.logger.debug(safeMsg`Creating ECR repository ${repositoryName}`);
|
|
3476
|
+
try {
|
|
3477
|
+
await client.send(new CreateRepositoryCommand({
|
|
3478
|
+
repositoryName,
|
|
3479
|
+
tags: [{
|
|
3480
|
+
Key: "awscdk:asset",
|
|
3481
|
+
Value: "true"
|
|
3482
|
+
}],
|
|
3483
|
+
imageScanningConfiguration: { scanOnPush: true }
|
|
3484
|
+
}));
|
|
3485
|
+
} catch (error) {
|
|
3486
|
+
if (error.name !== "RepositoryAlreadyExistsException") throw error;
|
|
3487
|
+
}
|
|
3488
|
+
}
|
|
3224
3489
|
async imageExists(client, repositoryName, imageTag) {
|
|
3225
3490
|
try {
|
|
3226
3491
|
return ((await client.send(new DescribeImagesCommand$1({
|
|
@@ -3423,13 +3688,21 @@ var AssetPublisher = class {
|
|
|
3423
3688
|
const content = readFileSync(manifestPath, "utf-8");
|
|
3424
3689
|
const manifest = parseAssetManifestBody(content, manifestPath);
|
|
3425
3690
|
const cdkOutputDir = manifestPath.replace(/\/[^/]+$/, "");
|
|
3691
|
+
return this.addManifestToGraph(graph, manifest, {
|
|
3692
|
+
...options,
|
|
3693
|
+
cdkOutputDir
|
|
3694
|
+
});
|
|
3695
|
+
}
|
|
3696
|
+
addManifestToGraph(graph, manifest, options) {
|
|
3697
|
+
const cdkOutputDir = options.cdkOutputDir;
|
|
3426
3698
|
const assetOutdir = options.assetOutdir ?? cdkOutputDir;
|
|
3427
3699
|
const prefix = options.nodePrefix || "";
|
|
3428
3700
|
const redirect = options.redirect;
|
|
3701
|
+
const warnBuckets = options.bucketsChosenByCdkd !== true;
|
|
3429
3702
|
const nodeIds = [];
|
|
3430
3703
|
const fileAssets = Object.entries(manifest.files || {}).filter(([, asset]) => !isCfnTemplateAssetPath(asset.source.path)).map(([hash, asset]) => [hash, redirect ? redirectFileAsset(asset, redirect) : asset]);
|
|
3431
3704
|
for (const [hash, asset] of fileAssets) {
|
|
3432
|
-
for (const dest of Object.values(asset.destinations)) {
|
|
3705
|
+
for (const dest of warnBuckets ? Object.values(asset.destinations) : []) {
|
|
3433
3706
|
const destRegion = dest.region ?? options.region;
|
|
3434
3707
|
const name = flattenAssetPlaceholders(dest.bucketName, options.accountId, destRegion);
|
|
3435
3708
|
warnUnrecognizedAssetDestination({
|
|
@@ -3465,7 +3738,7 @@ var AssetPublisher = class {
|
|
|
3465
3738
|
warnUnrecognizedAssetDestination({
|
|
3466
3739
|
kind: "repository",
|
|
3467
3740
|
name,
|
|
3468
|
-
recognized: isDefaultBootstrapRepoName(name, options.accountId, destRegion) || redirect !== void 0 && [...redirect.repos.values()].includes(name)
|
|
3741
|
+
recognized: isDefaultBootstrapRepoName(name, options.accountId, destRegion) || options.recognizedImageDestinations?.has(imageDestinationKey(name, dest.imageTag)) === true || redirect !== void 0 && [...redirect.repos.values()].includes(name)
|
|
3469
3742
|
});
|
|
3470
3743
|
}
|
|
3471
3744
|
const localTag = `cdkd-asset-${hash}`;
|
|
@@ -3495,7 +3768,8 @@ var AssetPublisher = class {
|
|
|
3495
3768
|
asset,
|
|
3496
3769
|
accountId: options.accountId,
|
|
3497
3770
|
region: options.region,
|
|
3498
|
-
localTag
|
|
3771
|
+
localTag,
|
|
3772
|
+
...Object.values(asset.destinations).some((d) => options.repositoriesToEnsure?.has(d.repositoryName)) && { ensureRepository: true }
|
|
3499
3773
|
}
|
|
3500
3774
|
});
|
|
3501
3775
|
nodeIds.push(publishNodeId);
|
|
@@ -3507,7 +3781,7 @@ var AssetPublisher = class {
|
|
|
3507
3781
|
const data = node.data;
|
|
3508
3782
|
if (data.kind === "file") await this.filePublisher.publish(data.hash, data.asset, data.cdkOutputDir, data.accountId, data.region, data.assetOutdir);
|
|
3509
3783
|
else if (data.kind === "docker-build") await this.dockerPublisher.build(data.asset, data.cdkOutputDir, data.localTag, data.assetOutdir);
|
|
3510
|
-
else if (data.kind === "docker-publish") await this.dockerPublisher.push(data.asset, data.accountId, data.region, data.localTag);
|
|
3784
|
+
else if (data.kind === "docker-publish") await this.dockerPublisher.push(data.asset, data.accountId, data.region, data.localTag, data.ensureRepository === true);
|
|
3511
3785
|
this.logger.debug(`✅ ${node.id}`);
|
|
3512
3786
|
}
|
|
3513
3787
|
async publishFromManifest(manifestPath, options = {}) {
|
|
@@ -5092,5 +5366,5 @@ var DiffCalculator = class {
|
|
|
5092
5366
|
}
|
|
5093
5367
|
};
|
|
5094
5368
|
|
|
5095
|
-
export { loadCdkJson as A, warnDeprecatedNoPrefixCliFlag as B, runDockerForeground as C, synthesisStatusMessage as D, Synthesizer as E, resolveStateBucketWithDefault as F, uploadCfnTemplate as G, CFN_TEMPLATE_URL_LIMIT as H, resolveStateBucketWithDefaultAndSource as I, StageLoadError as J, refuseFailedLookups as K, resolveStateBucketWithSource as L, resolveAutoAssetStorage as M, resolveCaptureObservedState as N, getDefaultStateBucketName as O, resolveSkipPrefix as P,
|
|
5096
|
-
//# sourceMappingURL=diff-calculator-
|
|
5369
|
+
export { prepareLegacyStackAssets as $, loadCdkJson as A, warnDeprecatedNoPrefixCliFlag as B, runDockerForeground as C, synthesisStatusMessage as D, Synthesizer as E, resolveStateBucketWithDefault as F, uploadCfnTemplate as G, CFN_TEMPLATE_URL_LIMIT as H, resolveStateBucketWithDefaultAndSource as I, StageLoadError as J, refuseFailedLookups as K, resolveStateBucketWithSource as L, resolveAutoAssetStorage as M, resolveCaptureObservedState as N, getDefaultStateBucketName as O, resolveSkipPrefix as P, predictedAutoCreatedAssetMode as Q, resolveUseCdkBootstrapAssets as R, getDockerCmd as S, abortInFlightMultipartUploads as T, MIGRATE_TMP_PREFIX as U, CFN_TEMPLATE_BODY_LIMIT as V, findLargeInlineResources as W, createLegacyAssetParameterBinder as X, bindLegacyStackAssetParameters as Y, legacyPlanAssetCount as Z, partitionSensitiveEnv as _, AssetPublisher as a, isMalformedEnvKey as b, resolveDockerContextDirectory as c, describeDockerFailure as d, CdkToolkitBucketMissingError as et, redactedCause as f, finchSecretArgvRefusal as g, dockerSpawnEnvWithSensitive as h, isLockInfoExpired as i, injectedAwsRegionValue as it, resolveApp as j, getLegacyStateBucketName as k, describeDockerCapturedOutput as l, redactDockerArgvValues as m, DagBuilder as n, setChildProcessAwsEnv as nt, WorkGraph as o, redactedDockerCause as p, AssemblyReader as q, LockManager as r, injectAwsRegion as rt, buildDockerImage as s, DiffCalculator as t, processStackMessages as tt, describeDockerExecFailure as u, warnFinchArgvExposure as v, runDockerStreaming as w, formatDockerLoginError as x, isDockerClientEnvKey as y, stateBucketExistenceConfirmed as z };
|
|
5370
|
+
//# sourceMappingURL=diff-calculator-Dj6UGllF.js.map
|