@go-to-k/cdkd 0.234.0 → 0.235.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/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { A as withErrorHandling, B as generateResourceName, C as StackHasActiveImportsError, F as getLiveRenderer, H as withSkipPrefix, I as PATTERN_B_NAME_OPTIONS, L as PATTERN_B_NAME_PROPERTIES, M as getLogger, P as runStackBuffered, R as PATTERN_B_RESOURCE_TYPES, S as ResourceUpdateNotSupportedError, U as withStackName, V as generateResourceNameWithFallback, _ as MissingCdkCliError, a as normalizeAwsTagsToCfn, b as ProvisioningError, f as LocalInvokeBuildError$1, i as matchesCdkPath, k as normalizeAwsError, l as CdkdError, m as LocalStartServiceError, n as isTerminationProtectionPropagationError, o as resolveExplicitPhysicalId, p as LocalMigrateError, r as CDK_PATH_TAG, s as assertRegionMatch, t as disableInstanceApiTermination, v as NestedStackChildDirectDestroyError, w as StackTerminationProtectionError, x as ResourceTimeoutError, y as PartialFailureError } from "./ec2-termination-protection-uvVnteGl.js";
|
|
3
3
|
import { a as setAwsClients, i as resetAwsClients, r as getAwsClients, t as AwsClients } from "./aws-clients-pjPwZz1r.js";
|
|
4
|
-
import { $ as AssetManifestLoader, A as DiffCalculator, B as buildAssetRedirectMap, C as findActionableSilentDrops, D as refStateLookupFromResource, E as cfnRefValueFromPhysicalId, F as rebuildClientForBucketRegion, G as BOOTSTRAP_MARKER_PREFIX, H as loadPublishableAssetManifest, I as shouldRetainResource, J as buildDockerImage, K as ensureAssetStorage, L as AssetPublisher, M as TemplateParser, N as LockManager, O as WAFv2WebACLProvider, P as S3StateBackend, Q as runDockerStreaming, R as stringifyValue, S as ProviderRegistry, T as IntrinsicFunctionResolver, U as rewriteTemplateAssetReferences, V as createAssetRedirectResolver, W as AssetModeResolver, X as getDockerCmd, Y as formatDockerLoginError, Z as runDockerForeground, _ as green, _t as
|
|
4
|
+
import { $ as AssetManifestLoader, A as DiffCalculator, B as buildAssetRedirectMap, C as findActionableSilentDrops, D as refStateLookupFromResource, E as cfnRefValueFromPhysicalId, F as rebuildClientForBucketRegion, G as BOOTSTRAP_MARKER_PREFIX, H as loadPublishableAssetManifest, I as shouldRetainResource, J as buildDockerImage, K as ensureAssetStorage, L as AssetPublisher, M as TemplateParser, N as LockManager, O as WAFv2WebACLProvider, P as S3StateBackend, Q as runDockerStreaming, R as stringifyValue, S as ProviderRegistry, T as IntrinsicFunctionResolver, U as rewriteTemplateAssetReferences, V as createAssetRedirectResolver, W as AssetModeResolver, X as getDockerCmd, Y as formatDockerLoginError, Z as runDockerForeground, _ as green, _t as uploadCfnTemplate, a as withRetry, at as resolveApp, b as IAMRoleProvider, bt as resolveBucketRegion, c as computeImplicitDeleteEdges, ct as resolveSkipPrefix, d as isStatefulRecreateTargetSync, dt as resolveUseCdkBootstrapAssets, et as getDockerImageBySourceHash, f as renderStatefulReason, ft as warnDeprecatedNoPrefixCliFlag, g as gray, gt as findLargeInlineResources, h as cyan, ht as MIGRATE_TMP_PREFIX, i as withResourceDeadline, it as getLegacyStateBucketName, j as DagBuilder, k as applyRoleArnIfSet, l as extractDeploymentEventError, lt as resolveStateBucketWithDefault, m as bold, mt as CFN_TEMPLATE_URL_LIMIT, n as DEFAULT_RESOURCE_WARN_AFTER_MS, nt as synthesisStatusMessage, o as isRetryableTransientError, ot as resolveAutoAssetStorage, p as formatResourceLine, pt as CFN_TEMPLATE_BODY_LIMIT, q as parseBootstrapMarker, r as DeployEngine, rt as getDefaultStateBucketName, s as IMPLICIT_DELETE_DEPENDENCIES, st as resolveCaptureObservedState, t as DEFAULT_RESOURCE_TIMEOUT_MS, tt as Synthesizer, u as MULTI_REGION_RECREATE_BLOCKED_TYPES, ut as resolveStateBucketWithDefaultAndSource, v as red, vt as AssemblyReader, w as CloudControlProvider, x as collectInlinePolicyNamesManagedBySiblings, y as yellow, z as WorkGraph } from "./deploy-engine-Cbi5IzWV.js";
|
|
5
5
|
import { t as ASGProvider } from "./asg-provider-Dd9Xze-T.js";
|
|
6
6
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
7
7
|
import { createHash, randomBytes, randomUUID } from "node:crypto";
|
|
@@ -508,6 +508,7 @@ const deployOptions = [
|
|
|
508
508
|
new Option("--dry-run", "Show changes without applying").default(false),
|
|
509
509
|
new Option("--skip-assets", "Skip asset publishing").default(false),
|
|
510
510
|
new Option("--no-rollback", "Skip rollback on deployment failure"),
|
|
511
|
+
new Option("--no-auto-asset-storage", "Do not auto-create cdkd-owned asset storage (asset bucket + container-asset ECR repo + marker) on the first deploy into a region not yet opted in via 'cdkd bootstrap'. Deploys into such regions stay in legacy mode (CDK bootstrap destinations). Per-app opt-out: cdk.json context.cdkd.autoAssetStorage: false."),
|
|
511
512
|
new Option("--no-capture-observed-state", "Skip capturing AWS-current properties after each create/update (adds a fire-and-forget readCurrentState per resource so cdkd drift can compare against the real deploy-time AWS snapshot instead of the template). On by default. Disable when deploy speed matters more than rich drift detection — falls back to comparing against template properties (the pre-v3 behavior)."),
|
|
512
513
|
new Option("--prefix-user-supplied-names", "Opt in to LEGACY behavior: prepend the stack name to physical names the user explicitly supplied in their CDK code (e.g. `new iam.Role(this, \"X\", { roleName: \"my-role\" })` → AWS resource named `MyStack-my-role` instead of `my-role`). Since v0.94.0 the default is to NOT prefix user-supplied names — this flag restores the pre-v0.94.0 behavior on Pattern B providers (IAM Role / User / Group / InstanceProfile / ELBv2 LoadBalancer / TargetGroup). Enable via this flag, CDKD_PREFIX_USER_SUPPLIED_NAMES=true, or cdk.json context.cdkd.prefixUserSuppliedNames=true. Applies to `cdkd deploy` only.").default(false),
|
|
513
514
|
noWaitOption,
|
|
@@ -645,10 +646,12 @@ async function bootstrapCommand(options) {
|
|
|
645
646
|
bucketName = getDefaultStateBucketName(accountId);
|
|
646
647
|
logger.info(`Using default state bucket: ${bucketName}`);
|
|
647
648
|
}
|
|
649
|
+
const rebuiltStateBucketClient = await rebuildClientForBucketRegion(s3Client, bucketName, { ...options.profile && { profile: options.profile } });
|
|
650
|
+
const stateBucketS3 = rebuiltStateBucketClient ?? s3Client;
|
|
648
651
|
try {
|
|
649
652
|
let bucketExists = false;
|
|
650
653
|
try {
|
|
651
|
-
await
|
|
654
|
+
await stateBucketS3.send(new HeadBucketCommand({ Bucket: bucketName }));
|
|
652
655
|
bucketExists = true;
|
|
653
656
|
logger.info(`Bucket ${bucketName} already exists`);
|
|
654
657
|
} catch (error) {
|
|
@@ -672,18 +675,18 @@ async function bootstrapCommand(options) {
|
|
|
672
675
|
logger.info(`Creating S3 bucket: ${bucketName} in region ${region}`);
|
|
673
676
|
const createBucketParams = { Bucket: bucketName };
|
|
674
677
|
if (region !== "us-east-1") createBucketParams.CreateBucketConfiguration = { LocationConstraint: region };
|
|
675
|
-
await
|
|
678
|
+
await stateBucketS3.send(new CreateBucketCommand(createBucketParams));
|
|
676
679
|
logger.info(`✓ Created S3 bucket: ${bucketName}`);
|
|
677
680
|
}
|
|
678
681
|
if (!skipStateBucketConfig) {
|
|
679
682
|
logger.debug("Enabling bucket versioning...");
|
|
680
|
-
await
|
|
683
|
+
await stateBucketS3.send(new PutBucketVersioningCommand({
|
|
681
684
|
Bucket: bucketName,
|
|
682
685
|
VersioningConfiguration: { Status: "Enabled" }
|
|
683
686
|
}));
|
|
684
687
|
logger.info("✓ Enabled bucket versioning");
|
|
685
688
|
logger.debug("Enabling bucket encryption...");
|
|
686
|
-
await
|
|
689
|
+
await stateBucketS3.send(new PutBucketEncryptionCommand({
|
|
687
690
|
Bucket: bucketName,
|
|
688
691
|
ServerSideEncryptionConfiguration: { Rules: [{
|
|
689
692
|
ApplyServerSideEncryptionByDefault: { SSEAlgorithm: "AES256" },
|
|
@@ -703,7 +706,7 @@ async function bootstrapCommand(options) {
|
|
|
703
706
|
Condition: { StringNotEquals: { "aws:PrincipalAccount": accountId } }
|
|
704
707
|
}]
|
|
705
708
|
};
|
|
706
|
-
await
|
|
709
|
+
await stateBucketS3.send(new PutBucketPolicyCommand({
|
|
707
710
|
Bucket: bucketName,
|
|
708
711
|
Policy: JSON.stringify(bucketPolicy)
|
|
709
712
|
}));
|
|
@@ -753,6 +756,7 @@ async function bootstrapCommand(options) {
|
|
|
753
756
|
logger.info(` --state-bucket ${bucketName}`);
|
|
754
757
|
logger.info(` --region ${region}`);
|
|
755
758
|
} finally {
|
|
759
|
+
rebuiltStateBucketClient?.destroy();
|
|
756
760
|
awsClients.destroy();
|
|
757
761
|
}
|
|
758
762
|
}
|
|
@@ -1460,6 +1464,28 @@ async function promptRecreateConfirm(input) {
|
|
|
1460
1464
|
}
|
|
1461
1465
|
}
|
|
1462
1466
|
|
|
1467
|
+
//#endregion
|
|
1468
|
+
//#region src/cli/commands/confirm-prompt.ts
|
|
1469
|
+
/**
|
|
1470
|
+
* Default-YES confirmation prompt (`[Y/n]`, empty input = yes). Used by the
|
|
1471
|
+
* issue #1007 asset-storage auto-create on interactive TTY deploys without
|
|
1472
|
+
* `--yes`. Kept in its own module (mirrors `recreate-confirm-prompt.ts`) so
|
|
1473
|
+
* the accept/decline parsing is unit-testable without importing the whole
|
|
1474
|
+
* deploy command.
|
|
1475
|
+
*/
|
|
1476
|
+
async function promptYesNo(prompt) {
|
|
1477
|
+
const rl = readline.createInterface({
|
|
1478
|
+
input: process.stdin,
|
|
1479
|
+
output: process.stdout
|
|
1480
|
+
});
|
|
1481
|
+
try {
|
|
1482
|
+
const ans = await rl.question(`${prompt} [Y/n] `);
|
|
1483
|
+
return /^(y(es)?)?$/i.test(ans.trim());
|
|
1484
|
+
} finally {
|
|
1485
|
+
rl.close();
|
|
1486
|
+
}
|
|
1487
|
+
}
|
|
1488
|
+
|
|
1463
1489
|
//#endregion
|
|
1464
1490
|
//#region src/state/deployment-events-store.ts
|
|
1465
1491
|
/**
|
|
@@ -1500,7 +1526,7 @@ const FLUSH_INTERVAL_MS = 2e3;
|
|
|
1500
1526
|
const FLUSH_EVENT_THRESHOLD = 50;
|
|
1501
1527
|
/** Build-time cdkd version, with a dev fallback for non-built contexts. */
|
|
1502
1528
|
function getCdkdVersion() {
|
|
1503
|
-
return "0.
|
|
1529
|
+
return "0.235.0";
|
|
1504
1530
|
}
|
|
1505
1531
|
/**
|
|
1506
1532
|
* Generate a time-sortable unique run id, e.g.
|
|
@@ -37706,9 +37732,18 @@ async function deployCommand(stacks, options) {
|
|
|
37706
37732
|
stsClient.destroy();
|
|
37707
37733
|
const assetPublisher = new AssetPublisher();
|
|
37708
37734
|
const useCdkBootstrapAssets = resolveUseCdkBootstrapAssets(options.useCdkBootstrapAssets);
|
|
37735
|
+
const autoAssetStorage = resolveAutoAssetStorage(options.autoAssetStorage);
|
|
37736
|
+
const confirmAutoAssetStorage = async (assetRegion) => {
|
|
37737
|
+
if (options.yes || !process.stdin.isTTY) {
|
|
37738
|
+
logger.info(`Creating cdkd asset storage for region '${assetRegion}' (first deploy into this region; opt out with --no-auto-asset-storage).`);
|
|
37739
|
+
return true;
|
|
37740
|
+
}
|
|
37741
|
+
return promptYesNo(`Region '${assetRegion}' has no cdkd asset storage yet. Create it now (S3 bucket cdkd-assets-${accountId}-${assetRegion} + container-asset ECR repo, out of 'cdk gc' reach)?`);
|
|
37742
|
+
};
|
|
37709
37743
|
const assetModeResolver = new AssetModeResolver(preflightStateBackend, accountId, {
|
|
37710
37744
|
...options.profile && { profile: options.profile },
|
|
37711
|
-
...useCdkBootstrapAssets && { useCdkBootstrapAssets: true }
|
|
37745
|
+
...useCdkBootstrapAssets && { useCdkBootstrapAssets: true },
|
|
37746
|
+
...autoAssetStorage && !options.dryRun && !options.skipAssets && { autoCreate: { confirm: confirmAutoAssetStorage } }
|
|
37712
37747
|
});
|
|
37713
37748
|
const stateConfig = {
|
|
37714
37749
|
bucket: stateBucket,
|
|
@@ -56011,7 +56046,7 @@ function reorderArgs(argv) {
|
|
|
56011
56046
|
async function main() {
|
|
56012
56047
|
installPipeCloseHandler();
|
|
56013
56048
|
const program = new Command();
|
|
56014
|
-
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.
|
|
56049
|
+
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.235.0");
|
|
56015
56050
|
program.addCommand(createBootstrapCommand());
|
|
56016
56051
|
program.addCommand(createSynthCommand());
|
|
56017
56052
|
program.addCommand(createListCommand());
|