@go-to-k/cdkd 0.264.2 → 0.265.1
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 +4 -2
- package/dist/{asg-provider-Bxida3ei.js → asg-provider-DRASZ0qd.js} +2 -2
- package/dist/{asg-provider-Bxida3ei.js.map → asg-provider-DRASZ0qd.js.map} +1 -1
- package/dist/cli.js +3 -3
- package/dist/{deploy-engine-CaquB01e.js → deploy-engine-BO9rVKnc.js} +58 -7
- package/dist/deploy-engine-BO9rVKnc.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/deploy-engine-CaquB01e.js.map +0 -1
|
@@ -11260,7 +11260,7 @@ var CloudControlProvider = class {
|
|
|
11260
11260
|
this.logger.debug(`Deleting resource ${logicalId} (${resourceType}), physical ID: ${physicalId}`);
|
|
11261
11261
|
if (context?.removeProtection === true && resourceType === "AWS::AutoScaling::AutoScalingGroup") {
|
|
11262
11262
|
this.logger.debug(`Delegating protected AutoScalingGroup ${logicalId} delete to the SDK ASGProvider (Cloud Control cannot force-delete a protected ASG)`);
|
|
11263
|
-
const { ASGProvider } = await import("./asg-provider-
|
|
11263
|
+
const { ASGProvider } = await import("./asg-provider-DRASZ0qd.js").then((n) => n.n);
|
|
11264
11264
|
await new ASGProvider().delete(logicalId, physicalId, resourceType, _properties, context);
|
|
11265
11265
|
return;
|
|
11266
11266
|
}
|
|
@@ -17143,7 +17143,7 @@ const FLUSH_INTERVAL_MS = 2e3;
|
|
|
17143
17143
|
const FLUSH_EVENT_THRESHOLD = 50;
|
|
17144
17144
|
/** Build-time cdkd version, with a dev fallback for non-built contexts. */
|
|
17145
17145
|
function getCdkdVersion() {
|
|
17146
|
-
return "0.
|
|
17146
|
+
return "0.265.1";
|
|
17147
17147
|
}
|
|
17148
17148
|
/**
|
|
17149
17149
|
* Generate a time-sortable unique run id, e.g.
|
|
@@ -17981,7 +17981,10 @@ var DeployEngine = class {
|
|
|
17981
17981
|
this.logger.debug(`Loaded current state: ${Object.keys(currentState.resources).length} resources`);
|
|
17982
17982
|
try {
|
|
17983
17983
|
const journal = await this.stateBackend.loadRollbackJournal(stackName, this.stackRegion);
|
|
17984
|
-
if (journal && journal.segments.length > 0)
|
|
17984
|
+
if (journal && journal.segments.length > 0) {
|
|
17985
|
+
const failedOnly = journal.segments.every((s) => s.operations.length === 0) && journal.segments.some((s) => (s.failedOperations?.length ?? 0) > 0);
|
|
17986
|
+
this.logger.info(failedOnly ? `A previous deploy of '${stackName}' failed and was automatically rolled back. The failed resource may be partially applied — run 'cdkd rollback ${stackName} --revert-failed' to revert it, or continue deploying to fix forward (a successful deploy clears this note).` : `A previous deploy of '${stackName}' failed or was interrupted. Run 'cdkd rollback ${stackName}' to revert it, or continue deploying to fix forward.`);
|
|
17987
|
+
}
|
|
17985
17988
|
} catch {}
|
|
17986
17989
|
this.kickOffAutoRefreshObservedProperties(currentState.resources);
|
|
17987
17990
|
this.logger.debug(`Template has ${Object.keys(template.Resources || {}).length} resources`);
|
|
@@ -18052,6 +18055,7 @@ var DeployEngine = class {
|
|
|
18052
18055
|
this.logger.warn(`Failed to persist no-change state update: ${saveError instanceof Error ? saveError.message : String(saveError)} — drift baseline / outputs will be re-resolved on next deploy.`);
|
|
18053
18056
|
}
|
|
18054
18057
|
}
|
|
18058
|
+
if (!this.options.dryRun) await this.deleteRollbackJournalBestEffort(stackName);
|
|
18055
18059
|
return {
|
|
18056
18060
|
stackName,
|
|
18057
18061
|
created: 0,
|
|
@@ -18317,7 +18321,7 @@ var DeployEngine = class {
|
|
|
18317
18321
|
};
|
|
18318
18322
|
await this.stateBackend.saveState(stackName, this.stackRegion, this.withParentInfo(postRollbackState), { ...currentEtag !== void 0 && { expectedEtag: currentEtag } });
|
|
18319
18323
|
this.logger.debug("State saved after deployment failure");
|
|
18320
|
-
if (autoRollbackClean) await this.
|
|
18324
|
+
if (autoRollbackClean) await this.settleJournalAfterCleanRollback(stackName, failedOperations, initialDeploy);
|
|
18321
18325
|
} catch (saveError) {
|
|
18322
18326
|
this.logger.debug(`Retrying state save after rollback (ETag mismatch): ${saveError instanceof Error ? saveError.message : String(saveError)}`);
|
|
18323
18327
|
try {
|
|
@@ -18334,7 +18338,7 @@ var DeployEngine = class {
|
|
|
18334
18338
|
};
|
|
18335
18339
|
await this.stateBackend.saveState(stackName, this.stackRegion, this.withParentInfo(postRollbackState), { ...freshEtag !== void 0 && { expectedEtag: freshEtag } });
|
|
18336
18340
|
this.logger.debug("State saved after deployment failure (retry succeeded)");
|
|
18337
|
-
if (autoRollbackClean) await this.
|
|
18341
|
+
if (autoRollbackClean) await this.settleJournalAfterCleanRollback(stackName, failedOperations, initialDeploy);
|
|
18338
18342
|
} catch (retryError) {
|
|
18339
18343
|
this.logger.warn(`Failed to save state after rollback: ${retryError instanceof Error ? retryError.message : String(retryError)}`);
|
|
18340
18344
|
}
|
|
@@ -18441,6 +18445,45 @@ var DeployEngine = class {
|
|
|
18441
18445
|
this.logger.debug(`Failed to delete rollback journal for ${stackName}: ${err instanceof Error ? err.message : String(err)}`);
|
|
18442
18446
|
}
|
|
18443
18447
|
}
|
|
18448
|
+
/**
|
|
18449
|
+
* Settle the rollback journal after a CLEAN automatic rollback (issue
|
|
18450
|
+
* #1208). The completed ops are reverted, but the op that FAILED mid-deploy
|
|
18451
|
+
* may have left its resource half-applied — and its journaled record is the
|
|
18452
|
+
* ONLY input `cdkd rollback --revert-failed` has. So instead of deleting the
|
|
18453
|
+
* journal outright (which made --revert-failed unusable in the DEFAULT
|
|
18454
|
+
* deploy flow), pop this attempt's segment and re-record a failed-only one
|
|
18455
|
+
* (`operations: []` + the failed ops). Older segments from prior
|
|
18456
|
+
* un-reverted attempts are preserved by the pop. The next successful deploy
|
|
18457
|
+
* still deletes the whole journal, bounding the lingering window. With no
|
|
18458
|
+
* failed ops there is nothing left to revert from THIS attempt — but only
|
|
18459
|
+
* this attempt's segment is popped, NOT the whole journal (issue #1215):
|
|
18460
|
+
* the clean rollback reverted only this attempt's ops, so older segments'
|
|
18461
|
+
* completed ops are still live in AWS/state and must keep their revert
|
|
18462
|
+
* records; pop deletes the object itself when the last segment goes, so
|
|
18463
|
+
* the common single-segment case still ends with no journal.
|
|
18464
|
+
*
|
|
18465
|
+
* Best-effort like every journal write: a pop failure warns and leaves the
|
|
18466
|
+
* full segment in place (the pre-#1208 partial-rollback shape — replay is
|
|
18467
|
+
* idempotent, so a later `cdkd rollback` is still safe).
|
|
18468
|
+
*/
|
|
18469
|
+
async settleJournalAfterCleanRollback(stackName, failedOperations, initialDeploy) {
|
|
18470
|
+
if (failedOperations.length === 0) {
|
|
18471
|
+
try {
|
|
18472
|
+
await this.stateBackend.popRollbackJournalSegment(stackName, this.stackRegion);
|
|
18473
|
+
} catch (err) {
|
|
18474
|
+
this.logger.debug(`Failed to pop the rollback journal segment after the clean rollback: ${err instanceof Error ? err.message : String(err)}`);
|
|
18475
|
+
}
|
|
18476
|
+
return;
|
|
18477
|
+
}
|
|
18478
|
+
try {
|
|
18479
|
+
await this.stateBackend.popRollbackJournalSegment(stackName, this.stackRegion);
|
|
18480
|
+
} catch (err) {
|
|
18481
|
+
this.logger.warn(`Failed to settle the rollback journal after the clean rollback: ${err instanceof Error ? err.message : String(err)}. The journal keeps the full segment; a later 'cdkd rollback' replay is idempotent.`);
|
|
18482
|
+
return;
|
|
18483
|
+
}
|
|
18484
|
+
await this.writeRollbackJournalSegment(stackName, [], failedOperations, "auto-rollback-clean", initialDeploy);
|
|
18485
|
+
this.logger.info(`The automatic rollback restored the pre-deploy state. The failed resource's pre-failure record was kept — if it was left partially applied, run 'cdkd rollback ${stackName} --revert-failed' to revert it.`);
|
|
18486
|
+
}
|
|
18444
18487
|
/** Build the {@link RollbackExecutorContext} from the engine's fields. */
|
|
18445
18488
|
rollbackExecutorContext() {
|
|
18446
18489
|
return {
|
|
@@ -18706,7 +18749,15 @@ var DeployEngine = class {
|
|
|
18706
18749
|
}
|
|
18707
18750
|
}
|
|
18708
18751
|
this.logger.info(` Creating new ${logicalId}...`);
|
|
18709
|
-
createResult = await this.withRetry(() => replaceProvider.create(logicalId, resourceType, replaceProps), logicalId, void 0, void 0, replaceProvider)
|
|
18752
|
+
createResult = await withRetry(() => this.withRetry(() => replaceProvider.create(logicalId, resourceType, replaceProps), logicalId, void 0, void 0, replaceProvider), logicalId, {
|
|
18753
|
+
maxRetries: 8,
|
|
18754
|
+
initialDelayMs: 2e3,
|
|
18755
|
+
maxDelayMs: 1e4,
|
|
18756
|
+
logger: this.logger,
|
|
18757
|
+
isInterrupted: () => this.interrupted,
|
|
18758
|
+
onInterrupted: () => new InterruptedError(this.interruptCause ?? "user"),
|
|
18759
|
+
isRetryable: isRecreateRetryableError
|
|
18760
|
+
});
|
|
18710
18761
|
} else {
|
|
18711
18762
|
this.logger.info(` Creating new ${logicalId}...`);
|
|
18712
18763
|
let deletedOldFirst = false;
|
|
@@ -19080,4 +19131,4 @@ var DeployEngine = class {
|
|
|
19080
19131
|
|
|
19081
19132
|
//#endregion
|
|
19082
19133
|
export { createAssetRedirectResolver as $, ResourceTimeoutError as $t, CloudControlProvider as A, MIGRATE_TMP_PREFIX as At, assertRegionMatch as B, setAwsClients as Bt, green as C, resolveSkipPrefix as Ct, collectInlinePolicyNamesManagedBySiblings as D, warnDeprecatedNoPrefixCliFlag as Dt, IAMRoleProvider as E, resolveUseCdkBootstrapAssets as Et, cfnRefValueFromPhysicalId as F, clearBucketRegionCache as Ft, LockManager as G, LocalInvokeBuildError as Gt, DiffCalculator as H, CdkdError as Ht, refStateLookupFromResource as I, resolveBucketRegion as It, shouldRetainResource as J, LockError as Jt, S3StateBackend as K, LocalMigrateError as Kt, WAFv2WebACLProvider as L, AwsClients as Lt, disableInstanceApiTermination as M, uploadCfnTemplate as Mt, isTerminationProtectionPropagationError as N, expectedOwnerParam as Nt, ProviderRegistry as O, CFN_TEMPLATE_BODY_LIMIT as Ot, IntrinsicFunctionResolver as P, AssemblyReader as Pt, buildAssetRedirectMap as Q, ProvisioningError as Qt, normalizeAwsTagsToCfn as R, getAwsClients as Rt, gray as S, resolveCaptureObservedState as St, yellow as T, resolveStateBucketWithDefaultAndSource as Tt, DagBuilder as U, ConfigError as Ut, applyRoleArnIfSet as V, AssetError as Vt, TemplateParser as W, DependencyError as Wt, stringifyValue as X, NestedStackChildDirectDestroyError as Xt, AssetPublisher as Y, MissingCdkCliError as Yt, WorkGraph as Z, PartialFailureError as Zt, isStatefulRecreateTargetSync as _, synthesisStatusMessage as _t, DeploymentEventsStore as a, formatError as an, getBootstrapMarkerKey as at, bold as b, resolveApp as bt, replayFailedOperations as c, withErrorHandling as cn, validateContainerRepoName as ct, withRetry as d, getDockerCmd as dt, ResourceUpdateNotSupportedError as en, loadPublishableAssetManifest as et, isRetryableTransientError as f, runDockerForeground as ft, MULTI_REGION_RECREATE_BLOCKED_TYPES as g, Synthesizer as gt, extractDeploymentEventError as h, getDockerImageBySourceHash as ht, DeploymentEventsReader as i, SynthesisError as in, ensureAssetStorage as it, slowCcOperationTimeoutMs as j, findLargeInlineResources as jt, findActionableSilentDrops as k, CFN_TEMPLATE_URL_LIMIT as kt, replayRollback as l, __exportAll as ln, buildDockerImage as lt, computeImplicitDeleteEdges as m, AssetManifestLoader as mt, DEFAULT_RESOURCE_WARN_AFTER_MS as n, StackTerminationProtectionError as nn, AssetModeResolver as nt, planFailedOps as o, isCdkdError as on, parseBootstrapMarker as ot, IMPLICIT_DELETE_DEPENDENCIES as p, runDockerStreaming as pt, rebuildClientForBucketRegion as q, LocalStartServiceError as qt, DeployEngine as r, StateError as rn, BOOTSTRAP_MARKER_PREFIX as rt, planRollback as s, normalizeAwsError as sn, validateAssetBucketName as st, DEFAULT_RESOURCE_TIMEOUT_MS as t, StackHasActiveImportsError as tn, rewriteTemplateAssetReferences as tt, withResourceDeadline as u, formatDockerLoginError as ut, renderStatefulReason as v, getDefaultStateBucketName as vt, red as w, resolveStateBucketWithDefault as wt, cyan as x, resolveAutoAssetStorage as xt, formatResourceLine as y, getLegacyStateBucketName as yt, resolveExplicitPhysicalId as z, resetAwsClients as zt };
|
|
19083
|
-
//# sourceMappingURL=deploy-engine-
|
|
19134
|
+
//# sourceMappingURL=deploy-engine-BO9rVKnc.js.map
|