@cdkd/cli 0.352.12 → 0.353.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ambient-client-defaults-zXLYCPYh.js → ambient-client-defaults-z2kbR8l-.js} +3 -3
- package/dist/{ambient-client-defaults-zXLYCPYh.js.map → ambient-client-defaults-z2kbR8l-.js.map} +1 -1
- package/dist/{asg-provider-vzD1uanW.js → asg-provider-CM19nSRR.js} +14 -9
- package/dist/asg-provider-CM19nSRR.js.map +1 -0
- package/dist/cli.js +3 -3
- package/dist/{custom-resource-runtime-5yuSHn1E.js → custom-resource-runtime-gD0yCVTA.js} +6 -6
- package/dist/{custom-resource-runtime-5yuSHn1E.js.map → custom-resource-runtime-gD0yCVTA.js.map} +1 -1
- package/dist/{db-associated-roles-D6FzrHrq.js → db-associated-roles-CwKvJHmW.js} +2 -2
- package/dist/{db-associated-roles-D6FzrHrq.js.map → db-associated-roles-CwKvJHmW.js.map} +1 -1
- package/dist/{delete-started-BYb5bEiw.js → delete-started-BR6VF4-U.js} +4 -4
- package/dist/{delete-started-BYb5bEiw.js.map → delete-started-BR6VF4-U.js.map} +1 -1
- package/dist/{deploy-engine-DIe64g1M.js → deploy-engine-axD9sX_9.js} +1493 -1056
- package/dist/deploy-engine-axD9sX_9.js.map +1 -0
- package/dist/{diff-calculator-e0X8wg5d.js → diff-calculator-Dych6a6c.js} +302 -23
- package/dist/diff-calculator-Dych6a6c.js.map +1 -0
- package/dist/{ecr-uri-B4jEXWEo.js → ecr-uri-CmjaicP1.js} +2 -2
- package/dist/{ecr-uri-B4jEXWEo.js.map → ecr-uri-CmjaicP1.js.map} +1 -1
- package/dist/{expected-bucket-owner-BiM4Hy8G.js → expected-bucket-owner-BUXAXOgl.js} +2 -2
- package/dist/{expected-bucket-owner-BiM4Hy8G.js.map → expected-bucket-owner-BUXAXOgl.js.map} +1 -1
- package/dist/{iam-role-provider-CRAkOXUR.js → iam-role-provider-C92_i6aW.js} +8 -8
- package/dist/{iam-role-provider-CRAkOXUR.js.map → iam-role-provider-C92_i6aW.js.map} +1 -1
- package/dist/{image-plan-BZ-0TCSM.js → image-plan-Cu3b26DY.js} +10 -8
- package/dist/image-plan-Cu3b26DY.js.map +1 -0
- package/dist/index.d.ts +121 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -5
- package/dist/{logger-DGUlDiYH.js → logger-oZMfcKSj.js} +2 -2
- package/dist/{logger-DGUlDiYH.js.map → logger-oZMfcKSj.js.map} +1 -1
- package/dist/{neptune-provider-CHVuPvHJ.js → neptune-provider-CN3MA8Cw.js} +7 -7
- package/dist/{neptune-provider-CHVuPvHJ.js.map → neptune-provider-CN3MA8Cw.js.map} +1 -1
- package/dist/{program-pfwGZi1I.js → program-BfTCUNof.js} +156 -40
- package/dist/program-BfTCUNof.js.map +1 -0
- package/dist/{provider-classes-CaogwY3K.js → provider-classes-BbS4iho1.js} +22 -22
- package/dist/{provider-classes-CaogwY3K.js.map → provider-classes-BbS4iho1.js.map} +1 -1
- package/dist/{rds-provider-I6YAiIv3.js → rds-provider-k-7oWDtG.js} +10 -10
- package/dist/{rds-provider-I6YAiIv3.js.map → rds-provider-k-7oWDtG.js.map} +1 -1
- package/dist/{read-replica-BbDOKi8I.js → read-replica-Dx5O9bW4.js} +3 -3
- package/dist/{read-replica-BbDOKi8I.js.map → read-replica-Dx5O9bW4.js.map} +1 -1
- package/dist/{replacement-rules-DEMSUsSU.js → replacement-rules-SPQJMbC6.js} +3 -3
- package/dist/{replacement-rules-DEMSUsSU.js.map → replacement-rules-SPQJMbC6.js.map} +1 -1
- package/dist/{resource-deadline-B34RyqEU.js → resource-deadline-CImbEePa.js} +4 -4
- package/dist/{resource-deadline-B34RyqEU.js.map → resource-deadline-CImbEePa.js.map} +1 -1
- package/dist/{run-cli-D_mCCBi9.js → run-cli-B637Czto.js} +2 -2
- package/dist/{run-cli-D_mCCBi9.js.map → run-cli-B637Czto.js.map} +1 -1
- package/dist/{ec2-termination-protection-BhINWGSK.js → update-policy-C3iCsDhx.js} +15 -7
- package/dist/update-policy-C3iCsDhx.js.map +1 -0
- package/dist/{update-removal-Cr8BZ_MT.js → update-removal-TXGn1k50.js} +22 -22
- package/dist/{update-removal-Cr8BZ_MT.js.map → update-removal-TXGn1k50.js.map} +1 -1
- package/dist/{version-C3ovda8-.js → version-HusdN8vD.js} +2 -2
- package/dist/{version-C3ovda8-.js.map → version-HusdN8vD.js.map} +1 -1
- package/package.json +2 -2
- package/dist/asg-provider-vzD1uanW.js.map +0 -1
- package/dist/deploy-engine-DIe64g1M.js.map +0 -1
- package/dist/diff-calculator-e0X8wg5d.js.map +0 -1
- package/dist/ec2-termination-protection-BhINWGSK.js.map +0 -1
- package/dist/image-plan-BZ-0TCSM.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-HusdN8vD.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-oZMfcKSj.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-z2kbR8l-.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 {
|
|
6
|
+
import { Bo as promoteInPlaceAttributeDependents, Cl as SSM_PARAMETER_VALUE_PREFIX, Dl as purgeNoncurrentKeyVersions, Fl as isDefaultBootstrapBucketName, Gl as resolveFileAssetSourcePath, Il as isDefaultBootstrapRepoName, Jc as withoutUnwrittenSdkUnwiredProperties, Kc as withoutAcceptedSdkUnwiredProperties, Kl as warnAbsoluteAssetPath, Ko as referenceProvenanceOf, Ll as loadPublishableAssetManifest, Mo as AWS_NO_VALUE, Nl as createLazyAssetModeContext, Pl as flattenAssetPlaceholders, Qc as TemplateParser, Rl as redirectDockerAsset, Ss as movedMaskedProperties, Tl as ssmResolvedValueType, Ul as isCfnTemplateAssetPath, Wl as parseAssetManifestBody, Wo as recordedProvenanceOf, _l as missingStateBucketRemedy, _u as renderAssemblyPathEscape, al as rebuildClientForBucketRegion, as as replacementSidesForLog, au as getCdkdAssetBucketName, bl as listNestedTemplateRows, bs as inputFingerprinter, bu as resolveBucketRegion, cs as isPlainReferenceTo, fu as absoluteAssemblyPathEscape, gl as stringifyValue, gu as namesTheSameDirectory, hu as displayAssemblyPath, is as markNewValueKnownAfterDeploy, kl as rememberSynthesizedStacks, mu as describeFileReadFailure, nc as refuseMalformedResourceProperties, ns as INTRINSIC_KEYS, os as siblingsOf, ou as getCdkdContainerRepoName, pu as assemblyPathEscape, ql as warnWholeAssemblyAsSource, qo as referenceTokensIn, qs as refuseMalformedResourceEntriesForDeploy, rs as containsIntrinsic, su as defineOwnKey, tl as isKnownTokenFreeState, ts as namesRecreatedParent, uu as nullPrototypeRecord, vu as resolveAssemblyPath, wl as isListParameterType, ys as tryGetTopLevelWriteOnlyProperties, zl as redirectFileAsset, zo as extractGetAttRefs } from "./deploy-engine-axD9sX_9.js";
|
|
7
|
+
import { F as utf8ByteLength, M as jsonParseFailureStandIn, N as parseFailureDebugDetail, d as createOnlyChangeRequiresReplacement, f as getCreateOnlyPropertyPaths, j as describeJsonParseFailure } from "./update-policy-C3iCsDhx.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-TXGn1k50.js";
|
|
10
|
+
import { t as expectedOwnerParam } from "./expected-bucket-owner-BUXAXOgl.js";
|
|
11
|
+
import { _t as acceptedCreateOnlyDropsOf } from "./delete-started-BR6VF4-U.js";
|
|
12
|
+
import { pn as splitGetAttStringForm, t as ReplacementRulesRegistry } from "./replacement-rules-SPQJMbC6.js";
|
|
13
|
+
import { E as unsettledPropertiesOf } from "./resource-deadline-CImbEePa.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) {
|
|
@@ -1697,6 +1941,11 @@ function resolveCaptureObservedState(cliValue) {
|
|
|
1697
1941
|
if (typeof v === "boolean") return v;
|
|
1698
1942
|
return true;
|
|
1699
1943
|
}
|
|
1944
|
+
function resolveUpdatePolicy(cliValue) {
|
|
1945
|
+
if (typeof cliValue === "boolean") return cliValue;
|
|
1946
|
+
const v = (loadCdkJson()?.context?.["cdkd"])?.["updatePolicy"];
|
|
1947
|
+
if (typeof v === "boolean") return v;
|
|
1948
|
+
}
|
|
1700
1949
|
function resolveUseCdkBootstrapAssets(cliValue) {
|
|
1701
1950
|
if (cliValue === true) return true;
|
|
1702
1951
|
return (loadCdkJson()?.context?.["cdkd"])?.["useCdkBootstrapAssets"] === true;
|
|
@@ -1755,7 +2004,7 @@ async function resolveStateBucketWithDefaultAndSource(cliBucket, region, legacyF
|
|
|
1755
2004
|
const { GetCallerIdentityCommand } = await import("@aws-sdk/client-sts");
|
|
1756
2005
|
const { S3Client, HeadBucketCommand, ListObjectsV2Command } = await import("@aws-sdk/client-s3");
|
|
1757
2006
|
const { getAwsClients } = await import("./aws-clients-DOkPjjAW.js").then((n) => n.n);
|
|
1758
|
-
const { expectedOwnerParam, recordResolvedAccountId } = await import("./expected-bucket-owner-
|
|
2007
|
+
const { expectedOwnerParam, recordResolvedAccountId } = await import("./expected-bucket-owner-BUXAXOgl.js").then((n) => n.n);
|
|
1759
2008
|
const probeDeps = {
|
|
1760
2009
|
HeadBucketCommand,
|
|
1761
2010
|
ListObjectsV2Command,
|
|
@@ -3197,7 +3446,7 @@ var DockerAssetPublisher = class {
|
|
|
3197
3446
|
refuseDockerAssetUnderAwsEmulator(asset.displayName || localTag);
|
|
3198
3447
|
await this.buildImage(asset, cdkOutputDir, localTag, assetOutdir);
|
|
3199
3448
|
}
|
|
3200
|
-
async push(asset, accountId, region, localTag) {
|
|
3449
|
+
async push(asset, accountId, region, localTag, ensureRepository = false) {
|
|
3201
3450
|
refuseDockerAssetUnderAwsEmulator(asset.displayName || localTag);
|
|
3202
3451
|
for (const [, dest] of Object.entries(asset.destinations)) {
|
|
3203
3452
|
const repositoryName = this.resolvePlaceholders(dest.repositoryName, accountId, region);
|
|
@@ -3210,6 +3459,7 @@ var DockerAssetPublisher = class {
|
|
|
3210
3459
|
region: destRegion
|
|
3211
3460
|
});
|
|
3212
3461
|
try {
|
|
3462
|
+
if (ensureRepository) await this.ensureRepositoryExists(client, repositoryName);
|
|
3213
3463
|
if (await this.imageExists(client, repositoryName, imageTag)) {
|
|
3214
3464
|
this.logger.debug(`Image already exists, skipping: ${ecrUri}`);
|
|
3215
3465
|
continue;
|
|
@@ -3221,6 +3471,26 @@ var DockerAssetPublisher = class {
|
|
|
3221
3471
|
}
|
|
3222
3472
|
}
|
|
3223
3473
|
}
|
|
3474
|
+
async ensureRepositoryExists(client, repositoryName) {
|
|
3475
|
+
try {
|
|
3476
|
+
if (((await client.send(new DescribeRepositoriesCommand({ repositoryNames: [repositoryName] }))).repositories?.length ?? 0) > 0) return;
|
|
3477
|
+
} catch (error) {
|
|
3478
|
+
if (error.name !== "RepositoryNotFoundException") throw error;
|
|
3479
|
+
}
|
|
3480
|
+
this.logger.debug(safeMsg`Creating ECR repository ${repositoryName}`);
|
|
3481
|
+
try {
|
|
3482
|
+
await client.send(new CreateRepositoryCommand({
|
|
3483
|
+
repositoryName,
|
|
3484
|
+
tags: [{
|
|
3485
|
+
Key: "awscdk:asset",
|
|
3486
|
+
Value: "true"
|
|
3487
|
+
}],
|
|
3488
|
+
imageScanningConfiguration: { scanOnPush: true }
|
|
3489
|
+
}));
|
|
3490
|
+
} catch (error) {
|
|
3491
|
+
if (error.name !== "RepositoryAlreadyExistsException") throw error;
|
|
3492
|
+
}
|
|
3493
|
+
}
|
|
3224
3494
|
async imageExists(client, repositoryName, imageTag) {
|
|
3225
3495
|
try {
|
|
3226
3496
|
return ((await client.send(new DescribeImagesCommand$1({
|
|
@@ -3423,13 +3693,21 @@ var AssetPublisher = class {
|
|
|
3423
3693
|
const content = readFileSync(manifestPath, "utf-8");
|
|
3424
3694
|
const manifest = parseAssetManifestBody(content, manifestPath);
|
|
3425
3695
|
const cdkOutputDir = manifestPath.replace(/\/[^/]+$/, "");
|
|
3696
|
+
return this.addManifestToGraph(graph, manifest, {
|
|
3697
|
+
...options,
|
|
3698
|
+
cdkOutputDir
|
|
3699
|
+
});
|
|
3700
|
+
}
|
|
3701
|
+
addManifestToGraph(graph, manifest, options) {
|
|
3702
|
+
const cdkOutputDir = options.cdkOutputDir;
|
|
3426
3703
|
const assetOutdir = options.assetOutdir ?? cdkOutputDir;
|
|
3427
3704
|
const prefix = options.nodePrefix || "";
|
|
3428
3705
|
const redirect = options.redirect;
|
|
3706
|
+
const warnBuckets = options.bucketsChosenByCdkd !== true;
|
|
3429
3707
|
const nodeIds = [];
|
|
3430
3708
|
const fileAssets = Object.entries(manifest.files || {}).filter(([, asset]) => !isCfnTemplateAssetPath(asset.source.path)).map(([hash, asset]) => [hash, redirect ? redirectFileAsset(asset, redirect) : asset]);
|
|
3431
3709
|
for (const [hash, asset] of fileAssets) {
|
|
3432
|
-
for (const dest of Object.values(asset.destinations)) {
|
|
3710
|
+
for (const dest of warnBuckets ? Object.values(asset.destinations) : []) {
|
|
3433
3711
|
const destRegion = dest.region ?? options.region;
|
|
3434
3712
|
const name = flattenAssetPlaceholders(dest.bucketName, options.accountId, destRegion);
|
|
3435
3713
|
warnUnrecognizedAssetDestination({
|
|
@@ -3465,7 +3743,7 @@ var AssetPublisher = class {
|
|
|
3465
3743
|
warnUnrecognizedAssetDestination({
|
|
3466
3744
|
kind: "repository",
|
|
3467
3745
|
name,
|
|
3468
|
-
recognized: isDefaultBootstrapRepoName(name, options.accountId, destRegion) || redirect !== void 0 && [...redirect.repos.values()].includes(name)
|
|
3746
|
+
recognized: isDefaultBootstrapRepoName(name, options.accountId, destRegion) || options.recognizedImageDestinations?.has(imageDestinationKey(name, dest.imageTag)) === true || redirect !== void 0 && [...redirect.repos.values()].includes(name)
|
|
3469
3747
|
});
|
|
3470
3748
|
}
|
|
3471
3749
|
const localTag = `cdkd-asset-${hash}`;
|
|
@@ -3495,7 +3773,8 @@ var AssetPublisher = class {
|
|
|
3495
3773
|
asset,
|
|
3496
3774
|
accountId: options.accountId,
|
|
3497
3775
|
region: options.region,
|
|
3498
|
-
localTag
|
|
3776
|
+
localTag,
|
|
3777
|
+
...Object.values(asset.destinations).some((d) => options.repositoriesToEnsure?.has(d.repositoryName)) && { ensureRepository: true }
|
|
3499
3778
|
}
|
|
3500
3779
|
});
|
|
3501
3780
|
nodeIds.push(publishNodeId);
|
|
@@ -3507,7 +3786,7 @@ var AssetPublisher = class {
|
|
|
3507
3786
|
const data = node.data;
|
|
3508
3787
|
if (data.kind === "file") await this.filePublisher.publish(data.hash, data.asset, data.cdkOutputDir, data.accountId, data.region, data.assetOutdir);
|
|
3509
3788
|
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);
|
|
3789
|
+
else if (data.kind === "docker-publish") await this.dockerPublisher.push(data.asset, data.accountId, data.region, data.localTag, data.ensureRepository === true);
|
|
3511
3790
|
this.logger.debug(`✅ ${node.id}`);
|
|
3512
3791
|
}
|
|
3513
3792
|
async publishFromManifest(manifestPath, options = {}) {
|
|
@@ -5092,5 +5371,5 @@ var DiffCalculator = class {
|
|
|
5092
5371
|
}
|
|
5093
5372
|
};
|
|
5094
5373
|
|
|
5095
|
-
export { loadCdkJson as A,
|
|
5096
|
-
//# sourceMappingURL=diff-calculator-
|
|
5374
|
+
export { predictedAutoCreatedAssetMode as $, loadCdkJson as A, stateBucketExistenceConfirmed as B, runDockerForeground as C, synthesisStatusMessage as D, Synthesizer as E, resolveStateBucketWithDefault as F, findLargeInlineResources as G, CFN_TEMPLATE_BODY_LIMIT as H, resolveStateBucketWithDefaultAndSource as I, AssemblyReader as J, uploadCfnTemplate as K, resolveStateBucketWithSource as L, resolveAutoAssetStorage as M, resolveCaptureObservedState as N, getDefaultStateBucketName as O, resolveSkipPrefix as P, legacyPlanAssetCount as Q, resolveUpdatePolicy as R, getDockerCmd as S, abortInFlightMultipartUploads as T, CFN_TEMPLATE_URL_LIMIT as U, warnDeprecatedNoPrefixCliFlag as V, MIGRATE_TMP_PREFIX as W, bindLegacyStackAssetParameters as X, StageLoadError as Y, createLegacyAssetParameterBinder as Z, partitionSensitiveEnv as _, AssetPublisher as a, injectedAwsRegionValue as at, isMalformedEnvKey as b, resolveDockerContextDirectory as c, describeDockerFailure as d, prepareLegacyStackAssets as et, redactedCause as f, finchSecretArgvRefusal as g, dockerSpawnEnvWithSensitive as h, isLockInfoExpired as i, injectAwsRegion as it, resolveApp as j, getLegacyStateBucketName as k, describeDockerCapturedOutput as l, redactDockerArgvValues as m, DagBuilder as n, processStackMessages as nt, WorkGraph as o, redactedDockerCause as p, refuseFailedLookups as q, LockManager as r, setChildProcessAwsEnv as rt, buildDockerImage as s, DiffCalculator as t, CdkToolkitBucketMissingError as tt, describeDockerExecFailure as u, warnFinchArgvExposure as v, runDockerStreaming as w, formatDockerLoginError as x, isDockerClientEnvKey as y, resolveUseCdkBootstrapAssets as z };
|
|
5375
|
+
//# sourceMappingURL=diff-calculator-Dych6a6c.js.map
|