@go-to-k/cdkd 0.234.1 → 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.
|
@@ -1790,6 +1790,23 @@ function resolveUseCdkBootstrapAssets(cliValue) {
|
|
|
1790
1790
|
return (loadCdkJson()?.context?.["cdkd"])?.["useCdkBootstrapAssets"] === true;
|
|
1791
1791
|
}
|
|
1792
1792
|
/**
|
|
1793
|
+
* Resolve the effective "auto-create cdkd asset storage on first deploy into
|
|
1794
|
+
* an un-opted-in region" value (issue #1007).
|
|
1795
|
+
*
|
|
1796
|
+
* Mirrors {@link resolveCaptureObservedState}'s `--no-X` shape: Commander
|
|
1797
|
+
* reports `--no-auto-asset-storage` as `autoAssetStorage: false`, and the
|
|
1798
|
+
* implicit default is `true` — so the cdk.json fallback
|
|
1799
|
+
* (`context.cdkd.autoAssetStorage`, boolean) only fires when the CLI value
|
|
1800
|
+
* is the implicit default. Priority: CLI `false` wins > cdk.json boolean >
|
|
1801
|
+
* default `true`.
|
|
1802
|
+
*/
|
|
1803
|
+
function resolveAutoAssetStorage(cliValue) {
|
|
1804
|
+
if (cliValue === false) return false;
|
|
1805
|
+
const v = (loadCdkJson()?.context?.["cdkd"])?.["autoAssetStorage"];
|
|
1806
|
+
if (typeof v === "boolean") return v;
|
|
1807
|
+
return true;
|
|
1808
|
+
}
|
|
1809
|
+
/**
|
|
1793
1810
|
* Pre-parse argv walk that surfaces the deprecation warning when the
|
|
1794
1811
|
* user explicitly passes the legacy `--no-prefix-user-supplied-names`
|
|
1795
1812
|
* flag. Commander's auto-negation of `--prefix-user-supplied-names`
|
|
@@ -3183,12 +3200,14 @@ var AssetModeResolver = class {
|
|
|
3183
3200
|
profile;
|
|
3184
3201
|
useCdkBootstrapAssets;
|
|
3185
3202
|
suppressLegacyNotice;
|
|
3203
|
+
autoCreate;
|
|
3186
3204
|
constructor(stateBackend, accountId, opts = {}) {
|
|
3187
3205
|
this.stateBackend = stateBackend;
|
|
3188
3206
|
this.accountId = accountId;
|
|
3189
3207
|
this.profile = opts.profile;
|
|
3190
3208
|
this.useCdkBootstrapAssets = opts.useCdkBootstrapAssets ?? false;
|
|
3191
3209
|
this.suppressLegacyNotice = opts.suppressLegacyNotice ?? false;
|
|
3210
|
+
this.autoCreate = opts.autoCreate;
|
|
3192
3211
|
}
|
|
3193
3212
|
/**
|
|
3194
3213
|
* Resolve the asset mode for a deploy region. Concurrent callers for the
|
|
@@ -3209,6 +3228,10 @@ var AssetModeResolver = class {
|
|
|
3209
3228
|
const markerKey = getBootstrapMarkerKey(region);
|
|
3210
3229
|
const body = await this.stateBackend.getRawObject(markerKey);
|
|
3211
3230
|
if (body === null) {
|
|
3231
|
+
if (this.autoCreate) {
|
|
3232
|
+
const created = await this.tryAutoCreate(region, markerKey);
|
|
3233
|
+
if (created) return created;
|
|
3234
|
+
}
|
|
3212
3235
|
if (!this.legacyNoticeShownRegions.has(region) && !this.suppressLegacyNotice) {
|
|
3213
3236
|
this.legacyNoticeShownRegions.add(region);
|
|
3214
3237
|
this.logger.info(`Assets for region '${region}' are published to the CDK bootstrap bucket/repo, which 'cdk gc' may garbage-collect (cdkd-deployed stacks have no CloudFormation stack for gc to scan). Run 'cdkd bootstrap --region ${region}' to create cdkd-owned asset storage that 'cdk gc' never touches.`);
|
|
@@ -3223,6 +3246,59 @@ var AssetModeResolver = class {
|
|
|
3223
3246
|
marker
|
|
3224
3247
|
};
|
|
3225
3248
|
}
|
|
3249
|
+
/**
|
|
3250
|
+
* Issue #1007 — first deploy into an un-opted-in region: confirm, then
|
|
3251
|
+
* create the asset bucket + container repo + marker via the same
|
|
3252
|
+
* {@link ensureAssetStorage} `cdkd bootstrap` uses (squatting defense,
|
|
3253
|
+
* idempotent creation, marker-written-last all included). Returns `null`
|
|
3254
|
+
* (= stay legacy) when the user declines or creation fails — the caller
|
|
3255
|
+
* then shows the legacy notice, so the user still learns the exact
|
|
3256
|
+
* `cdkd bootstrap --region <r>` remediation.
|
|
3257
|
+
*/
|
|
3258
|
+
async tryAutoCreate(region, markerKey) {
|
|
3259
|
+
let confirmed;
|
|
3260
|
+
try {
|
|
3261
|
+
confirmed = await this.autoCreate.confirm(region);
|
|
3262
|
+
} catch {
|
|
3263
|
+
confirmed = false;
|
|
3264
|
+
}
|
|
3265
|
+
if (!confirmed) return null;
|
|
3266
|
+
let s3Client;
|
|
3267
|
+
let ecrClient;
|
|
3268
|
+
try {
|
|
3269
|
+
s3Client = new S3Client({
|
|
3270
|
+
region,
|
|
3271
|
+
...this.profile && { profile: this.profile }
|
|
3272
|
+
});
|
|
3273
|
+
ecrClient = new ECRClient({
|
|
3274
|
+
region,
|
|
3275
|
+
...this.profile && { profile: this.profile }
|
|
3276
|
+
});
|
|
3277
|
+
await ensureAssetStorage({
|
|
3278
|
+
s3Client,
|
|
3279
|
+
ecrClient,
|
|
3280
|
+
stateBackend: this.stateBackend,
|
|
3281
|
+
accountId: this.accountId,
|
|
3282
|
+
region,
|
|
3283
|
+
force: false
|
|
3284
|
+
});
|
|
3285
|
+
const body = await this.stateBackend.getRawObject(markerKey);
|
|
3286
|
+
if (body === null) throw new CdkdError(`bootstrap marker missing at '${markerKey}' right after creation`, "ASSET_STORAGE_MARKER_MISSING");
|
|
3287
|
+
const marker = parseBootstrapMarker(body, markerKey);
|
|
3288
|
+
this.logger.debug(`cdkd asset storage auto-created for region '${region}': ${marker.assetBucket} / ${marker.containerRepo}`);
|
|
3289
|
+
return {
|
|
3290
|
+
mode: "cdkd-assets",
|
|
3291
|
+
marker
|
|
3292
|
+
};
|
|
3293
|
+
} catch (error) {
|
|
3294
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
3295
|
+
this.logger.warn(`Failed to auto-create cdkd asset storage for region '${region}': ${message} Falling back to the CDK bootstrap destinations for this run — run 'cdkd bootstrap --region ${region}' (with S3/ECR create permissions) to opt the region in.`);
|
|
3296
|
+
return null;
|
|
3297
|
+
} finally {
|
|
3298
|
+
s3Client?.destroy();
|
|
3299
|
+
ecrClient?.destroy();
|
|
3300
|
+
}
|
|
3301
|
+
}
|
|
3226
3302
|
};
|
|
3227
3303
|
|
|
3228
3304
|
//#endregion
|
|
@@ -15767,5 +15843,5 @@ var DeployEngine = class {
|
|
|
15767
15843
|
};
|
|
15768
15844
|
|
|
15769
15845
|
//#endregion
|
|
15770
|
-
export { AssetManifestLoader as $, DiffCalculator as A, buildAssetRedirectMap as B, findActionableSilentDrops as C, refStateLookupFromResource as D, cfnRefValueFromPhysicalId as E, rebuildClientForBucketRegion as F, BOOTSTRAP_MARKER_PREFIX as G, loadPublishableAssetManifest as H, shouldRetainResource as I, buildDockerImage as J, ensureAssetStorage as K, AssetPublisher as L, TemplateParser as M, LockManager as N, WAFv2WebACLProvider as O, S3StateBackend as P, runDockerStreaming as Q, stringifyValue as R, ProviderRegistry as S, IntrinsicFunctionResolver as T, rewriteTemplateAssetReferences as U, createAssetRedirectResolver as V, AssetModeResolver as W, getDockerCmd as X, formatDockerLoginError as Y, runDockerForeground as Z, green as _,
|
|
15771
|
-
//# sourceMappingURL=deploy-engine-
|
|
15846
|
+
export { AssetManifestLoader as $, DiffCalculator as A, buildAssetRedirectMap as B, findActionableSilentDrops as C, refStateLookupFromResource as D, cfnRefValueFromPhysicalId as E, rebuildClientForBucketRegion as F, BOOTSTRAP_MARKER_PREFIX as G, loadPublishableAssetManifest as H, shouldRetainResource as I, buildDockerImage as J, ensureAssetStorage as K, AssetPublisher as L, TemplateParser as M, LockManager as N, WAFv2WebACLProvider as O, S3StateBackend as P, runDockerStreaming as Q, stringifyValue as R, ProviderRegistry as S, IntrinsicFunctionResolver as T, rewriteTemplateAssetReferences as U, createAssetRedirectResolver as V, AssetModeResolver as W, getDockerCmd as X, formatDockerLoginError as Y, runDockerForeground as Z, green as _, uploadCfnTemplate as _t, withRetry as a, resolveApp as at, IAMRoleProvider as b, resolveBucketRegion as bt, computeImplicitDeleteEdges as c, resolveSkipPrefix as ct, isStatefulRecreateTargetSync as d, resolveUseCdkBootstrapAssets as dt, getDockerImageBySourceHash as et, renderStatefulReason as f, warnDeprecatedNoPrefixCliFlag as ft, gray as g, findLargeInlineResources as gt, cyan as h, MIGRATE_TMP_PREFIX as ht, withResourceDeadline as i, getLegacyStateBucketName as it, DagBuilder as j, applyRoleArnIfSet as k, extractDeploymentEventError as l, resolveStateBucketWithDefault as lt, bold as m, CFN_TEMPLATE_URL_LIMIT as mt, DEFAULT_RESOURCE_WARN_AFTER_MS as n, synthesisStatusMessage as nt, isRetryableTransientError as o, resolveAutoAssetStorage as ot, formatResourceLine as p, CFN_TEMPLATE_BODY_LIMIT as pt, parseBootstrapMarker as q, DeployEngine as r, getDefaultStateBucketName as rt, IMPLICIT_DELETE_DEPENDENCIES as s, resolveCaptureObservedState as st, DEFAULT_RESOURCE_TIMEOUT_MS as t, Synthesizer as tt, MULTI_REGION_RECREATE_BLOCKED_TYPES as u, resolveStateBucketWithDefaultAndSource as ut, red as v, AssemblyReader as vt, CloudControlProvider as w, collectInlinePolicyNamesManagedBySiblings as x, yellow as y, clearBucketRegionCache as yt, WorkGraph as z };
|
|
15847
|
+
//# sourceMappingURL=deploy-engine-Cbi5IzWV.js.map
|