@go-to-k/cdkd 0.238.5 → 0.238.6
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 +34 -18
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1885,7 +1885,7 @@ const FLUSH_INTERVAL_MS = 2e3;
|
|
|
1885
1885
|
const FLUSH_EVENT_THRESHOLD = 50;
|
|
1886
1886
|
/** Build-time cdkd version, with a dev fallback for non-built contexts. */
|
|
1887
1887
|
function getCdkdVersion() {
|
|
1888
|
-
return "0.238.
|
|
1888
|
+
return "0.238.6";
|
|
1889
1889
|
}
|
|
1890
1890
|
/**
|
|
1891
1891
|
* Generate a time-sortable unique run id, e.g.
|
|
@@ -46316,12 +46316,18 @@ function formatBucketSource(source) {
|
|
|
46316
46316
|
* not-yet-bootstrapped bucket. (Bucket existence is verified separately
|
|
46317
46317
|
* via {@link setupStateBackend}, so getting here implies the bucket is
|
|
46318
46318
|
* reachable; `GetBucketLocation` failing is most often a permissions gap.)
|
|
46319
|
+
*
|
|
46320
|
+
* Takes the (region-corrected) S3 client directly — see the issue #1054 note
|
|
46321
|
+
* in {@link stateInfoCommand}. Before that fix this call was made with the
|
|
46322
|
+
* ambient-region client, so a cross-region state bucket silently degraded to
|
|
46323
|
+
* `undefined` ("Region: unknown") here; with the corrected client it now
|
|
46324
|
+
* succeeds and reports the bucket's actual region.
|
|
46319
46325
|
*/
|
|
46320
|
-
async function detectBucketRegion(
|
|
46326
|
+
async function detectBucketRegion(s3, bucket) {
|
|
46321
46327
|
try {
|
|
46322
|
-
const constraint = (await
|
|
46328
|
+
const constraint = (await s3.send(new GetBucketLocationCommand({
|
|
46323
46329
|
Bucket: bucket,
|
|
46324
|
-
...await expectedOwnerParam(
|
|
46330
|
+
...await expectedOwnerParam(s3)
|
|
46325
46331
|
}))).LocationConstraint;
|
|
46326
46332
|
if (!constraint) return "us-east-1";
|
|
46327
46333
|
if (constraint === "EU") return "eu-west-1";
|
|
@@ -46342,12 +46348,12 @@ async function detectBucketRegion(awsClients, bucket) {
|
|
|
46342
46348
|
* Returns the full set of state-file keys; the count is the unique-stacks
|
|
46343
46349
|
* tally we want for the `Stacks:` line.
|
|
46344
46350
|
*/
|
|
46345
|
-
async function listStateFileKeys(
|
|
46351
|
+
async function listStateFileKeys(s3, bucket, prefix) {
|
|
46346
46352
|
const keys = [];
|
|
46347
46353
|
let continuationToken;
|
|
46348
46354
|
const searchPrefix = `${prefix}/`;
|
|
46349
46355
|
do {
|
|
46350
|
-
const resp = await
|
|
46356
|
+
const resp = await s3.send(new ListObjectsV2Command({
|
|
46351
46357
|
Bucket: bucket,
|
|
46352
46358
|
Prefix: searchPrefix,
|
|
46353
46359
|
...continuationToken && { ContinuationToken: continuationToken }
|
|
@@ -46365,13 +46371,13 @@ async function listStateFileKeys(awsClients, bucket, prefix) {
|
|
|
46365
46371
|
* Returns `'unknown'` when no state files exist or parsing fails — we don't
|
|
46366
46372
|
* want a cosmetic command to crash on an unexpected payload.
|
|
46367
46373
|
*/
|
|
46368
|
-
async function readSchemaVersion(
|
|
46374
|
+
async function readSchemaVersion(s3, bucket, keys) {
|
|
46369
46375
|
if (keys.length === 0) return "unknown";
|
|
46370
46376
|
try {
|
|
46371
|
-
const resp = await
|
|
46377
|
+
const resp = await s3.send(new GetObjectCommand({
|
|
46372
46378
|
Bucket: bucket,
|
|
46373
46379
|
Key: keys[0],
|
|
46374
|
-
...await expectedOwnerParam(
|
|
46380
|
+
...await expectedOwnerParam(s3)
|
|
46375
46381
|
}));
|
|
46376
46382
|
if (!resp.Body) return "unknown";
|
|
46377
46383
|
const body = await resp.Body.transformToString();
|
|
@@ -46387,13 +46393,13 @@ async function readSchemaVersion(awsClients, bucket, keys) {
|
|
|
46387
46393
|
* cosmetic command and should not crash on an unexpected payload (deploy
|
|
46388
46394
|
* hard-errors on the same marker instead).
|
|
46389
46395
|
*/
|
|
46390
|
-
async function listAssetStorageMarkers(
|
|
46396
|
+
async function listAssetStorageMarkers(s3, bucket) {
|
|
46391
46397
|
const logger = getLogger();
|
|
46392
46398
|
const entries = [];
|
|
46393
46399
|
let continuationToken;
|
|
46394
46400
|
const keys = [];
|
|
46395
46401
|
do {
|
|
46396
|
-
const resp = await
|
|
46402
|
+
const resp = await s3.send(new ListObjectsV2Command({
|
|
46397
46403
|
Bucket: bucket,
|
|
46398
46404
|
Prefix: BOOTSTRAP_MARKER_PREFIX,
|
|
46399
46405
|
...continuationToken && { ContinuationToken: continuationToken }
|
|
@@ -46404,10 +46410,10 @@ async function listAssetStorageMarkers(awsClients, bucket) {
|
|
|
46404
46410
|
for (const key of keys) {
|
|
46405
46411
|
const region = key.slice(BOOTSTRAP_MARKER_PREFIX.length, -5);
|
|
46406
46412
|
try {
|
|
46407
|
-
const marker = parseBootstrapMarker(await (await
|
|
46413
|
+
const marker = parseBootstrapMarker(await (await s3.send(new GetObjectCommand({
|
|
46408
46414
|
Bucket: bucket,
|
|
46409
46415
|
Key: key,
|
|
46410
|
-
...await expectedOwnerParam(
|
|
46416
|
+
...await expectedOwnerParam(s3)
|
|
46411
46417
|
}))).Body?.transformToString() ?? "", key);
|
|
46412
46418
|
entries.push({
|
|
46413
46419
|
region,
|
|
@@ -46451,6 +46457,7 @@ async function stateInfoCommand(options) {
|
|
|
46451
46457
|
...options.profile && { profile: options.profile }
|
|
46452
46458
|
});
|
|
46453
46459
|
setAwsClients(awsClients);
|
|
46460
|
+
let regionCorrectedS3 = null;
|
|
46454
46461
|
try {
|
|
46455
46462
|
const region = options.region || process.env["AWS_REGION"] || "us-east-1";
|
|
46456
46463
|
const resolved = await resolveStateBucketWithDefaultAndSource(options.stateBucket, region);
|
|
@@ -46460,10 +46467,18 @@ async function stateInfoCommand(options) {
|
|
|
46460
46467
|
bucket,
|
|
46461
46468
|
prefix
|
|
46462
46469
|
}).verifyBucketExists();
|
|
46463
|
-
|
|
46464
|
-
|
|
46465
|
-
|
|
46466
|
-
|
|
46470
|
+
regionCorrectedS3 = await rebuildClientForBucketRegion(awsClients.s3, bucket, {
|
|
46471
|
+
reuseClientCredentials: true,
|
|
46472
|
+
tolerateNonStandardClient: true,
|
|
46473
|
+
onRebuild: ({ bucketRegion, currentRegion }) => {
|
|
46474
|
+
logger.debug(`State bucket '${bucket}' is in '${bucketRegion}' (state-info client was '${String(currentRegion)}'); building a region-corrected S3 client for info reads.`);
|
|
46475
|
+
}
|
|
46476
|
+
});
|
|
46477
|
+
const infoS3 = regionCorrectedS3 ?? awsClients.s3;
|
|
46478
|
+
const detectedRegion = await detectBucketRegion(infoS3, bucket);
|
|
46479
|
+
const stateFileKeys = await listStateFileKeys(infoS3, bucket, prefix);
|
|
46480
|
+
const schemaVersion = await readSchemaVersion(infoS3, bucket, stateFileKeys);
|
|
46481
|
+
const assetStorage = await listAssetStorageMarkers(infoS3, bucket);
|
|
46467
46482
|
if (options.json) {
|
|
46468
46483
|
const json = {
|
|
46469
46484
|
bucket,
|
|
@@ -46491,6 +46506,7 @@ async function stateInfoCommand(options) {
|
|
|
46491
46506
|
}
|
|
46492
46507
|
process.stdout.write(`${lines.join("\n")}\n`);
|
|
46493
46508
|
} finally {
|
|
46509
|
+
regionCorrectedS3?.destroy();
|
|
46494
46510
|
awsClients.destroy();
|
|
46495
46511
|
}
|
|
46496
46512
|
}
|
|
@@ -57183,7 +57199,7 @@ function reorderArgs(argv) {
|
|
|
57183
57199
|
async function main() {
|
|
57184
57200
|
installPipeCloseHandler();
|
|
57185
57201
|
const program = new Command();
|
|
57186
|
-
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.238.
|
|
57202
|
+
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.238.6");
|
|
57187
57203
|
program.addCommand(createBootstrapCommand());
|
|
57188
57204
|
program.addCommand(createSynthCommand());
|
|
57189
57205
|
program.addCommand(createListCommand());
|