@go-to-k/cdkd 0.276.1 → 0.276.3
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/README.md +7 -4
- package/dist/{asg-provider-Cfex3rAs.js → asg-provider-DFSI7iBe.js} +2 -2
- package/dist/{asg-provider-Cfex3rAs.js.map → asg-provider-DFSI7iBe.js.map} +1 -1
- package/dist/cli.js +48 -17
- package/dist/cli.js.map +1 -1
- package/dist/{deploy-engine-C581XZwt.js → deploy-engine-gQzltBso.js} +109 -23
- package/dist/{deploy-engine-C581XZwt.js.map → deploy-engine-gQzltBso.js.map} +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -12090,7 +12090,7 @@ var CloudControlProvider = class {
|
|
|
12090
12090
|
if (context?.finalSnapshotIdentifier !== void 0) throw new ProvisioningError(`${logicalId} (${resourceType}) requires a final snapshot (DeletionPolicy: Snapshot), but the Cloud Control API delete route has no final-snapshot parameter. Re-run with --skip-final-snapshot after snapshotting manually, or retain the resource.`, resourceType, logicalId, physicalId);
|
|
12091
12091
|
if (context?.removeProtection === true && resourceType === "AWS::AutoScaling::AutoScalingGroup") {
|
|
12092
12092
|
this.logger.debug(`Delegating protected AutoScalingGroup ${logicalId} delete to the SDK ASGProvider (Cloud Control cannot force-delete a protected ASG)`);
|
|
12093
|
-
const { ASGProvider } = await import("./asg-provider-
|
|
12093
|
+
const { ASGProvider } = await import("./asg-provider-DFSI7iBe.js").then((n) => n.n);
|
|
12094
12094
|
await new ASGProvider().delete(logicalId, physicalId, resourceType, _properties, context);
|
|
12095
12095
|
return;
|
|
12096
12096
|
}
|
|
@@ -17752,24 +17752,76 @@ async function withResourceDeadline(operation, opts) {
|
|
|
17752
17752
|
|
|
17753
17753
|
//#endregion
|
|
17754
17754
|
//#region src/deployment/rollback-executor.ts
|
|
17755
|
+
/** The `--skip-final-snapshot` flag name cited by every refusal below. */
|
|
17756
|
+
const SKIP_FINAL_SNAPSHOT_FLAG = "--skip-final-snapshot";
|
|
17757
|
+
/**
|
|
17758
|
+
* Which provisioning layer a delete must be judged against: the CURRENT
|
|
17759
|
+
* state record wins (it is what state says AWS holds right now), with the
|
|
17760
|
+
* journaled op's routing as the legacy-state fallback. Shared by both
|
|
17761
|
+
* Snapshot paths below so the cc-api test cannot drift between them.
|
|
17762
|
+
*/
|
|
17763
|
+
function effectiveProvisionedBy(record, fallbackProvisionedBy) {
|
|
17764
|
+
return record?.provisionedBy ?? fallbackProvisionedBy;
|
|
17765
|
+
}
|
|
17755
17766
|
/**
|
|
17756
17767
|
* `UpdateReplacePolicy: Snapshot` on a rollback's delete-of-the-NEW-resource
|
|
17757
17768
|
* (issue #1354): honor it where it costs nothing — an atomic-final-snapshot
|
|
17758
17769
|
* type on the SDK route gets a generated identifier threaded into the delete
|
|
17759
17770
|
* context. Every other Snapshot shape (pre-delete types, cc-api routing)
|
|
17760
17771
|
* keeps the plain delete DELIBERATELY: the rollback executor's delete-new is
|
|
17761
|
-
* load-bearing for same-name re-creation (
|
|
17762
|
-
*
|
|
17763
|
-
*
|
|
17764
|
-
*
|
|
17772
|
+
* load-bearing for same-name re-creation (refusing it would strand the
|
|
17773
|
+
* revert half-done), and the new resource was created by the very deploy
|
|
17774
|
+
* being reverted. Recorded as a scope decision on issue #1354.
|
|
17775
|
+
*
|
|
17776
|
+
* NOT the same call as the rolled-back-CREATE path
|
|
17777
|
+
* ({@link prepareCreateRollbackFinalSnapshot}, issue #1358): there the
|
|
17778
|
+
* resource is being deleted under `DeletionPolicy` and a shape cdkd cannot
|
|
17779
|
+
* snapshot is REFUSED rather than plain-deleted, because the user is losing
|
|
17780
|
+
* a resource that existed before this op — nothing downstream depends on
|
|
17781
|
+
* that delete succeeding.
|
|
17765
17782
|
*/
|
|
17766
17783
|
function rollbackFinalSnapshotId(resourceType, record, fallbackProvisionedBy) {
|
|
17767
17784
|
if (record.updateReplacePolicy !== "Snapshot") return void 0;
|
|
17768
17785
|
if (!ATOMIC_FINAL_SNAPSHOT_TYPES.has(resourceType)) return void 0;
|
|
17769
|
-
if ((record
|
|
17786
|
+
if (effectiveProvisionedBy(record, fallbackProvisionedBy) === "cc-api") return void 0;
|
|
17770
17787
|
return buildFinalSnapshotIdentifier(record.physicalId, resourceType);
|
|
17771
17788
|
}
|
|
17772
17789
|
/**
|
|
17790
|
+
* `DeletionPolicy: Snapshot` on a rolled-back CREATE (issue #1358) — the
|
|
17791
|
+
* executor's copy of the deploy engine's `prepareFinalSnapshotForDelete`
|
|
17792
|
+
* mechanism matrix, run BEFORE the delete. Shared with the FAILED in-flight
|
|
17793
|
+
* CREATE's delete (`--revert-failed`, issue #1362) so the two sibling paths
|
|
17794
|
+
* cannot drift; that caller's op is a {@link FailedOperation}, hence the
|
|
17795
|
+
* structural parameter type:
|
|
17796
|
+
*
|
|
17797
|
+
* - atomic type, SDK-routed → returns the generated identifier for the
|
|
17798
|
+
* provider's atomic final-snapshot delete parameter.
|
|
17799
|
+
* - atomic type, cc-api-routed → refuses (Cloud Control's DeleteResource
|
|
17800
|
+
* has no final-snapshot parameter; `CloudControlProvider.delete` also
|
|
17801
|
+
* fail-closes on the context field as defense-in-depth).
|
|
17802
|
+
* - `PRE_DELETE_SNAPSHOT_TYPES` → creates the snapshot and waits for it
|
|
17803
|
+
* here, then returns undefined (the subsequent delete is plain).
|
|
17804
|
+
* - anything else Snapshot-tagged → refuses.
|
|
17805
|
+
*
|
|
17806
|
+
* Refusals are plain throws so `replaySingle`'s per-op catch counts them as
|
|
17807
|
+
* a failure (which blocks the segment pop and keeps the journal for a
|
|
17808
|
+
* re-run) — deliberately NOT a silent fall-back to orphaning, which is the
|
|
17809
|
+
* very leak #1358 fixes.
|
|
17810
|
+
*/
|
|
17811
|
+
async function prepareCreateRollbackFinalSnapshot(op, provisionedBy, ctx) {
|
|
17812
|
+
const { logicalId, resourceType } = op;
|
|
17813
|
+
const physicalId = op.physicalId;
|
|
17814
|
+
if (ATOMIC_FINAL_SNAPSHOT_TYPES.has(resourceType)) {
|
|
17815
|
+
if (provisionedBy === "cc-api") throw ccRoutedFinalSnapshotError(logicalId, resourceType, SKIP_FINAL_SNAPSHOT_FLAG);
|
|
17816
|
+
return buildFinalSnapshotIdentifier(physicalId, resourceType);
|
|
17817
|
+
}
|
|
17818
|
+
if (PRE_DELETE_SNAPSHOT_TYPES.has(resourceType)) {
|
|
17819
|
+
await createPreDeleteFinalSnapshot(resourceType, physicalId, logicalId, ctx.finalSnapshotClients ?? getAwsClients(), ctx.logger);
|
|
17820
|
+
return;
|
|
17821
|
+
}
|
|
17822
|
+
throw unsupportedFinalSnapshotError(logicalId, resourceType, SKIP_FINAL_SNAPSHOT_FLAG);
|
|
17823
|
+
}
|
|
17824
|
+
/**
|
|
17773
17825
|
* Retry schedule for a re-create that must wait out a name-release delay:
|
|
17774
17826
|
* an async delete's late name release ("already exists") or the SQS 60s
|
|
17775
17827
|
* same-name cooldown (issue #1206). 2s/4s/8s then capped at 10s over 8
|
|
@@ -17822,7 +17874,8 @@ function classifyRollbackOp(op, stateResources, orphanLogicalIds) {
|
|
|
17822
17874
|
if (!current) return "skip-already-done";
|
|
17823
17875
|
if (op.physicalId !== void 0 && current.physicalId !== op.physicalId) return "skip-mismatch";
|
|
17824
17876
|
const policy = current.deletionPolicy;
|
|
17825
|
-
if (policy === "Retain"
|
|
17877
|
+
if (policy === "Retain") return "orphan-retain";
|
|
17878
|
+
if (policy === "Snapshot") return "delete-with-final-snapshot";
|
|
17826
17879
|
return "delete";
|
|
17827
17880
|
}
|
|
17828
17881
|
const current = stateResources[op.logicalId];
|
|
@@ -17847,9 +17900,12 @@ function classifyFailedOp(op, stateResources) {
|
|
|
17847
17900
|
if (op.changeType === "DELETE") return "skip-failed-noop";
|
|
17848
17901
|
const current = stateResources[op.logicalId];
|
|
17849
17902
|
if (op.changeType === "CREATE") {
|
|
17850
|
-
if (op.physicalId
|
|
17903
|
+
if (!op.physicalId) return "skip-failed-unknown";
|
|
17851
17904
|
if (!current) return "skip-failed-noop";
|
|
17852
17905
|
if (current.physicalId !== op.physicalId) return "skip-failed-noop";
|
|
17906
|
+
const policy = current.deletionPolicy;
|
|
17907
|
+
if (policy === "Retain") return "orphan-failed-create-retain";
|
|
17908
|
+
if (policy === "Snapshot") return "delete-failed-create-with-final-snapshot";
|
|
17853
17909
|
return "delete-failed-create";
|
|
17854
17910
|
}
|
|
17855
17911
|
if (!current || !op.previousState) return "skip-failed-absent";
|
|
@@ -17976,7 +18032,7 @@ async function replaySingle(op, stateResources, stackName, ctx, orphanLogicalIds
|
|
|
17976
18032
|
return;
|
|
17977
18033
|
case "orphan-retain":
|
|
17978
18034
|
delete stateResources[op.logicalId];
|
|
17979
|
-
logger.info(` Rollback: Leaving ${op.logicalId} (${op.resourceType}) in AWS (DeletionPolicy:
|
|
18035
|
+
logger.info(` Rollback: Leaving ${op.logicalId} (${op.resourceType}) in AWS (DeletionPolicy: Retain) — removed from state`);
|
|
17980
18036
|
await afterOp?.(op.logicalId);
|
|
17981
18037
|
ctx.recordEvent?.({
|
|
17982
18038
|
eventType: "ROLLBACK_RESOURCE_SUCCEEDED",
|
|
@@ -17987,18 +18043,27 @@ async function replaySingle(op, stateResources, stackName, ctx, orphanLogicalIds
|
|
|
17987
18043
|
...op.provisionedBy && { provisionedBy: op.provisionedBy }
|
|
17988
18044
|
});
|
|
17989
18045
|
return;
|
|
17990
|
-
case "delete":
|
|
18046
|
+
case "delete":
|
|
18047
|
+
case "delete-with-final-snapshot": {
|
|
17991
18048
|
if (!op.physicalId) {
|
|
17992
18049
|
logger.warn(` Rollback: Cannot delete ${op.logicalId} — no physical ID recorded`);
|
|
17993
18050
|
result.warnings++;
|
|
17994
18051
|
return;
|
|
17995
18052
|
}
|
|
17996
|
-
|
|
18053
|
+
const deleteProvisionedBy = effectiveProvisionedBy(stateResources[op.logicalId], op.provisionedBy);
|
|
18054
|
+
const snapshotPolicy = action === "delete-with-final-snapshot";
|
|
18055
|
+
const takeFinalSnapshot = snapshotPolicy && ctx.skipFinalSnapshot !== true;
|
|
18056
|
+
let finalSnapshotIdentifier;
|
|
18057
|
+
if (takeFinalSnapshot) finalSnapshotIdentifier = await prepareCreateRollbackFinalSnapshot(op, deleteProvisionedBy, ctx);
|
|
18058
|
+
logger.info(` Rollback: Deleting created resource ${op.logicalId} (${op.resourceType})` + (takeFinalSnapshot ? " — DeletionPolicy: Snapshot" : "") + (snapshotPolicy && !takeFinalSnapshot ? " — DeletionPolicy: Snapshot NOT taken (--skip-final-snapshot)" : ""));
|
|
17997
18059
|
const { provider } = ctx.providerRegistry.getProviderFor({
|
|
17998
18060
|
resourceType: op.resourceType,
|
|
17999
|
-
provisionedBy:
|
|
18061
|
+
provisionedBy: deleteProvisionedBy
|
|
18062
|
+
});
|
|
18063
|
+
await provider.delete(op.logicalId, op.physicalId, op.resourceType, op.properties, {
|
|
18064
|
+
expectedRegion: ctx.region,
|
|
18065
|
+
...finalSnapshotIdentifier !== void 0 && { finalSnapshotIdentifier }
|
|
18000
18066
|
});
|
|
18001
|
-
await provider.delete(op.logicalId, op.physicalId, op.resourceType, op.properties, { expectedRegion: ctx.region });
|
|
18002
18067
|
delete stateResources[op.logicalId];
|
|
18003
18068
|
logger.info(` Rollback: ${op.logicalId} deleted successfully`);
|
|
18004
18069
|
await afterOp?.(op.logicalId);
|
|
@@ -18217,13 +18282,35 @@ async function replayFailedOperations(failedOps, stateResources, stackName, ctx,
|
|
|
18217
18282
|
logger.warn(` Rollback: cannot revert failed UPDATE of ${op.logicalId} — no previous state available, skipping`);
|
|
18218
18283
|
result.warnings++;
|
|
18219
18284
|
break;
|
|
18220
|
-
case "
|
|
18221
|
-
|
|
18285
|
+
case "orphan-failed-create-retain":
|
|
18286
|
+
delete stateResources[op.logicalId];
|
|
18287
|
+
logger.info(` Rollback: leaving partially-created ${op.logicalId} (${op.resourceType}) in AWS (DeletionPolicy: Retain) — removed from state`);
|
|
18288
|
+
await options.afterOp?.(op.logicalId);
|
|
18289
|
+
ctx.recordEvent?.({
|
|
18290
|
+
eventType: "ROLLBACK_RESOURCE_SUCCEEDED",
|
|
18291
|
+
stackName,
|
|
18292
|
+
operation: "CREATE",
|
|
18293
|
+
logicalId: op.logicalId,
|
|
18294
|
+
resourceType: op.resourceType,
|
|
18295
|
+
...op.provisionedBy && { provisionedBy: op.provisionedBy }
|
|
18296
|
+
});
|
|
18297
|
+
break;
|
|
18298
|
+
case "delete-failed-create":
|
|
18299
|
+
case "delete-failed-create-with-final-snapshot": {
|
|
18300
|
+
const deleteProvisionedBy = effectiveProvisionedBy(stateResources[op.logicalId], op.provisionedBy);
|
|
18301
|
+
const snapshotPolicy = action === "delete-failed-create-with-final-snapshot";
|
|
18302
|
+
const takeFinalSnapshot = snapshotPolicy && ctx.skipFinalSnapshot !== true;
|
|
18303
|
+
let finalSnapshotIdentifier;
|
|
18304
|
+
if (takeFinalSnapshot) finalSnapshotIdentifier = await prepareCreateRollbackFinalSnapshot(op, deleteProvisionedBy, ctx);
|
|
18305
|
+
logger.info(` Rollback: deleting partially-created ${op.logicalId} (${op.resourceType}) (--revert-failed)` + (takeFinalSnapshot ? " — DeletionPolicy: Snapshot" : "") + (snapshotPolicy && !takeFinalSnapshot ? " — DeletionPolicy: Snapshot NOT taken (--skip-final-snapshot)" : ""));
|
|
18222
18306
|
const { provider } = ctx.providerRegistry.getProviderFor({
|
|
18223
18307
|
resourceType: op.resourceType,
|
|
18224
|
-
provisionedBy:
|
|
18308
|
+
provisionedBy: deleteProvisionedBy
|
|
18309
|
+
});
|
|
18310
|
+
await provider.delete(op.logicalId, op.physicalId, op.resourceType, op.attemptedProperties, {
|
|
18311
|
+
expectedRegion: ctx.region,
|
|
18312
|
+
...finalSnapshotIdentifier !== void 0 && { finalSnapshotIdentifier }
|
|
18225
18313
|
});
|
|
18226
|
-
await provider.delete(op.logicalId, op.physicalId, op.resourceType, op.attemptedProperties, { expectedRegion: ctx.region });
|
|
18227
18314
|
delete stateResources[op.logicalId];
|
|
18228
18315
|
await options.afterOp?.(op.logicalId);
|
|
18229
18316
|
ctx.recordEvent?.({
|
|
@@ -18281,9 +18368,6 @@ async function replayFailedOperations(failedOps, stateResources, stackName, ctx,
|
|
|
18281
18368
|
result.remainingFailedOps = failedOps.filter((op) => pending.has(op));
|
|
18282
18369
|
return result;
|
|
18283
18370
|
}
|
|
18284
|
-
function stateResourcesPolicyLabel(op, stateResources) {
|
|
18285
|
-
return stateResources[op.logicalId]?.deletionPolicy ?? "Retain";
|
|
18286
|
-
}
|
|
18287
18371
|
/**
|
|
18288
18372
|
* Sort CREATE rollback operations so that resources depending on others are
|
|
18289
18373
|
* deleted first (reverse dependency order), using state dependencies. Same
|
|
@@ -18373,7 +18457,7 @@ const FLUSH_INTERVAL_MS = 2e3;
|
|
|
18373
18457
|
const FLUSH_EVENT_THRESHOLD = 50;
|
|
18374
18458
|
/** Build-time cdkd version, with a dev fallback for non-built contexts. */
|
|
18375
18459
|
function getCdkdVersion() {
|
|
18376
|
-
return "0.276.
|
|
18460
|
+
return "0.276.3";
|
|
18377
18461
|
}
|
|
18378
18462
|
/**
|
|
18379
18463
|
* Generate a time-sortable unique run id, e.g.
|
|
@@ -19765,7 +19849,9 @@ var DeployEngine = class {
|
|
|
19765
19849
|
providerRegistry: this.providerRegistry,
|
|
19766
19850
|
region: this.stackRegion,
|
|
19767
19851
|
logger: this.logger,
|
|
19768
|
-
recordEvent: (event) => this.recordEvent(event)
|
|
19852
|
+
recordEvent: (event) => this.recordEvent(event),
|
|
19853
|
+
finalSnapshotClients: this.options.finalSnapshotClients,
|
|
19854
|
+
skipFinalSnapshot: this.options.skipFinalSnapshot
|
|
19769
19855
|
};
|
|
19770
19856
|
}
|
|
19771
19857
|
/**
|
|
@@ -20483,4 +20569,4 @@ var DeployEngine = class {
|
|
|
20483
20569
|
|
|
20484
20570
|
//#endregion
|
|
20485
20571
|
export { TemplateParser as $, CdkdError as $t, yellow as A, resolveAutoAssetStorage as At, IntrinsicFunctionResolver as B, MIGRATE_TMP_PREFIX as Bt, renderStatefulReason as C, AssetManifestLoader as Ct, gray as D, getDefaultStateBucketName as Dt, cyan as E, synthesisStatusMessage as Et, findActionableSilentDrops as F, resolveUseCdkBootstrapAssets as Ft, resolveExplicitPhysicalId as G, processStackMessages as Gt, refStateLookupFromResource as H, uploadCfnTemplate as Ht, CloudControlProvider as I, stateBucketExistenceConfirmed as It, DiffCalculator as J, AwsClients as Jt, assertRegionMatch as K, clearBucketRegionCache as Kt, slowCcOperationTimeoutMs as L, warnDeprecatedNoPrefixCliFlag as Lt, collectInlinePolicyNamesManagedBySiblings as M, resolveSkipPrefix as Mt, clearOnUpdateRemoval as N, resolveStateBucketWithDefault as Nt, green as O, getLegacyStateBucketName as Ot, ProviderRegistry as P, resolveStateBucketWithDefaultAndSource as Pt, DagBuilder as Q, AssetError as Qt, disableInstanceApiTermination as R, CFN_TEMPLATE_BODY_LIMIT as Rt, isStatefulRecreateTargetSync as S, runDockerStreaming as St, bold as T, Synthesizer as Tt, WAFv2WebACLProvider as U, expectedOwnerParam as Ut, cfnRefValueFromPhysicalId as V, findLargeInlineResources as Vt, normalizeAwsTagsToCfn as W, AssemblyReader as Wt, withRetry as X, resetAwsClients as Xt, describeTypeWithThrottleRetry as Y, getAwsClients as Yt, isRetryableTransientError as Z, setAwsClients as Zt, createPreDeleteFinalSnapshot as _, formatError as _n, validateContainerRepoName as _t, DeploymentEventsStore as a, LocalStartServiceError as an, stringifyValue as at, extractDeploymentEventError as b, withErrorHandling as bn, getDockerCmd as bt, replayFailedOperations as c, NestedStackChildDirectDestroyError as cn, createAssetRedirectResolver as ct, IMPLICIT_DELETE_DEPENDENCIES as d, ResourceTimeoutError as dn, AssetModeResolver as dt, ConfigError as en, LockManager as et, computeImplicitDeleteEdges as f, ResourceUpdateNotSupportedError as fn, BOOTSTRAP_MARKER_PREFIX as ft, ccRoutedFinalSnapshotError as g, SynthesisError as gn, validateAssetBucketName as gt, buildFinalSnapshotIdentifier as h, StateError as hn, parseBootstrapMarker as ht, DeploymentEventsReader as i, LocalMigrateError as in, AssetPublisher as it, IAMRoleProvider as j, resolveCaptureObservedState as jt, red as k, resolveApp as kt, replayRollback as l, PartialFailureError as ln, loadPublishableAssetManifest as lt, PRE_DELETE_SNAPSHOT_TYPES as m, StackTerminationProtectionError as mn, getBootstrapMarkerKey as mt, DEFAULT_RESOURCE_WARN_AFTER_MS as n, DeployCancelledError as nn, rebuildClientForBucketRegion as nt, planFailedOps as o, LockError as on, WorkGraph as ot, ATOMIC_FINAL_SNAPSHOT_TYPES as p, StackHasActiveImportsError as pn, ensureAssetStorage as pt, applyRoleArnIfSet as q, resolveBucketRegion as qt, DeployEngine as r, LocalInvokeBuildError as rn, shouldRetainResource as rt, planRollback as s, MissingCdkCliError as sn, buildAssetRedirectMap as st, DEFAULT_RESOURCE_TIMEOUT_MS as t, DependencyError as tn, S3StateBackend as tt, withResourceDeadline as u, ProvisioningError as un, rewriteTemplateAssetReferences as ut, isFinalSnapshotError as v, isCdkdError as vn, buildDockerImage as vt, formatResourceLine as w, getDockerImageBySourceHash as wt, MULTI_REGION_RECREATE_BLOCKED_TYPES as x, __exportAll as xn, runDockerForeground as xt, unsupportedFinalSnapshotError as y, normalizeAwsError as yn, formatDockerLoginError as yt, isTerminationProtectionPropagationError as z, CFN_TEMPLATE_URL_LIMIT as zt };
|
|
20486
|
-
//# sourceMappingURL=deploy-engine-
|
|
20572
|
+
//# sourceMappingURL=deploy-engine-gQzltBso.js.map
|