@aws-cdk/toolkit-lib 0.1.4 → 0.1.5
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/build-info.json +2 -2
- package/lib/actions/bootstrap/index.d.ts +1 -1
- package/lib/actions/bootstrap/index.js +1 -1
- package/lib/actions/bootstrap/private/helpers.d.ts +1 -1
- package/lib/actions/bootstrap/private/helpers.js +1 -1
- package/lib/actions/deploy/index.d.ts +4 -2
- package/lib/actions/deploy/index.js +4 -1
- package/lib/actions/deploy/private/deploy-options.d.ts +1 -1
- package/lib/actions/deploy/private/deploy-options.js +1 -1
- package/lib/actions/deploy/private/helpers.d.ts +3 -2
- package/lib/actions/deploy/private/helpers.js +1 -1
- package/lib/actions/diff/private/helpers.d.ts +5 -5
- package/lib/actions/diff/private/helpers.js +13 -11
- package/lib/actions/list/index.d.ts +0 -4
- package/lib/actions/list/index.js +1 -1
- package/lib/api/aws-cdk.d.ts +3 -4
- package/lib/api/aws-cdk.js +948 -548
- package/lib/api/aws-cdk.js.map +4 -4
- package/lib/api/cloud-assembly/index.d.ts +1 -1
- package/lib/api/cloud-assembly/index.js +2 -2
- package/lib/api/cloud-assembly/private/cached-source.d.ts +2 -2
- package/lib/api/cloud-assembly/private/cached-source.js +1 -1
- package/lib/api/cloud-assembly/private/context-aware-source.d.ts +4 -4
- package/lib/api/cloud-assembly/private/context-aware-source.js +11 -12
- package/lib/api/cloud-assembly/private/identity-source.d.ts +1 -1
- package/lib/api/cloud-assembly/private/identity-source.js +1 -1
- package/lib/api/cloud-assembly/private/prepare-source.d.ts +5 -5
- package/lib/api/cloud-assembly/private/prepare-source.js +8 -6
- package/lib/api/cloud-assembly/private/source-builder.d.ts +4 -4
- package/lib/api/cloud-assembly/private/source-builder.js +24 -12
- package/lib/api/cloud-assembly/private/stack-assembly.d.ts +3 -3
- package/lib/api/cloud-assembly/private/stack-assembly.js +1 -1
- package/lib/api/cloud-assembly/private/stack-selectors.d.ts +1 -1
- package/lib/api/cloud-assembly/private/stack-selectors.js +1 -1
- package/lib/api/cloud-assembly/source-builder.d.ts +36 -0
- package/lib/api/cloud-assembly/source-builder.js +1 -1
- package/lib/api/cloud-assembly/stack-selector.d.ts +2 -81
- package/lib/api/cloud-assembly/stack-selector.js +5 -62
- package/lib/api/io/private/index.d.ts +3 -5
- package/lib/api/io/private/index.js +7 -6
- package/lib/api/io/private/io-host-wrappers.d.ts +17 -0
- package/lib/api/io/private/io-host-wrappers.js +74 -0
- package/lib/api/io/private/sdk-logger.d.ts +3 -0
- package/lib/api/io/private/sdk-logger.js +124 -0
- package/lib/api/shared-private.js +655 -26
- package/lib/api/shared-private.js.map +4 -4
- package/lib/api/shared-public.d.ts +2365 -31
- package/lib/api/shared-public.js +78 -5
- package/lib/api/shared-public.js.map +4 -4
- package/lib/index.d.ts +3 -0
- package/lib/index.js +4 -1
- package/lib/private/util.js +9 -4
- package/lib/private/util.js.map +2 -2
- package/lib/toolkit/index.d.ts +1 -1
- package/lib/toolkit/index.js +2 -2
- package/lib/toolkit/private/index.d.ts +4 -4
- package/lib/toolkit/private/index.js +1 -1
- package/lib/toolkit/toolkit.d.ts +6 -8
- package/lib/toolkit/toolkit.js +148 -122
- package/lib/util/concurrency.d.ts +1 -1
- package/lib/util/concurrency.js +2 -2
- package/package.json +5 -4
- package/CODE_REGISTRY.md +0 -38
- package/lib/api/cloud-assembly/context.d.ts +0 -9
- package/lib/api/cloud-assembly/context.js +0 -3
- package/lib/api/io/private/codes.d.ts +0 -47
- package/lib/api/io/private/codes.js +0 -175
- package/lib/api/io/private/level-priority.d.ts +0 -11
- package/lib/api/io/private/level-priority.js +0 -33
- package/lib/api/io/private/logger.d.ts +0 -31
- package/lib/api/io/private/logger.js +0 -190
- package/lib/api/io/private/messages.d.ts +0 -62
- package/lib/api/io/private/messages.js +0 -162
- package/lib/api/io/private/timer.d.ts +0 -29
- package/lib/api/io/private/timer.js +0 -55
- package/lib/toolkit/types.d.ts +0 -76
- package/lib/toolkit/types.js +0 -3
package/lib/api/aws-cdk.js
CHANGED
|
@@ -27,12 +27,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
30
|
-
var
|
|
30
|
+
var result2 = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
31
31
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
32
32
|
if (decorator = decorators[i])
|
|
33
|
-
|
|
34
|
-
if (kind &&
|
|
35
|
-
return
|
|
33
|
+
result2 = (kind ? decorator(target, key, result2) : decorator(result2)) || result2;
|
|
34
|
+
if (kind && result2) __defProp(target, key, result2);
|
|
35
|
+
return result2;
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
// lib/api/aws-cdk.ts
|
|
@@ -58,7 +58,6 @@ __export(aws_cdk_exports, {
|
|
|
58
58
|
WorkGraphBuilder: () => WorkGraphBuilder,
|
|
59
59
|
contextproviders: () => context_providers_exports,
|
|
60
60
|
findCloudWatchLogGroups: () => findCloudWatchLogGroups,
|
|
61
|
-
formatSdkLoggerContent: () => formatSdkLoggerContent,
|
|
62
61
|
guessExecutable: () => guessExecutable,
|
|
63
62
|
loadTree: () => loadTree,
|
|
64
63
|
prepareContext: () => prepareContext,
|
|
@@ -104,14 +103,15 @@ var chalk4 = __toESM(require("chalk"));
|
|
|
104
103
|
|
|
105
104
|
// ../../aws-cdk/lib/toolkit/cli-io-host.ts
|
|
106
105
|
var util3 = __toESM(require("node:util"));
|
|
106
|
+
var import_cloud_assembly_schema = require("@aws-cdk/cloud-assembly-schema");
|
|
107
107
|
var chalk3 = __toESM(require("chalk"));
|
|
108
108
|
var promptly = __toESM(require("promptly"));
|
|
109
109
|
|
|
110
110
|
// ../tmp-toolkit-helpers/src/api/toolkit-error.ts
|
|
111
|
-
var TOOLKIT_ERROR_SYMBOL = Symbol.for("@aws-cdk/toolkit.ToolkitError");
|
|
112
|
-
var AUTHENTICATION_ERROR_SYMBOL = Symbol.for("@aws-cdk/toolkit.AuthenticationError");
|
|
113
|
-
var ASSEMBLY_ERROR_SYMBOL = Symbol.for("@aws-cdk/toolkit.AssemblyError");
|
|
114
|
-
var CONTEXT_PROVIDER_ERROR_SYMBOL = Symbol.for("@aws-cdk/toolkit.ContextProviderError");
|
|
111
|
+
var TOOLKIT_ERROR_SYMBOL = Symbol.for("@aws-cdk/toolkit-lib.ToolkitError");
|
|
112
|
+
var AUTHENTICATION_ERROR_SYMBOL = Symbol.for("@aws-cdk/toolkit-lib.AuthenticationError");
|
|
113
|
+
var ASSEMBLY_ERROR_SYMBOL = Symbol.for("@aws-cdk/toolkit-lib.AssemblyError");
|
|
114
|
+
var CONTEXT_PROVIDER_ERROR_SYMBOL = Symbol.for("@aws-cdk/toolkit-lib.ContextProviderError");
|
|
115
115
|
var ToolkitError = class _ToolkitError extends Error {
|
|
116
116
|
/**
|
|
117
117
|
* Determines if a given error is an instance of ToolkitError.
|
|
@@ -141,46 +141,91 @@ var ToolkitError = class _ToolkitError extends Error {
|
|
|
141
141
|
* The type of the error, defaults to "toolkit".
|
|
142
142
|
*/
|
|
143
143
|
type;
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
/**
|
|
145
|
+
* Denotes the source of the error as the toolkit.
|
|
146
|
+
*/
|
|
147
|
+
source;
|
|
148
|
+
constructor(message2, type = "toolkit") {
|
|
149
|
+
super(message2);
|
|
146
150
|
Object.setPrototypeOf(this, _ToolkitError.prototype);
|
|
147
151
|
Object.defineProperty(this, TOOLKIT_ERROR_SYMBOL, { value: true });
|
|
148
152
|
this.name = new.target.name;
|
|
149
153
|
this.type = type;
|
|
154
|
+
this.source = "toolkit";
|
|
150
155
|
}
|
|
151
156
|
};
|
|
152
157
|
var AuthenticationError = class _AuthenticationError extends ToolkitError {
|
|
153
|
-
|
|
154
|
-
|
|
158
|
+
/**
|
|
159
|
+
* Denotes the source of the error as user.
|
|
160
|
+
*/
|
|
161
|
+
source = "user";
|
|
162
|
+
constructor(message2) {
|
|
163
|
+
super(message2, "authentication");
|
|
155
164
|
Object.setPrototypeOf(this, _AuthenticationError.prototype);
|
|
156
165
|
Object.defineProperty(this, AUTHENTICATION_ERROR_SYMBOL, { value: true });
|
|
157
166
|
}
|
|
158
167
|
};
|
|
159
168
|
var AssemblyError = class _AssemblyError extends ToolkitError {
|
|
160
|
-
|
|
161
|
-
|
|
169
|
+
/**
|
|
170
|
+
* An AssemblyError with an original error as cause
|
|
171
|
+
*/
|
|
172
|
+
static withCause(message2, error4) {
|
|
173
|
+
return new _AssemblyError(message2, void 0, error4);
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* An AssemblyError with a list of stacks as cause
|
|
177
|
+
*/
|
|
178
|
+
static withStacks(message2, stacks) {
|
|
179
|
+
return new _AssemblyError(message2, stacks);
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Denotes the source of the error as user.
|
|
183
|
+
*/
|
|
184
|
+
source = "user";
|
|
185
|
+
/**
|
|
186
|
+
* The stacks that caused the error, if available
|
|
187
|
+
*
|
|
188
|
+
* The `messages` property of each `cxapi.CloudFormationStackArtifact` will contain the respective errors.
|
|
189
|
+
* Absence indicates synthesis didn't fully complete.
|
|
190
|
+
*/
|
|
191
|
+
stacks;
|
|
192
|
+
/**
|
|
193
|
+
* The specific original cause of the error, if available
|
|
194
|
+
*/
|
|
195
|
+
cause;
|
|
196
|
+
constructor(message2, stacks, cause) {
|
|
197
|
+
super(message2, "assembly");
|
|
162
198
|
Object.setPrototypeOf(this, _AssemblyError.prototype);
|
|
163
199
|
Object.defineProperty(this, ASSEMBLY_ERROR_SYMBOL, { value: true });
|
|
200
|
+
this.stacks = stacks;
|
|
201
|
+
this.cause = cause;
|
|
164
202
|
}
|
|
165
203
|
};
|
|
166
204
|
var ContextProviderError = class _ContextProviderError extends ToolkitError {
|
|
167
|
-
|
|
168
|
-
|
|
205
|
+
/**
|
|
206
|
+
* Denotes the source of the error as user.
|
|
207
|
+
*/
|
|
208
|
+
source = "user";
|
|
209
|
+
constructor(message2) {
|
|
210
|
+
super(message2, "context-provider");
|
|
169
211
|
Object.setPrototypeOf(this, _ContextProviderError.prototype);
|
|
170
212
|
Object.defineProperty(this, CONTEXT_PROVIDER_ERROR_SYMBOL, { value: true });
|
|
171
213
|
}
|
|
172
214
|
};
|
|
173
215
|
|
|
216
|
+
// ../tmp-toolkit-helpers/src/api/io/private/span.ts
|
|
217
|
+
var uuid = __toESM(require("uuid"));
|
|
218
|
+
|
|
174
219
|
// ../tmp-toolkit-helpers/src/util/archive.ts
|
|
175
220
|
var glob = __toESM(require("glob"));
|
|
176
221
|
|
|
177
222
|
// ../tmp-toolkit-helpers/src/util/format-error.ts
|
|
178
|
-
function formatErrorMessage(
|
|
179
|
-
if (
|
|
180
|
-
const innerMessages =
|
|
223
|
+
function formatErrorMessage(error4) {
|
|
224
|
+
if (error4 && Array.isArray(error4.errors)) {
|
|
225
|
+
const innerMessages = error4.errors.map((innerError) => innerError?.message || innerError?.toString()).join("\n");
|
|
181
226
|
return `AggregateError: ${innerMessages}`;
|
|
182
227
|
}
|
|
183
|
-
return
|
|
228
|
+
return error4?.message || error4?.toString() || "Unknown error";
|
|
184
229
|
}
|
|
185
230
|
|
|
186
231
|
// ../tmp-toolkit-helpers/src/util/archive.ts
|
|
@@ -194,18 +239,6 @@ function flatten(xs) {
|
|
|
194
239
|
return Array.prototype.concat.apply([], xs);
|
|
195
240
|
}
|
|
196
241
|
|
|
197
|
-
// ../tmp-toolkit-helpers/src/util/bytes.ts
|
|
198
|
-
function formatBytes(bytes, decimals = 2) {
|
|
199
|
-
decimals = decimals < 0 ? 0 : decimals;
|
|
200
|
-
if (bytes === 0) {
|
|
201
|
-
return "0 Bytes";
|
|
202
|
-
}
|
|
203
|
-
const k = 1024;
|
|
204
|
-
const sizes = ["Bytes", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"];
|
|
205
|
-
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
206
|
-
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(decimals))} ${sizes[i]}`;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
242
|
// ../tmp-toolkit-helpers/src/util/cloudformation.ts
|
|
210
243
|
function stackEventHasErrorMessage(status) {
|
|
211
244
|
return status.endsWith("_FAILED") || status === "ROLLBACK_IN_PROGRESS" || status === "UPDATE_ROLLBACK_IN_PROGRESS";
|
|
@@ -412,20 +445,20 @@ function deepMerge(...objects) {
|
|
|
412
445
|
async function parallelPromises(n, promises) {
|
|
413
446
|
const ret = new Array();
|
|
414
447
|
let count = 0;
|
|
415
|
-
let
|
|
448
|
+
let error4;
|
|
416
449
|
const queue = [...promises];
|
|
417
450
|
return new Promise((ok, ko) => {
|
|
418
451
|
tick();
|
|
419
452
|
function tick() {
|
|
420
|
-
if (count === 0 &&
|
|
421
|
-
ko(
|
|
453
|
+
if (count === 0 && error4) {
|
|
454
|
+
ko(error4);
|
|
422
455
|
return;
|
|
423
456
|
}
|
|
424
457
|
if (count === 0 && queue.length === 0) {
|
|
425
458
|
ok(ret);
|
|
426
459
|
return;
|
|
427
460
|
}
|
|
428
|
-
while (count < n && queue.length > 0 && !
|
|
461
|
+
while (count < n && queue.length > 0 && !error4) {
|
|
429
462
|
const next = queue.shift();
|
|
430
463
|
if (next !== void 0) {
|
|
431
464
|
start(next);
|
|
@@ -434,10 +467,10 @@ async function parallelPromises(n, promises) {
|
|
|
434
467
|
}
|
|
435
468
|
function start(fn) {
|
|
436
469
|
count += 1;
|
|
437
|
-
fn().then((
|
|
438
|
-
ret.push(
|
|
470
|
+
fn().then((result2) => {
|
|
471
|
+
ret.push(result2);
|
|
439
472
|
}).catch((e) => {
|
|
440
|
-
|
|
473
|
+
error4 = e;
|
|
441
474
|
}).finally(() => {
|
|
442
475
|
count -= 1;
|
|
443
476
|
tick();
|
|
@@ -524,15 +557,6 @@ async function loadStructuredFile(fileName) {
|
|
|
524
557
|
const contents = await fs2.readFile(fileName, { encoding: "utf-8" });
|
|
525
558
|
return deserializeStructure(contents);
|
|
526
559
|
}
|
|
527
|
-
function isJsonBuffer(value) {
|
|
528
|
-
return typeof value === "object" && "type" in value && value.type === "Buffer" && "data" in value && Array.isArray(value.data);
|
|
529
|
-
}
|
|
530
|
-
function replacerBufferWithInfo(_key, value) {
|
|
531
|
-
if (isJsonBuffer(value)) {
|
|
532
|
-
return `<Buffer: ${formatBytes(value.data.length)}>`;
|
|
533
|
-
}
|
|
534
|
-
return value;
|
|
535
|
-
}
|
|
536
560
|
|
|
537
561
|
// ../tmp-toolkit-helpers/src/util/string-manipulation.ts
|
|
538
562
|
function padLeft(n, x, char = " ") {
|
|
@@ -554,6 +578,465 @@ function millisecondsToSeconds(num) {
|
|
|
554
578
|
// ../tmp-toolkit-helpers/src/util/version-range.ts
|
|
555
579
|
var semver = __toESM(require("semver"));
|
|
556
580
|
|
|
581
|
+
// ../tmp-toolkit-helpers/src/api/io/private/level-priority.ts
|
|
582
|
+
var levels = [
|
|
583
|
+
"trace",
|
|
584
|
+
"debug",
|
|
585
|
+
"info",
|
|
586
|
+
"warn",
|
|
587
|
+
"result",
|
|
588
|
+
"error"
|
|
589
|
+
];
|
|
590
|
+
var orderedLevels = Object.fromEntries(Object.entries(levels).map((a) => a.reverse()));
|
|
591
|
+
function compareFn(a, b) {
|
|
592
|
+
return orderedLevels[a] - orderedLevels[b];
|
|
593
|
+
}
|
|
594
|
+
function isMessageRelevantForLevel(msg, level) {
|
|
595
|
+
return compareFn(msg.level, level) >= 0;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
// ../tmp-toolkit-helpers/src/api/io/private/message-maker.ts
|
|
599
|
+
function message(level, details) {
|
|
600
|
+
const maker = (text, data) => ({
|
|
601
|
+
time: /* @__PURE__ */ new Date(),
|
|
602
|
+
level,
|
|
603
|
+
code: details.code,
|
|
604
|
+
message: text,
|
|
605
|
+
data
|
|
606
|
+
});
|
|
607
|
+
return {
|
|
608
|
+
...details,
|
|
609
|
+
level,
|
|
610
|
+
msg: maker,
|
|
611
|
+
is: (m) => m.code === details.code
|
|
612
|
+
};
|
|
613
|
+
}
|
|
614
|
+
var trace = (details) => message("trace", details);
|
|
615
|
+
var debug = (details) => message("debug", details);
|
|
616
|
+
var info = (details) => message("info", details);
|
|
617
|
+
var warn = (details) => message("warn", details);
|
|
618
|
+
var error = (details) => message("error", details);
|
|
619
|
+
var result = (details) => message("result", details);
|
|
620
|
+
function request(level, details) {
|
|
621
|
+
const maker = (text, data) => ({
|
|
622
|
+
time: /* @__PURE__ */ new Date(),
|
|
623
|
+
level,
|
|
624
|
+
code: details.code,
|
|
625
|
+
message: text,
|
|
626
|
+
data,
|
|
627
|
+
defaultResponse: details.defaultResponse
|
|
628
|
+
});
|
|
629
|
+
return {
|
|
630
|
+
...details,
|
|
631
|
+
level,
|
|
632
|
+
req: maker
|
|
633
|
+
};
|
|
634
|
+
}
|
|
635
|
+
var confirm = (details) => request("info", {
|
|
636
|
+
...details,
|
|
637
|
+
defaultResponse: true
|
|
638
|
+
});
|
|
639
|
+
|
|
640
|
+
// ../tmp-toolkit-helpers/src/api/io/private/messages.ts
|
|
641
|
+
var IO = {
|
|
642
|
+
// Defaults
|
|
643
|
+
DEFAULT_TOOLKIT_INFO: info({
|
|
644
|
+
code: "CDK_TOOLKIT_I0000",
|
|
645
|
+
description: "Default info messages emitted from the Toolkit"
|
|
646
|
+
}),
|
|
647
|
+
DEFAULT_TOOLKIT_DEBUG: debug({
|
|
648
|
+
code: "CDK_TOOLKIT_I0000",
|
|
649
|
+
description: "Default debug messages emitted from the Toolkit"
|
|
650
|
+
}),
|
|
651
|
+
DEFAULT_TOOLKIT_WARN: warn({
|
|
652
|
+
code: "CDK_TOOLKIT_W0000",
|
|
653
|
+
description: "Default warning messages emitted from the Toolkit"
|
|
654
|
+
}),
|
|
655
|
+
// 1: Synth
|
|
656
|
+
CDK_TOOLKIT_I1000: info({
|
|
657
|
+
code: "CDK_TOOLKIT_I1000",
|
|
658
|
+
description: "Provides synthesis times.",
|
|
659
|
+
interface: "Duration"
|
|
660
|
+
}),
|
|
661
|
+
CDK_TOOLKIT_I1001: trace({
|
|
662
|
+
code: "CDK_TOOLKIT_I1001",
|
|
663
|
+
description: "Cloud Assembly synthesis is starting",
|
|
664
|
+
interface: "StackSelectionDetails"
|
|
665
|
+
}),
|
|
666
|
+
CDK_TOOLKIT_I1901: result({
|
|
667
|
+
code: "CDK_TOOLKIT_I1901",
|
|
668
|
+
description: "Provides stack data",
|
|
669
|
+
interface: "StackAndAssemblyData"
|
|
670
|
+
}),
|
|
671
|
+
CDK_TOOLKIT_I1902: result({
|
|
672
|
+
code: "CDK_TOOLKIT_I1902",
|
|
673
|
+
description: "Successfully deployed stacks",
|
|
674
|
+
interface: "AssemblyData"
|
|
675
|
+
}),
|
|
676
|
+
// 2: List
|
|
677
|
+
CDK_TOOLKIT_I2901: result({
|
|
678
|
+
code: "CDK_TOOLKIT_I2901",
|
|
679
|
+
description: "Provides details on the selected stacks and their dependencies",
|
|
680
|
+
interface: "StackDetailsPayload"
|
|
681
|
+
}),
|
|
682
|
+
// 3: Import & Migrate
|
|
683
|
+
CDK_TOOLKIT_E3900: error({
|
|
684
|
+
code: "CDK_TOOLKIT_E3900",
|
|
685
|
+
description: "Resource import failed"
|
|
686
|
+
}),
|
|
687
|
+
// 4: Diff
|
|
688
|
+
// 5: Deploy & Watch
|
|
689
|
+
CDK_TOOLKIT_I5000: info({
|
|
690
|
+
code: "CDK_TOOLKIT_I5000",
|
|
691
|
+
description: "Provides deployment times",
|
|
692
|
+
interface: "Duration"
|
|
693
|
+
}),
|
|
694
|
+
CDK_TOOLKIT_I5001: info({
|
|
695
|
+
code: "CDK_TOOLKIT_I5001",
|
|
696
|
+
description: "Provides total time in deploy action, including synth and rollback",
|
|
697
|
+
interface: "Duration"
|
|
698
|
+
}),
|
|
699
|
+
CDK_TOOLKIT_I5002: info({
|
|
700
|
+
code: "CDK_TOOLKIT_I5002",
|
|
701
|
+
description: "Provides time for resource migration"
|
|
702
|
+
}),
|
|
703
|
+
CDK_TOOLKIT_W5021: warn({
|
|
704
|
+
code: "CDK_TOOLKIT_W5021",
|
|
705
|
+
description: "Empty non-existent stack, deployment is skipped"
|
|
706
|
+
}),
|
|
707
|
+
CDK_TOOLKIT_W5022: warn({
|
|
708
|
+
code: "CDK_TOOLKIT_W5022",
|
|
709
|
+
description: "Empty existing stack, stack will be destroyed"
|
|
710
|
+
}),
|
|
711
|
+
CDK_TOOLKIT_I5031: info({
|
|
712
|
+
code: "CDK_TOOLKIT_I5031",
|
|
713
|
+
description: "Informs about any log groups that are traced as part of the deployment"
|
|
714
|
+
}),
|
|
715
|
+
CDK_TOOLKIT_I5032: debug({
|
|
716
|
+
code: "CDK_TOOLKIT_I5032",
|
|
717
|
+
description: "Start monitoring log groups",
|
|
718
|
+
interface: "CloudWatchLogMonitorControlEvent"
|
|
719
|
+
}),
|
|
720
|
+
CDK_TOOLKIT_I5033: info({
|
|
721
|
+
code: "CDK_TOOLKIT_I5033",
|
|
722
|
+
description: "A log event received from Cloud Watch",
|
|
723
|
+
interface: "CloudWatchLogEvent"
|
|
724
|
+
}),
|
|
725
|
+
CDK_TOOLKIT_I5034: debug({
|
|
726
|
+
code: "CDK_TOOLKIT_I5034",
|
|
727
|
+
description: "Stop monitoring log groups",
|
|
728
|
+
interface: "CloudWatchLogMonitorControlEvent"
|
|
729
|
+
}),
|
|
730
|
+
CDK_TOOLKIT_E5035: error({
|
|
731
|
+
code: "CDK_TOOLKIT_E5035",
|
|
732
|
+
description: "A log monitoring error",
|
|
733
|
+
interface: "ErrorPayload"
|
|
734
|
+
}),
|
|
735
|
+
CDK_TOOLKIT_I5050: confirm({
|
|
736
|
+
code: "CDK_TOOLKIT_I5050",
|
|
737
|
+
description: "Confirm rollback during deployment",
|
|
738
|
+
interface: "ConfirmationRequest"
|
|
739
|
+
}),
|
|
740
|
+
CDK_TOOLKIT_I5060: confirm({
|
|
741
|
+
code: "CDK_TOOLKIT_I5060",
|
|
742
|
+
description: "Confirm deploy security sensitive changes",
|
|
743
|
+
interface: "DeployConfirmationRequest"
|
|
744
|
+
}),
|
|
745
|
+
CDK_TOOLKIT_I5100: info({
|
|
746
|
+
code: "CDK_TOOLKIT_I5100",
|
|
747
|
+
description: "Stack deploy progress",
|
|
748
|
+
interface: "StackDeployProgress"
|
|
749
|
+
}),
|
|
750
|
+
// Assets
|
|
751
|
+
CDK_TOOLKIT_I5210: trace({
|
|
752
|
+
code: "CDK_TOOLKIT_I5210",
|
|
753
|
+
description: "Started building a specific asset",
|
|
754
|
+
interface: "BuildAsset"
|
|
755
|
+
}),
|
|
756
|
+
CDK_TOOLKIT_I5211: trace({
|
|
757
|
+
code: "CDK_TOOLKIT_I5211",
|
|
758
|
+
description: "Building the asset has completed",
|
|
759
|
+
interface: "Duration"
|
|
760
|
+
}),
|
|
761
|
+
CDK_TOOLKIT_I5220: trace({
|
|
762
|
+
code: "CDK_TOOLKIT_I5220",
|
|
763
|
+
description: "Started publishing a specific asset",
|
|
764
|
+
interface: "PublishAsset"
|
|
765
|
+
}),
|
|
766
|
+
CDK_TOOLKIT_I5221: trace({
|
|
767
|
+
code: "CDK_TOOLKIT_I5221",
|
|
768
|
+
description: "Publishing the asset has completed",
|
|
769
|
+
interface: "Duration"
|
|
770
|
+
}),
|
|
771
|
+
// Watch
|
|
772
|
+
CDK_TOOLKIT_I5310: debug({
|
|
773
|
+
code: "CDK_TOOLKIT_I5310",
|
|
774
|
+
description: "The computed settings used for file watching",
|
|
775
|
+
interface: "WatchSettings"
|
|
776
|
+
}),
|
|
777
|
+
CDK_TOOLKIT_I5311: info({
|
|
778
|
+
code: "CDK_TOOLKIT_I5311",
|
|
779
|
+
description: "File watching started",
|
|
780
|
+
interface: "FileWatchEvent"
|
|
781
|
+
}),
|
|
782
|
+
CDK_TOOLKIT_I5312: info({
|
|
783
|
+
code: "CDK_TOOLKIT_I5312",
|
|
784
|
+
description: "File event detected, starting deployment",
|
|
785
|
+
interface: "FileWatchEvent"
|
|
786
|
+
}),
|
|
787
|
+
CDK_TOOLKIT_I5313: info({
|
|
788
|
+
code: "CDK_TOOLKIT_I5313",
|
|
789
|
+
description: "File event detected during active deployment, changes are queued",
|
|
790
|
+
interface: "FileWatchEvent"
|
|
791
|
+
}),
|
|
792
|
+
CDK_TOOLKIT_I5314: info({
|
|
793
|
+
code: "CDK_TOOLKIT_I5314",
|
|
794
|
+
description: "Initial watch deployment started"
|
|
795
|
+
}),
|
|
796
|
+
CDK_TOOLKIT_I5315: info({
|
|
797
|
+
code: "CDK_TOOLKIT_I5315",
|
|
798
|
+
description: "Queued watch deployment started"
|
|
799
|
+
}),
|
|
800
|
+
// Stack Monitor
|
|
801
|
+
CDK_TOOLKIT_I5501: info({
|
|
802
|
+
code: "CDK_TOOLKIT_I5501",
|
|
803
|
+
description: "Stack Monitoring: Start monitoring of a single stack",
|
|
804
|
+
interface: "StackMonitoringControlEvent"
|
|
805
|
+
}),
|
|
806
|
+
CDK_TOOLKIT_I5502: info({
|
|
807
|
+
code: "CDK_TOOLKIT_I5502",
|
|
808
|
+
description: "Stack Monitoring: Activity event for a single stack",
|
|
809
|
+
interface: "StackActivity"
|
|
810
|
+
}),
|
|
811
|
+
CDK_TOOLKIT_I5503: info({
|
|
812
|
+
code: "CDK_TOOLKIT_I5503",
|
|
813
|
+
description: "Stack Monitoring: Finished monitoring of a single stack",
|
|
814
|
+
interface: "StackMonitoringControlEvent"
|
|
815
|
+
}),
|
|
816
|
+
// Success
|
|
817
|
+
CDK_TOOLKIT_I5900: result({
|
|
818
|
+
code: "CDK_TOOLKIT_I5900",
|
|
819
|
+
description: "Deployment results on success",
|
|
820
|
+
interface: "SuccessfulDeployStackResult"
|
|
821
|
+
}),
|
|
822
|
+
CDK_TOOLKIT_I5901: info({
|
|
823
|
+
code: "CDK_TOOLKIT_I5901",
|
|
824
|
+
description: "Generic deployment success messages"
|
|
825
|
+
}),
|
|
826
|
+
CDK_TOOLKIT_W5400: warn({
|
|
827
|
+
code: "CDK_TOOLKIT_W5400",
|
|
828
|
+
description: "Hotswap disclosure message"
|
|
829
|
+
}),
|
|
830
|
+
// errors
|
|
831
|
+
CDK_TOOLKIT_E5001: error({
|
|
832
|
+
code: "CDK_TOOLKIT_E5001",
|
|
833
|
+
description: "No stacks found"
|
|
834
|
+
}),
|
|
835
|
+
CDK_TOOLKIT_E5500: error({
|
|
836
|
+
code: "CDK_TOOLKIT_E5500",
|
|
837
|
+
description: "Stack Monitoring error",
|
|
838
|
+
interface: "ErrorPayload"
|
|
839
|
+
}),
|
|
840
|
+
// 6: Rollback
|
|
841
|
+
CDK_TOOLKIT_I6000: info({
|
|
842
|
+
code: "CDK_TOOLKIT_I6000",
|
|
843
|
+
description: "Provides rollback times",
|
|
844
|
+
interface: "Duration"
|
|
845
|
+
}),
|
|
846
|
+
CDK_TOOLKIT_I6100: info({
|
|
847
|
+
code: "CDK_TOOLKIT_I6100",
|
|
848
|
+
description: "Stack rollback progress",
|
|
849
|
+
interface: "StackRollbackProgress"
|
|
850
|
+
}),
|
|
851
|
+
CDK_TOOLKIT_E6001: error({
|
|
852
|
+
code: "CDK_TOOLKIT_E6001",
|
|
853
|
+
description: "No stacks found"
|
|
854
|
+
}),
|
|
855
|
+
CDK_TOOLKIT_E6900: error({
|
|
856
|
+
code: "CDK_TOOLKIT_E6900",
|
|
857
|
+
description: "Rollback failed",
|
|
858
|
+
interface: "ErrorPayload"
|
|
859
|
+
}),
|
|
860
|
+
// 7: Destroy
|
|
861
|
+
CDK_TOOLKIT_I7000: info({
|
|
862
|
+
code: "CDK_TOOLKIT_I7000",
|
|
863
|
+
description: "Provides destroy times",
|
|
864
|
+
interface: "Duration"
|
|
865
|
+
}),
|
|
866
|
+
CDK_TOOLKIT_I7001: trace({
|
|
867
|
+
code: "CDK_TOOLKIT_I7001",
|
|
868
|
+
description: "Provides destroy time for a single stack",
|
|
869
|
+
interface: "Duration"
|
|
870
|
+
}),
|
|
871
|
+
CDK_TOOLKIT_I7010: confirm({
|
|
872
|
+
code: "CDK_TOOLKIT_I7010",
|
|
873
|
+
description: "Confirm destroy stacks",
|
|
874
|
+
interface: "ConfirmationRequest"
|
|
875
|
+
}),
|
|
876
|
+
CDK_TOOLKIT_I7100: info({
|
|
877
|
+
code: "CDK_TOOLKIT_I7100",
|
|
878
|
+
description: "Stack destroy progress",
|
|
879
|
+
interface: "StackDestroyProgress"
|
|
880
|
+
}),
|
|
881
|
+
CDK_TOOLKIT_I7101: trace({
|
|
882
|
+
code: "CDK_TOOLKIT_I7101",
|
|
883
|
+
description: "Start stack destroying",
|
|
884
|
+
interface: "StackDestroy"
|
|
885
|
+
}),
|
|
886
|
+
CDK_TOOLKIT_I7900: result({
|
|
887
|
+
code: "CDK_TOOLKIT_I7900",
|
|
888
|
+
description: "Stack deletion succeeded",
|
|
889
|
+
interface: "cxapi.CloudFormationStackArtifact"
|
|
890
|
+
}),
|
|
891
|
+
CDK_TOOLKIT_E7010: error({
|
|
892
|
+
code: "CDK_TOOLKIT_E7010",
|
|
893
|
+
description: "Action was aborted due to negative confirmation of request"
|
|
894
|
+
}),
|
|
895
|
+
CDK_TOOLKIT_E7900: error({
|
|
896
|
+
code: "CDK_TOOLKIT_E7900",
|
|
897
|
+
description: "Stack deletion failed",
|
|
898
|
+
interface: "ErrorPayload"
|
|
899
|
+
}),
|
|
900
|
+
// 9: Bootstrap
|
|
901
|
+
CDK_TOOLKIT_I9000: info({
|
|
902
|
+
code: "CDK_TOOLKIT_I9000",
|
|
903
|
+
description: "Provides bootstrap times",
|
|
904
|
+
interface: "Duration"
|
|
905
|
+
}),
|
|
906
|
+
CDK_TOOLKIT_I9100: info({
|
|
907
|
+
code: "CDK_TOOLKIT_I9100",
|
|
908
|
+
description: "Bootstrap progress",
|
|
909
|
+
interface: "BootstrapEnvironmentProgress"
|
|
910
|
+
}),
|
|
911
|
+
CDK_TOOLKIT_I9900: result({
|
|
912
|
+
code: "CDK_TOOLKIT_I9900",
|
|
913
|
+
description: "Bootstrap results on success",
|
|
914
|
+
interface: "cxapi.Environment"
|
|
915
|
+
}),
|
|
916
|
+
CDK_TOOLKIT_E9900: error({
|
|
917
|
+
code: "CDK_TOOLKIT_E9900",
|
|
918
|
+
description: "Bootstrap failed",
|
|
919
|
+
interface: "ErrorPayload"
|
|
920
|
+
}),
|
|
921
|
+
// Assembly codes
|
|
922
|
+
CDK_ASSEMBLY_I0010: debug({
|
|
923
|
+
code: "CDK_ASSEMBLY_I0010",
|
|
924
|
+
description: "Generic environment preparation debug messages"
|
|
925
|
+
}),
|
|
926
|
+
CDK_ASSEMBLY_W0010: warn({
|
|
927
|
+
code: "CDK_ASSEMBLY_W0010",
|
|
928
|
+
description: "Emitted if the found framework version does not support context overflow"
|
|
929
|
+
}),
|
|
930
|
+
CDK_ASSEMBLY_I0042: debug({
|
|
931
|
+
code: "CDK_ASSEMBLY_I0042",
|
|
932
|
+
description: "Writing updated context",
|
|
933
|
+
interface: "UpdatedContext"
|
|
934
|
+
}),
|
|
935
|
+
CDK_ASSEMBLY_I0240: debug({
|
|
936
|
+
code: "CDK_ASSEMBLY_I0240",
|
|
937
|
+
description: "Context lookup was stopped as no further progress was made. ",
|
|
938
|
+
interface: "MissingContext"
|
|
939
|
+
}),
|
|
940
|
+
CDK_ASSEMBLY_I0241: debug({
|
|
941
|
+
code: "CDK_ASSEMBLY_I0241",
|
|
942
|
+
description: "Fetching missing context. This is an iterative message that may appear multiple times with different missing keys.",
|
|
943
|
+
interface: "MissingContext"
|
|
944
|
+
}),
|
|
945
|
+
CDK_ASSEMBLY_I1000: debug({
|
|
946
|
+
code: "CDK_ASSEMBLY_I1000",
|
|
947
|
+
description: "Cloud assembly output starts"
|
|
948
|
+
}),
|
|
949
|
+
CDK_ASSEMBLY_I1001: info({
|
|
950
|
+
code: "CDK_ASSEMBLY_I1001",
|
|
951
|
+
description: "Output lines emitted by the cloud assembly to stdout"
|
|
952
|
+
}),
|
|
953
|
+
CDK_ASSEMBLY_E1002: error({
|
|
954
|
+
code: "CDK_ASSEMBLY_E1002",
|
|
955
|
+
description: "Output lines emitted by the cloud assembly to stderr"
|
|
956
|
+
}),
|
|
957
|
+
CDK_ASSEMBLY_I1003: info({
|
|
958
|
+
code: "CDK_ASSEMBLY_I1003",
|
|
959
|
+
description: "Cloud assembly output finished"
|
|
960
|
+
}),
|
|
961
|
+
CDK_ASSEMBLY_E1111: error({
|
|
962
|
+
code: "CDK_ASSEMBLY_E1111",
|
|
963
|
+
description: "Incompatible CDK CLI version. Upgrade needed.",
|
|
964
|
+
interface: "ErrorPayload"
|
|
965
|
+
}),
|
|
966
|
+
CDK_ASSEMBLY_I0150: debug({
|
|
967
|
+
code: "CDK_ASSEMBLY_I0150",
|
|
968
|
+
description: "Indicates the use of a pre-synthesized cloud assembly directory"
|
|
969
|
+
}),
|
|
970
|
+
// Assembly Annotations
|
|
971
|
+
CDK_ASSEMBLY_I9999: info({
|
|
972
|
+
code: "CDK_ASSEMBLY_I9999",
|
|
973
|
+
description: "Annotations emitted by the cloud assembly",
|
|
974
|
+
interface: "cxapi.SynthesisMessage"
|
|
975
|
+
}),
|
|
976
|
+
CDK_ASSEMBLY_W9999: warn({
|
|
977
|
+
code: "CDK_ASSEMBLY_W9999",
|
|
978
|
+
description: "Warnings emitted by the cloud assembly",
|
|
979
|
+
interface: "cxapi.SynthesisMessage"
|
|
980
|
+
}),
|
|
981
|
+
CDK_ASSEMBLY_E9999: error({
|
|
982
|
+
code: "CDK_ASSEMBLY_E9999",
|
|
983
|
+
description: "Errors emitted by the cloud assembly",
|
|
984
|
+
interface: "cxapi.SynthesisMessage"
|
|
985
|
+
}),
|
|
986
|
+
// SDK codes
|
|
987
|
+
CDK_SDK_I0000: trace({
|
|
988
|
+
code: "CDK_SDK_I0000",
|
|
989
|
+
description: "An SDK message."
|
|
990
|
+
}),
|
|
991
|
+
CDK_SDK_I0100: trace({
|
|
992
|
+
code: "CDK_SDK_I0100",
|
|
993
|
+
description: "An SDK trace. SDK traces are emitted as traces to the IoHost, but contain the original SDK logging level.",
|
|
994
|
+
interface: "SdkTrace"
|
|
995
|
+
})
|
|
996
|
+
};
|
|
997
|
+
var SPAN = {
|
|
998
|
+
SYNTH_ASSEMBLY: {
|
|
999
|
+
name: "Synthesis",
|
|
1000
|
+
start: IO.CDK_TOOLKIT_I1001,
|
|
1001
|
+
end: IO.CDK_TOOLKIT_I1000
|
|
1002
|
+
},
|
|
1003
|
+
DEPLOY_STACK: {
|
|
1004
|
+
name: "Deployment",
|
|
1005
|
+
start: IO.CDK_TOOLKIT_I5100,
|
|
1006
|
+
end: IO.CDK_TOOLKIT_I5001
|
|
1007
|
+
},
|
|
1008
|
+
ROLLBACK_STACK: {
|
|
1009
|
+
name: "Rollback",
|
|
1010
|
+
start: IO.CDK_TOOLKIT_I6100,
|
|
1011
|
+
end: IO.CDK_TOOLKIT_I6000
|
|
1012
|
+
},
|
|
1013
|
+
DESTROY_STACK: {
|
|
1014
|
+
name: "Destroy",
|
|
1015
|
+
start: IO.CDK_TOOLKIT_I7100,
|
|
1016
|
+
end: IO.CDK_TOOLKIT_I7001
|
|
1017
|
+
},
|
|
1018
|
+
DESTROY_ACTION: {
|
|
1019
|
+
name: "Destroy",
|
|
1020
|
+
start: IO.CDK_TOOLKIT_I7101,
|
|
1021
|
+
end: IO.CDK_TOOLKIT_I7000
|
|
1022
|
+
},
|
|
1023
|
+
BOOTSTRAP_SINGLE: {
|
|
1024
|
+
name: "Bootstrap",
|
|
1025
|
+
start: IO.CDK_TOOLKIT_I9100,
|
|
1026
|
+
end: IO.CDK_TOOLKIT_I9000
|
|
1027
|
+
},
|
|
1028
|
+
BUILD_ASSET: {
|
|
1029
|
+
name: "Build Asset",
|
|
1030
|
+
start: IO.CDK_TOOLKIT_I5210,
|
|
1031
|
+
end: IO.CDK_TOOLKIT_I5211
|
|
1032
|
+
},
|
|
1033
|
+
PUBLISH_ASSET: {
|
|
1034
|
+
name: "Publish Asset",
|
|
1035
|
+
start: IO.CDK_TOOLKIT_I5220,
|
|
1036
|
+
end: IO.CDK_TOOLKIT_I5221
|
|
1037
|
+
}
|
|
1038
|
+
};
|
|
1039
|
+
|
|
557
1040
|
// ../../aws-cdk/lib/cli/activity-printer/base.ts
|
|
558
1041
|
var ActivityPrinterBase = class {
|
|
559
1042
|
constructor(props) {
|
|
@@ -581,14 +1064,14 @@ var ActivityPrinterBase = class {
|
|
|
581
1064
|
* Receive a stack activity message
|
|
582
1065
|
*/
|
|
583
1066
|
notify(msg) {
|
|
584
|
-
switch (
|
|
585
|
-
case
|
|
1067
|
+
switch (true) {
|
|
1068
|
+
case IO.CDK_TOOLKIT_I5501.is(msg):
|
|
586
1069
|
this.start(msg.data);
|
|
587
1070
|
break;
|
|
588
|
-
case
|
|
1071
|
+
case IO.CDK_TOOLKIT_I5502.is(msg):
|
|
589
1072
|
this.activity(msg.data);
|
|
590
1073
|
break;
|
|
591
|
-
case
|
|
1074
|
+
case IO.CDK_TOOLKIT_I5503.is(msg):
|
|
592
1075
|
this.stop();
|
|
593
1076
|
break;
|
|
594
1077
|
default:
|
|
@@ -884,9 +1367,9 @@ var CurrentActivityPrinter = class _CurrentActivityPrinter extends ActivityPrint
|
|
|
884
1367
|
this.failureReasonOnNextLine(failure)
|
|
885
1368
|
)
|
|
886
1369
|
);
|
|
887
|
-
const
|
|
888
|
-
if (
|
|
889
|
-
lines.push(chalk2.red(` ${
|
|
1370
|
+
const trace4 = failure.metadata?.entry?.trace;
|
|
1371
|
+
if (trace4) {
|
|
1372
|
+
lines.push(chalk2.red(` ${trace4.join("\n \\_ ")}
|
|
890
1373
|
`));
|
|
891
1374
|
}
|
|
892
1375
|
}
|
|
@@ -944,24 +1427,17 @@ function shorten(maxWidth, p) {
|
|
|
944
1427
|
}
|
|
945
1428
|
|
|
946
1429
|
// ../../aws-cdk/lib/toolkit/cli-io-host.ts
|
|
947
|
-
var levelPriority = {
|
|
948
|
-
error: 0,
|
|
949
|
-
result: 1,
|
|
950
|
-
warn: 2,
|
|
951
|
-
info: 3,
|
|
952
|
-
debug: 4,
|
|
953
|
-
trace: 5
|
|
954
|
-
};
|
|
955
1430
|
var CliIoHost = class _CliIoHost {
|
|
956
1431
|
constructor(props = {}) {
|
|
957
1432
|
this._progress = "bar" /* BAR */;
|
|
958
1433
|
// Corked Logging
|
|
959
1434
|
this.corkedCounter = 0;
|
|
960
1435
|
this.corkedLoggingBuffer = [];
|
|
961
|
-
this.
|
|
962
|
-
this.
|
|
963
|
-
this.
|
|
964
|
-
this.
|
|
1436
|
+
this.currentAction = props.currentAction ?? "none";
|
|
1437
|
+
this.isTTY = props.isTTY ?? process.stdout.isTTY ?? false;
|
|
1438
|
+
this.logLevel = props.logLevel ?? "info";
|
|
1439
|
+
this.isCI = props.isCI ?? isCI();
|
|
1440
|
+
this.requireDeployApproval = props.requireDeployApproval ?? import_cloud_assembly_schema.RequireApproval.BROADENING;
|
|
965
1441
|
this.stackProgress = props.stackProgress ?? "bar" /* BAR */;
|
|
966
1442
|
}
|
|
967
1443
|
/**
|
|
@@ -997,7 +1473,7 @@ var CliIoHost = class _CliIoHost {
|
|
|
997
1473
|
if (this._progress === "events" /* EVENTS */) {
|
|
998
1474
|
return this._progress;
|
|
999
1475
|
}
|
|
1000
|
-
const verboseLogging =
|
|
1476
|
+
const verboseLogging = isMessageRelevantForLevel({ level: "debug" }, this.logLevel);
|
|
1001
1477
|
if (verboseLogging) {
|
|
1002
1478
|
return "events" /* EVENTS */;
|
|
1003
1479
|
}
|
|
@@ -1011,60 +1487,6 @@ var CliIoHost = class _CliIoHost {
|
|
|
1011
1487
|
}
|
|
1012
1488
|
return this._progress;
|
|
1013
1489
|
}
|
|
1014
|
-
/**
|
|
1015
|
-
* The current action being performed by the CLI.
|
|
1016
|
-
*/
|
|
1017
|
-
get currentAction() {
|
|
1018
|
-
return this._currentAction;
|
|
1019
|
-
}
|
|
1020
|
-
/**
|
|
1021
|
-
* Sets the current action being performed by the CLI.
|
|
1022
|
-
*
|
|
1023
|
-
* @param action The action being performed by the CLI.
|
|
1024
|
-
*/
|
|
1025
|
-
set currentAction(action) {
|
|
1026
|
-
this._currentAction = action;
|
|
1027
|
-
}
|
|
1028
|
-
/**
|
|
1029
|
-
* Whether the host can use interactions and message styling.
|
|
1030
|
-
*/
|
|
1031
|
-
get isTTY() {
|
|
1032
|
-
return this._isTTY;
|
|
1033
|
-
}
|
|
1034
|
-
/**
|
|
1035
|
-
* Set TTY mode, i.e can the host use interactions and message styling.
|
|
1036
|
-
*
|
|
1037
|
-
* @param value set TTY mode
|
|
1038
|
-
*/
|
|
1039
|
-
set isTTY(value) {
|
|
1040
|
-
this._isTTY = value;
|
|
1041
|
-
}
|
|
1042
|
-
/**
|
|
1043
|
-
* Whether the CliIoHost is running in CI mode. In CI mode, all non-error output goes to stdout instead of stderr.
|
|
1044
|
-
*/
|
|
1045
|
-
get isCI() {
|
|
1046
|
-
return this._isCI;
|
|
1047
|
-
}
|
|
1048
|
-
/**
|
|
1049
|
-
* Set the CI mode. In CI mode, all non-error output goes to stdout instead of stderr.
|
|
1050
|
-
* @param value set the CI mode
|
|
1051
|
-
*/
|
|
1052
|
-
set isCI(value) {
|
|
1053
|
-
this._isCI = value;
|
|
1054
|
-
}
|
|
1055
|
-
/**
|
|
1056
|
-
* The current threshold. Messages with a lower priority level will be ignored.
|
|
1057
|
-
*/
|
|
1058
|
-
get logLevel() {
|
|
1059
|
-
return this._logLevel;
|
|
1060
|
-
}
|
|
1061
|
-
/**
|
|
1062
|
-
* Sets the current threshold. Messages with a lower priority level will be ignored.
|
|
1063
|
-
* @param level The new log level threshold
|
|
1064
|
-
*/
|
|
1065
|
-
set logLevel(level) {
|
|
1066
|
-
this._logLevel = level;
|
|
1067
|
-
}
|
|
1068
1490
|
/**
|
|
1069
1491
|
* Executes a block of code with corked logging. All log messages during execution
|
|
1070
1492
|
* are buffered and only written when all nested cork blocks complete (when CORK_COUNTER reaches 0).
|
|
@@ -1102,7 +1524,7 @@ var CliIoHost = class _CliIoHost {
|
|
|
1102
1524
|
await this.activityPrinter.notify(msg);
|
|
1103
1525
|
return;
|
|
1104
1526
|
}
|
|
1105
|
-
if (
|
|
1527
|
+
if (!isMessageRelevantForLevel(msg, this.logLevel)) {
|
|
1106
1528
|
return;
|
|
1107
1529
|
}
|
|
1108
1530
|
if (this.corkedCounter > 0) {
|
|
@@ -1123,6 +1545,27 @@ var CliIoHost = class _CliIoHost {
|
|
|
1123
1545
|
"CDK_TOOLKIT_I5503"
|
|
1124
1546
|
].includes(msg.code);
|
|
1125
1547
|
}
|
|
1548
|
+
/**
|
|
1549
|
+
* Detect special messages encode information about whether or not
|
|
1550
|
+
* they require approval
|
|
1551
|
+
*/
|
|
1552
|
+
skipApprovalStep(msg) {
|
|
1553
|
+
const approvalToolkitCodes = ["CDK_TOOLKIT_I5060"];
|
|
1554
|
+
if (!approvalToolkitCodes.includes(msg.code)) {
|
|
1555
|
+
false;
|
|
1556
|
+
}
|
|
1557
|
+
switch (this.requireDeployApproval) {
|
|
1558
|
+
// Never require approval
|
|
1559
|
+
case import_cloud_assembly_schema.RequireApproval.NEVER:
|
|
1560
|
+
return true;
|
|
1561
|
+
// Always require approval
|
|
1562
|
+
case import_cloud_assembly_schema.RequireApproval.ANYCHANGE:
|
|
1563
|
+
return false;
|
|
1564
|
+
// Require approval if changes include broadening permissions
|
|
1565
|
+
case import_cloud_assembly_schema.RequireApproval.BROADENING:
|
|
1566
|
+
return ["none", "non-broadening"].includes(msg.data?.permissionChangeType);
|
|
1567
|
+
}
|
|
1568
|
+
}
|
|
1126
1569
|
/**
|
|
1127
1570
|
* Determines the output stream, based on message level and configuration.
|
|
1128
1571
|
*/
|
|
@@ -1160,6 +1603,9 @@ var CliIoHost = class _CliIoHost {
|
|
|
1160
1603
|
if (concurrency > 1) {
|
|
1161
1604
|
throw new ToolkitError(`${motivation}, but concurrency is greater than 1 so we are unable to get a confirmation from the user`);
|
|
1162
1605
|
}
|
|
1606
|
+
if (this.skipApprovalStep(msg)) {
|
|
1607
|
+
return true;
|
|
1608
|
+
}
|
|
1163
1609
|
if (isConfirmationPrompt(msg)) {
|
|
1164
1610
|
const confirmed = await promptly.confirm(`${chalk3.cyan(msg.message)} (y/n)`);
|
|
1165
1611
|
if (!confirmed) {
|
|
@@ -1179,7 +1625,7 @@ var CliIoHost = class _CliIoHost {
|
|
|
1179
1625
|
* Formats a message for console output with optional color support
|
|
1180
1626
|
*/
|
|
1181
1627
|
formatMessage(msg) {
|
|
1182
|
-
let message_text = this.
|
|
1628
|
+
let message_text = this.isTTY ? styleMap[msg.level](msg.message) : msg.message;
|
|
1183
1629
|
return (msg.level === "debug" || msg.level === "trace" ? `[${this.formatTime(msg.time)}] ${message_text}` : message_text) + "\n";
|
|
1184
1630
|
}
|
|
1185
1631
|
/**
|
|
@@ -1231,8 +1677,8 @@ function isCI() {
|
|
|
1231
1677
|
|
|
1232
1678
|
// ../../aws-cdk/lib/logging.ts
|
|
1233
1679
|
function formatMessageAndLog(level, input, style, ...args) {
|
|
1234
|
-
const { message, code = getDefaultCode(level) } = typeof input === "object" ? input : { message: input };
|
|
1235
|
-
const formattedMessage = args.length > 0 ? util4.format(
|
|
1680
|
+
const { message: message2, code = getDefaultCode(level) } = typeof input === "object" ? input : { message: input };
|
|
1681
|
+
const formattedMessage = args.length > 0 ? util4.format(message2, ...args) : message2;
|
|
1236
1682
|
const finalMessage = style ? style(formattedMessage) : formattedMessage;
|
|
1237
1683
|
const ioHost = CliIoHost.instance();
|
|
1238
1684
|
const ioMessage = {
|
|
@@ -1240,7 +1686,8 @@ function formatMessageAndLog(level, input, style, ...args) {
|
|
|
1240
1686
|
action: ioHost.currentAction,
|
|
1241
1687
|
level,
|
|
1242
1688
|
message: finalMessage,
|
|
1243
|
-
code
|
|
1689
|
+
code,
|
|
1690
|
+
data: void 0
|
|
1244
1691
|
};
|
|
1245
1692
|
void ioHost.notify(ioMessage);
|
|
1246
1693
|
}
|
|
@@ -1248,19 +1695,19 @@ function getDefaultCode(level, category = "TOOLKIT") {
|
|
|
1248
1695
|
const levelIndicator = level === "error" ? "E" : level === "warn" ? "W" : "I";
|
|
1249
1696
|
return `CDK_${category}_${levelIndicator}0000`;
|
|
1250
1697
|
}
|
|
1251
|
-
var
|
|
1698
|
+
var error2 = (input, ...args) => {
|
|
1252
1699
|
return formatMessageAndLog("error", input, void 0, ...args);
|
|
1253
1700
|
};
|
|
1254
1701
|
var warning = (input, ...args) => {
|
|
1255
1702
|
return formatMessageAndLog("warn", input, void 0, ...args);
|
|
1256
1703
|
};
|
|
1257
|
-
var
|
|
1704
|
+
var info2 = (input, ...args) => {
|
|
1258
1705
|
return formatMessageAndLog("info", input, void 0, ...args);
|
|
1259
1706
|
};
|
|
1260
|
-
var
|
|
1707
|
+
var debug2 = (input, ...args) => {
|
|
1261
1708
|
return formatMessageAndLog("debug", input, void 0, ...args);
|
|
1262
1709
|
};
|
|
1263
|
-
var
|
|
1710
|
+
var trace2 = (input, ...args) => {
|
|
1264
1711
|
return formatMessageAndLog("trace", input, void 0, ...args);
|
|
1265
1712
|
};
|
|
1266
1713
|
|
|
@@ -1292,7 +1739,7 @@ var AccountAccessKeyCache = class _AccountAccessKeyCache {
|
|
|
1292
1739
|
async fetch(accessKeyId, resolver) {
|
|
1293
1740
|
const cached2 = await this.get(accessKeyId);
|
|
1294
1741
|
if (cached2) {
|
|
1295
|
-
|
|
1742
|
+
debug2(`Retrieved account ID ${cached2.accountId} from disk cache`);
|
|
1296
1743
|
return cached2;
|
|
1297
1744
|
}
|
|
1298
1745
|
const account = await resolver();
|
|
@@ -1408,7 +1855,7 @@ function readIfPossible(filename) {
|
|
|
1408
1855
|
}
|
|
1409
1856
|
return fs4.readFileSync(filename, { encoding: "utf-8" });
|
|
1410
1857
|
} catch (e) {
|
|
1411
|
-
|
|
1858
|
+
debug2(e);
|
|
1412
1859
|
return void 0;
|
|
1413
1860
|
}
|
|
1414
1861
|
}
|
|
@@ -1721,19 +2168,19 @@ var SDK = class {
|
|
|
1721
2168
|
return cachedAsync(this, CURRENT_ACCOUNT_KEY, async () => {
|
|
1722
2169
|
const creds = await this.credProvider();
|
|
1723
2170
|
return SDK.accountCache.fetch(creds.accessKeyId, async () => {
|
|
1724
|
-
|
|
2171
|
+
debug2("Looking up default account ID from STS");
|
|
1725
2172
|
const client = new import_client_sts.STSClient({
|
|
1726
2173
|
...this.config,
|
|
1727
2174
|
retryStrategy: this.stsRetryStrategy
|
|
1728
2175
|
});
|
|
1729
2176
|
const command = new import_client_sts.GetCallerIdentityCommand({});
|
|
1730
|
-
const
|
|
1731
|
-
const accountId =
|
|
1732
|
-
const partition =
|
|
2177
|
+
const result2 = await client.send(command);
|
|
2178
|
+
const accountId = result2.Account;
|
|
2179
|
+
const partition = result2.Arn.split(":")[1];
|
|
1733
2180
|
if (!accountId) {
|
|
1734
2181
|
throw new AuthenticationError("STS didn't return an account ID");
|
|
1735
2182
|
}
|
|
1736
|
-
|
|
2183
|
+
debug2("Default account ID:", accountId);
|
|
1737
2184
|
this._credentialsValidated = true;
|
|
1738
2185
|
return { accountId, partition };
|
|
1739
2186
|
});
|
|
@@ -1858,7 +2305,7 @@ var AwsCliCompatible = class _AwsCliCompatible {
|
|
|
1858
2305
|
const region = process.env.AWS_REGION || process.env.AMAZON_REGION || process.env.AWS_DEFAULT_REGION || process.env.AMAZON_DEFAULT_REGION || await getRegionFromIni(profile) || await regionFromMetadataService();
|
|
1859
2306
|
if (!region) {
|
|
1860
2307
|
const usedProfile = !profile ? "" : ` (profile: "${profile}")`;
|
|
1861
|
-
|
|
2308
|
+
debug2(
|
|
1862
2309
|
`Unable to determine AWS region from environment or AWS configuration${usedProfile}, defaulting to '${defaultRegion}'`
|
|
1863
2310
|
);
|
|
1864
2311
|
return defaultRegion;
|
|
@@ -1876,7 +2323,7 @@ function getRegionFromIniFile(profile, data) {
|
|
|
1876
2323
|
function tryGetCACert(bundlePath) {
|
|
1877
2324
|
const path15 = bundlePath || caBundlePathFromEnvironment();
|
|
1878
2325
|
if (path15) {
|
|
1879
|
-
|
|
2326
|
+
debug2("Using CA bundle path: %s", path15);
|
|
1880
2327
|
return readIfPossible(path15);
|
|
1881
2328
|
}
|
|
1882
2329
|
return void 0;
|
|
@@ -1905,7 +2352,7 @@ function shouldPrioritizeEnv() {
|
|
|
1905
2352
|
return false;
|
|
1906
2353
|
}
|
|
1907
2354
|
async function regionFromMetadataService() {
|
|
1908
|
-
|
|
2355
|
+
debug2("Looking up AWS region in the EC2 Instance Metadata Service (IMDS).");
|
|
1909
2356
|
try {
|
|
1910
2357
|
const metadataService = new import_ec2_metadata_service.MetadataService({
|
|
1911
2358
|
httpOptions: {
|
|
@@ -1916,20 +2363,20 @@ async function regionFromMetadataService() {
|
|
|
1916
2363
|
const document = await metadataService.request("/latest/dynamic/instance-identity/document", {});
|
|
1917
2364
|
return JSON.parse(document).region;
|
|
1918
2365
|
} catch (e) {
|
|
1919
|
-
|
|
2366
|
+
debug2(`Unable to retrieve AWS region from IMDS: ${e}`);
|
|
1920
2367
|
}
|
|
1921
2368
|
}
|
|
1922
2369
|
async function tokenCodeFn(serialArn) {
|
|
1923
|
-
|
|
2370
|
+
debug2("Require MFA token for serial ARN", serialArn);
|
|
1924
2371
|
try {
|
|
1925
2372
|
const token = await promptly2.prompt(`MFA token for ${serialArn}: `, {
|
|
1926
2373
|
trim: true,
|
|
1927
2374
|
default: ""
|
|
1928
2375
|
});
|
|
1929
|
-
|
|
2376
|
+
debug2("Successfully got MFA token from user");
|
|
1930
2377
|
return token;
|
|
1931
2378
|
} catch (err) {
|
|
1932
|
-
|
|
2379
|
+
debug2("Failed to get MFA token", err);
|
|
1933
2380
|
const e = new AuthenticationError(`Error fetching MFA token: ${err.message ?? err}`);
|
|
1934
2381
|
e.name = "SharedIniFileCredentialsProviderFailure";
|
|
1935
2382
|
throw e;
|
|
@@ -1937,10 +2384,10 @@ async function tokenCodeFn(serialArn) {
|
|
|
1937
2384
|
}
|
|
1938
2385
|
|
|
1939
2386
|
// ../../aws-cdk/lib/api/aws-auth/credential-plugins.ts
|
|
1940
|
-
var
|
|
2387
|
+
var import_util11 = require("util");
|
|
1941
2388
|
|
|
1942
2389
|
// ../../aws-cdk/lib/api/plugin/plugin.ts
|
|
1943
|
-
var
|
|
2390
|
+
var import_util10 = require("util");
|
|
1944
2391
|
var chalk5 = __toESM(require("chalk"));
|
|
1945
2392
|
|
|
1946
2393
|
// ../../aws-cdk/lib/api/plugin/context-provider-plugin.ts
|
|
@@ -1974,14 +2421,14 @@ var PluginHost = class _PluginHost {
|
|
|
1974
2421
|
try {
|
|
1975
2422
|
const plugin = require(moduleSpec);
|
|
1976
2423
|
if (!isPlugin(plugin)) {
|
|
1977
|
-
|
|
2424
|
+
error2(`Module ${chalk5.green(moduleSpec)} is not a valid plug-in, or has an unsupported version.`);
|
|
1978
2425
|
throw new ToolkitError(`Module ${moduleSpec} does not define a valid plug-in.`);
|
|
1979
2426
|
}
|
|
1980
2427
|
if (plugin.init) {
|
|
1981
2428
|
plugin.init(this);
|
|
1982
2429
|
}
|
|
1983
2430
|
} catch (e) {
|
|
1984
|
-
|
|
2431
|
+
error2(`Unable to load ${chalk5.green(moduleSpec)}: ${e.stack}`);
|
|
1985
2432
|
throw new ToolkitError(`Unable to load plug-in: ${moduleSpec}: ${e}`);
|
|
1986
2433
|
}
|
|
1987
2434
|
function isPlugin(x) {
|
|
@@ -2030,7 +2477,7 @@ var PluginHost = class _PluginHost {
|
|
|
2030
2477
|
*/
|
|
2031
2478
|
registerContextProviderAlpha(pluginProviderName, provider) {
|
|
2032
2479
|
if (!isContextProviderPlugin(provider)) {
|
|
2033
|
-
throw new ToolkitError(`Object you gave me does not look like a ContextProviderPlugin: ${(0,
|
|
2480
|
+
throw new ToolkitError(`Object you gave me does not look like a ContextProviderPlugin: ${(0, import_util10.inspect)(provider)}`);
|
|
2034
2481
|
}
|
|
2035
2482
|
this.contextProviderPlugins[pluginProviderName] = provider;
|
|
2036
2483
|
}
|
|
@@ -2063,7 +2510,7 @@ var CredentialPlugins = class {
|
|
|
2063
2510
|
available = false;
|
|
2064
2511
|
}
|
|
2065
2512
|
if (!available) {
|
|
2066
|
-
|
|
2513
|
+
debug2("Credentials source %s is not available, ignoring it.", source.name);
|
|
2067
2514
|
continue;
|
|
2068
2515
|
}
|
|
2069
2516
|
triedSources.push(source);
|
|
@@ -2077,7 +2524,7 @@ var CredentialPlugins = class {
|
|
|
2077
2524
|
if (!canProvide) {
|
|
2078
2525
|
continue;
|
|
2079
2526
|
}
|
|
2080
|
-
|
|
2527
|
+
debug2(`Using ${source.name} credentials for account ${awsAccountId}`);
|
|
2081
2528
|
return {
|
|
2082
2529
|
credentials: await v3ProviderFromPlugin(() => source.getProvider(awsAccountId, mode, {
|
|
2083
2530
|
supportsV3Providers: true
|
|
@@ -2099,7 +2546,7 @@ async function v3ProviderFromPlugin(producer) {
|
|
|
2099
2546
|
} else if (isV2Credentials(initial)) {
|
|
2100
2547
|
return v3ProviderFromV2Credentials(initial);
|
|
2101
2548
|
} else {
|
|
2102
|
-
throw new AuthenticationError(`Plugin returned a value that doesn't resemble AWS credentials: ${(0,
|
|
2549
|
+
throw new AuthenticationError(`Plugin returned a value that doesn't resemble AWS credentials: ${(0, import_util11.inspect)(initial)}`);
|
|
2103
2550
|
}
|
|
2104
2551
|
}
|
|
2105
2552
|
function v3ProviderFromV2Credentials(x) {
|
|
@@ -2118,7 +2565,7 @@ function refreshFromPluginProvider(current, producer) {
|
|
|
2118
2565
|
if (credentialsAboutToExpire(current)) {
|
|
2119
2566
|
const newCreds = await producer();
|
|
2120
2567
|
if (!isV3Credentials(newCreds)) {
|
|
2121
|
-
throw new AuthenticationError(`Plugin initially returned static V3 credentials but now returned something else: ${(0,
|
|
2568
|
+
throw new AuthenticationError(`Plugin initially returned static V3 credentials but now returned something else: ${(0, import_util11.inspect)(newCreds)}`);
|
|
2122
2569
|
}
|
|
2123
2570
|
current = newCreds;
|
|
2124
2571
|
}
|
|
@@ -2195,8 +2642,8 @@ var SdkProvider = class {
|
|
|
2195
2642
|
throw err;
|
|
2196
2643
|
}
|
|
2197
2644
|
if (baseCreds.source === "correctDefault" || baseCreds.source === "plugin") {
|
|
2198
|
-
|
|
2199
|
-
const logger = quiet ?
|
|
2645
|
+
debug2(err.message);
|
|
2646
|
+
const logger = quiet ? debug2 : warning;
|
|
2200
2647
|
logger(
|
|
2201
2648
|
`${fmtObtainedCredentials(baseCreds)} could not be used to assume '${options.assumeRoleArn}', but are for the right account. Proceeding anyway.`
|
|
2202
2649
|
);
|
|
@@ -2269,7 +2716,7 @@ var SdkProvider = class {
|
|
|
2269
2716
|
);
|
|
2270
2717
|
return void 0;
|
|
2271
2718
|
}
|
|
2272
|
-
|
|
2719
|
+
debug2(`Unable to determine the default AWS account (${e.name}): ${formatErrorMessage(e)}`);
|
|
2273
2720
|
return void 0;
|
|
2274
2721
|
}
|
|
2275
2722
|
});
|
|
@@ -2316,7 +2763,7 @@ var SdkProvider = class {
|
|
|
2316
2763
|
* otherwise it will be the current credentials.
|
|
2317
2764
|
*/
|
|
2318
2765
|
async withAssumedRole(mainCredentials, roleArn, externalId, additionalOptions, region) {
|
|
2319
|
-
|
|
2766
|
+
debug2(`Assuming role '${roleArn}'.`);
|
|
2320
2767
|
region = region ?? this.defaultRegion;
|
|
2321
2768
|
const sourceDescription = fmtObtainedCredentials(mainCredentials);
|
|
2322
2769
|
try {
|
|
@@ -2343,7 +2790,7 @@ var SdkProvider = class {
|
|
|
2343
2790
|
if (err.name === "ExpiredToken") {
|
|
2344
2791
|
throw err;
|
|
2345
2792
|
}
|
|
2346
|
-
|
|
2793
|
+
debug2(`Assuming role failed: ${err.message}`);
|
|
2347
2794
|
throw new AuthenticationError(
|
|
2348
2795
|
[
|
|
2349
2796
|
"Could not assume role in target account",
|
|
@@ -2406,42 +2853,6 @@ async function initContextProviderSdk(aws, options) {
|
|
|
2406
2853
|
return (await aws.forEnvironment(import_cx_api.EnvironmentUtils.make(account, region), 0 /* ForReading */, creds)).sdk;
|
|
2407
2854
|
}
|
|
2408
2855
|
|
|
2409
|
-
// ../../aws-cdk/lib/api/aws-auth/sdk-logger.ts
|
|
2410
|
-
var import_util13 = require("util");
|
|
2411
|
-
function formatSdkLoggerContent(content) {
|
|
2412
|
-
if (content.length === 1) {
|
|
2413
|
-
const apiFmt = formatApiCall(content[0]);
|
|
2414
|
-
if (apiFmt) {
|
|
2415
|
-
return apiFmt;
|
|
2416
|
-
}
|
|
2417
|
-
}
|
|
2418
|
-
return content.map((x) => typeof x === "string" ? x : (0, import_util13.inspect)(x)).join("");
|
|
2419
|
-
}
|
|
2420
|
-
function formatApiCall(content) {
|
|
2421
|
-
if (!isSdkApiCallSuccess(content) && !isSdkApiCallError(content)) {
|
|
2422
|
-
return void 0;
|
|
2423
|
-
}
|
|
2424
|
-
const service = content.clientName.replace(/Client$/, "");
|
|
2425
|
-
const api = content.commandName.replace(/Command$/, "");
|
|
2426
|
-
const parts = [];
|
|
2427
|
-
if ((content.metadata?.attempts ?? 0) > 1) {
|
|
2428
|
-
parts.push(`[${content.metadata?.attempts} attempts, ${content.metadata?.totalRetryDelay}ms retry]`);
|
|
2429
|
-
}
|
|
2430
|
-
parts.push(`${service}.${api}(${JSON.stringify(content.input, replacerBufferWithInfo)})`);
|
|
2431
|
-
if (isSdkApiCallSuccess(content)) {
|
|
2432
|
-
parts.push("-> OK");
|
|
2433
|
-
} else {
|
|
2434
|
-
parts.push(`-> ${content.error}`);
|
|
2435
|
-
}
|
|
2436
|
-
return parts.join(" ");
|
|
2437
|
-
}
|
|
2438
|
-
function isSdkApiCallSuccess(x) {
|
|
2439
|
-
return x && typeof x === "object" && x.commandName && x.output;
|
|
2440
|
-
}
|
|
2441
|
-
function isSdkApiCallError(x) {
|
|
2442
|
-
return x && typeof x === "object" && x.commandName && x.error;
|
|
2443
|
-
}
|
|
2444
|
-
|
|
2445
2856
|
// ../../aws-cdk/lib/api/settings.ts
|
|
2446
2857
|
var os3 = __toESM(require("os"));
|
|
2447
2858
|
var fs_path = __toESM(require("path"));
|
|
@@ -2673,7 +3084,6 @@ function formatMessage(msg, category = "TOOLKIT") {
|
|
|
2673
3084
|
return {
|
|
2674
3085
|
time: /* @__PURE__ */ new Date(),
|
|
2675
3086
|
level: msg.level,
|
|
2676
|
-
action: msg.action,
|
|
2677
3087
|
code: msg.code ?? defaultMessageCode(msg.level, category),
|
|
2678
3088
|
message: msg.message,
|
|
2679
3089
|
data: msg.data
|
|
@@ -2683,56 +3093,51 @@ function defaultMessageCode(level, category = "TOOLKIT") {
|
|
|
2683
3093
|
const levelIndicator = level === "error" ? "E" : level === "warn" ? "W" : "I";
|
|
2684
3094
|
return `CDK_${category}_${levelIndicator}0000`;
|
|
2685
3095
|
}
|
|
2686
|
-
var
|
|
3096
|
+
var error3 = (message2, code, payload) => {
|
|
2687
3097
|
return formatMessage({
|
|
2688
3098
|
level: "error",
|
|
2689
|
-
action,
|
|
2690
3099
|
code,
|
|
2691
|
-
message,
|
|
3100
|
+
message: message2,
|
|
2692
3101
|
data: payload
|
|
2693
3102
|
});
|
|
2694
3103
|
};
|
|
2695
|
-
var
|
|
3104
|
+
var warn2 = (message2, code, payload) => {
|
|
2696
3105
|
return formatMessage({
|
|
2697
3106
|
level: "warn",
|
|
2698
|
-
action,
|
|
2699
3107
|
code,
|
|
2700
|
-
message,
|
|
3108
|
+
message: message2,
|
|
2701
3109
|
data: payload
|
|
2702
3110
|
});
|
|
2703
3111
|
};
|
|
2704
|
-
var
|
|
3112
|
+
var info3 = (message2, code, payload) => {
|
|
2705
3113
|
return formatMessage({
|
|
2706
3114
|
level: "info",
|
|
2707
|
-
action,
|
|
2708
3115
|
code,
|
|
2709
|
-
message,
|
|
3116
|
+
message: message2,
|
|
2710
3117
|
data: payload
|
|
2711
3118
|
});
|
|
2712
3119
|
};
|
|
2713
|
-
var
|
|
3120
|
+
var debug3 = (message2, code, payload) => {
|
|
2714
3121
|
return formatMessage({
|
|
2715
3122
|
level: "debug",
|
|
2716
|
-
action,
|
|
2717
3123
|
code,
|
|
2718
|
-
message,
|
|
3124
|
+
message: message2,
|
|
2719
3125
|
data: payload
|
|
2720
3126
|
});
|
|
2721
3127
|
};
|
|
2722
|
-
var
|
|
3128
|
+
var trace3 = (message2, code, payload) => {
|
|
2723
3129
|
return formatMessage({
|
|
2724
3130
|
level: "trace",
|
|
2725
|
-
action,
|
|
2726
3131
|
code,
|
|
2727
|
-
message,
|
|
3132
|
+
message: message2,
|
|
2728
3133
|
data: payload
|
|
2729
3134
|
});
|
|
2730
3135
|
};
|
|
2731
3136
|
|
|
2732
3137
|
// ../../aws-cdk/lib/api/stack-events/stack-activity-monitor.ts
|
|
2733
3138
|
var util6 = __toESM(require("util"));
|
|
2734
|
-
var
|
|
2735
|
-
var
|
|
3139
|
+
var import_cloud_assembly_schema2 = require("@aws-cdk/cloud-assembly-schema");
|
|
3140
|
+
var uuid2 = __toESM(require("uuid"));
|
|
2736
3141
|
|
|
2737
3142
|
// ../../aws-cdk/lib/api/stack-events/stack-event-poller.ts
|
|
2738
3143
|
var StackEventPoller = class _StackEventPoller {
|
|
@@ -2932,8 +3337,7 @@ var StackProgressMonitor = class {
|
|
|
2932
3337
|
var StackActivityMonitor = class {
|
|
2933
3338
|
constructor({
|
|
2934
3339
|
cfn,
|
|
2935
|
-
|
|
2936
|
-
action,
|
|
3340
|
+
ioHelper,
|
|
2937
3341
|
stack,
|
|
2938
3342
|
stackName,
|
|
2939
3343
|
resourcesTotal,
|
|
@@ -2941,8 +3345,7 @@ var StackActivityMonitor = class {
|
|
|
2941
3345
|
pollingInterval = 2e3
|
|
2942
3346
|
}) {
|
|
2943
3347
|
this.errors = [];
|
|
2944
|
-
this.
|
|
2945
|
-
this.action = action;
|
|
3348
|
+
this.ioHelper = ioHelper;
|
|
2946
3349
|
this.stack = stack;
|
|
2947
3350
|
this.stackName = stackName;
|
|
2948
3351
|
this.progressMonitor = new StackProgressMonitor(resourcesTotal);
|
|
@@ -2953,8 +3356,8 @@ var StackActivityMonitor = class {
|
|
|
2953
3356
|
});
|
|
2954
3357
|
}
|
|
2955
3358
|
async start() {
|
|
2956
|
-
this.monitorId =
|
|
2957
|
-
await this.
|
|
3359
|
+
this.monitorId = uuid2.v4();
|
|
3360
|
+
await this.ioHelper.notify(debug3(`Deploying ${this.stackName}`, "CDK_TOOLKIT_I5501", {
|
|
2958
3361
|
deployment: this.monitorId,
|
|
2959
3362
|
stack: this.stack,
|
|
2960
3363
|
stackName: this.stackName,
|
|
@@ -2970,7 +3373,7 @@ var StackActivityMonitor = class {
|
|
|
2970
3373
|
clearTimeout(this.tickTimer);
|
|
2971
3374
|
}
|
|
2972
3375
|
await this.finalPollToEnd(oldMonitorId);
|
|
2973
|
-
await this.
|
|
3376
|
+
await this.ioHelper.notify(debug3(`Completed ${this.stackName}`, "CDK_TOOLKIT_I5503", {
|
|
2974
3377
|
deployment: oldMonitorId,
|
|
2975
3378
|
stack: this.stack,
|
|
2976
3379
|
stackName: this.stackName,
|
|
@@ -2995,8 +3398,7 @@ var StackActivityMonitor = class {
|
|
|
2995
3398
|
return;
|
|
2996
3399
|
}
|
|
2997
3400
|
} catch (e) {
|
|
2998
|
-
await this.
|
|
2999
|
-
this.action,
|
|
3401
|
+
await this.ioHelper.notify(error3(
|
|
3000
3402
|
util6.format("Error occurred while monitoring stack: %s", e),
|
|
3001
3403
|
"CDK_TOOLKIT_E5500",
|
|
3002
3404
|
{ error: e }
|
|
@@ -3010,7 +3412,7 @@ var StackActivityMonitor = class {
|
|
|
3010
3412
|
return void 0;
|
|
3011
3413
|
}
|
|
3012
3414
|
for (const path15 of Object.keys(metadata)) {
|
|
3013
|
-
const entry = metadata[path15].filter((e) => e.type ===
|
|
3415
|
+
const entry = metadata[path15].filter((e) => e.type === import_cloud_assembly_schema2.ArtifactMetadataEntryType.LOGICAL_ID).find((e) => e.data === logicalId);
|
|
3014
3416
|
if (entry) {
|
|
3015
3417
|
return {
|
|
3016
3418
|
entry,
|
|
@@ -3038,7 +3440,7 @@ var StackActivityMonitor = class {
|
|
|
3038
3440
|
progress: this.progressMonitor.progress
|
|
3039
3441
|
};
|
|
3040
3442
|
this.checkForErrors(activity);
|
|
3041
|
-
await this.
|
|
3443
|
+
await this.ioHelper.notify(info3(this.formatActivity(activity, true), "CDK_TOOLKIT_I5502", activity));
|
|
3042
3444
|
}
|
|
3043
3445
|
}
|
|
3044
3446
|
/**
|
|
@@ -3173,7 +3575,7 @@ async function makeBodyParameter(stack, resolvedEnvironment, assetManifest, reso
|
|
|
3173
3575
|
}
|
|
3174
3576
|
const toolkitInfo = await resources.lookupToolkit();
|
|
3175
3577
|
if (!toolkitInfo.found) {
|
|
3176
|
-
|
|
3578
|
+
error2(
|
|
3177
3579
|
`The template for stack "${stack.displayName}" is ${Math.round(templateJson.length / 1024)}KiB. Templates larger than ${LARGE_TEMPLATE_SIZE_KB}KiB must be uploaded to S3.
|
|
3178
3580
|
Run the following command in order to setup an S3 bucket in this environment, and then re-deploy:
|
|
3179
3581
|
|
|
@@ -3202,7 +3604,7 @@ Run the following command in order to setup an S3 bucket in this environment, an
|
|
|
3202
3604
|
}
|
|
3203
3605
|
);
|
|
3204
3606
|
const templateURL = `${toolkitInfo.bucketUrl}/${key}`;
|
|
3205
|
-
|
|
3607
|
+
debug2("Storing template in S3 at:", templateURL);
|
|
3206
3608
|
return { TemplateURL: templateURL };
|
|
3207
3609
|
}
|
|
3208
3610
|
async function restUrlFromManifest(url, environment) {
|
|
@@ -3306,11 +3708,11 @@ var CloudFormationStack = class _CloudFormationStack {
|
|
|
3306
3708
|
if (!this.exists) {
|
|
3307
3709
|
return {};
|
|
3308
3710
|
}
|
|
3309
|
-
const
|
|
3711
|
+
const result2 = {};
|
|
3310
3712
|
(this.stack.Outputs || []).forEach((output) => {
|
|
3311
|
-
|
|
3713
|
+
result2[output.OutputKey] = output.OutputValue;
|
|
3312
3714
|
});
|
|
3313
|
-
return
|
|
3715
|
+
return result2;
|
|
3314
3716
|
}
|
|
3315
3717
|
/**
|
|
3316
3718
|
* The stack's status
|
|
@@ -3394,23 +3796,23 @@ async function describeChangeSet(cfn, stackName, changeSetName, { fetchAll }) {
|
|
|
3394
3796
|
}
|
|
3395
3797
|
async function waitFor(valueProvider, timeout = 5e3) {
|
|
3396
3798
|
while (true) {
|
|
3397
|
-
const
|
|
3398
|
-
if (
|
|
3799
|
+
const result2 = await valueProvider();
|
|
3800
|
+
if (result2 === null) {
|
|
3399
3801
|
return void 0;
|
|
3400
|
-
} else if (
|
|
3401
|
-
return
|
|
3802
|
+
} else if (result2 !== void 0) {
|
|
3803
|
+
return result2;
|
|
3402
3804
|
}
|
|
3403
3805
|
await new Promise((cb) => setTimeout(cb, timeout));
|
|
3404
3806
|
}
|
|
3405
3807
|
}
|
|
3406
|
-
async function waitForChangeSet(cfn,
|
|
3407
|
-
await
|
|
3808
|
+
async function waitForChangeSet(cfn, ioHelper, stackName, changeSetName, { fetchAll }) {
|
|
3809
|
+
await ioHelper.notify(debug3((0, import_util19.format)("Waiting for changeset %s on stack %s to finish creating...", changeSetName, stackName)));
|
|
3408
3810
|
const ret = await waitFor(async () => {
|
|
3409
3811
|
const description = await describeChangeSet(cfn, stackName, changeSetName, {
|
|
3410
3812
|
fetchAll
|
|
3411
3813
|
});
|
|
3412
3814
|
if (description.Status === "CREATE_PENDING" || description.Status === "CREATE_IN_PROGRESS") {
|
|
3413
|
-
await
|
|
3815
|
+
await ioHelper.notify(debug3((0, import_util19.format)("Changeset %s on stack %s is still creating", changeSetName, stackName)));
|
|
3414
3816
|
return void 0;
|
|
3415
3817
|
}
|
|
3416
3818
|
if (description.Status === import_client_cloudformation3.ChangeSetStatus.CREATE_COMPLETE || changeSetHasNoChanges(description)) {
|
|
@@ -3464,8 +3866,8 @@ function changeSetHasNoChanges(description) {
|
|
|
3464
3866
|
];
|
|
3465
3867
|
return description.Status === "FAILED" && noChangeErrorPrefixes.some((p) => (description.StatusReason ?? "").startsWith(p));
|
|
3466
3868
|
}
|
|
3467
|
-
async function waitForStackDelete(cfn,
|
|
3468
|
-
const stack = await stabilizeStack(cfn,
|
|
3869
|
+
async function waitForStackDelete(cfn, ioHelper, stackName) {
|
|
3870
|
+
const stack = await stabilizeStack(cfn, ioHelper, stackName);
|
|
3469
3871
|
if (!stack) {
|
|
3470
3872
|
return void 0;
|
|
3471
3873
|
}
|
|
@@ -3479,8 +3881,8 @@ async function waitForStackDelete(cfn, { ioHost, action }, stackName) {
|
|
|
3479
3881
|
}
|
|
3480
3882
|
return stack;
|
|
3481
3883
|
}
|
|
3482
|
-
async function waitForStackDeploy(cfn,
|
|
3483
|
-
const stack = await stabilizeStack(cfn,
|
|
3884
|
+
async function waitForStackDeploy(cfn, ioHelper, stackName) {
|
|
3885
|
+
const stack = await stabilizeStack(cfn, ioHelper, stackName);
|
|
3484
3886
|
if (!stack) {
|
|
3485
3887
|
return void 0;
|
|
3486
3888
|
}
|
|
@@ -3494,20 +3896,20 @@ async function waitForStackDeploy(cfn, { ioHost, action }, stackName) {
|
|
|
3494
3896
|
}
|
|
3495
3897
|
return stack;
|
|
3496
3898
|
}
|
|
3497
|
-
async function stabilizeStack(cfn,
|
|
3498
|
-
await
|
|
3899
|
+
async function stabilizeStack(cfn, ioHelper, stackName) {
|
|
3900
|
+
await ioHelper.notify(debug3((0, import_util19.format)("Waiting for stack %s to finish creating or updating...", stackName)));
|
|
3499
3901
|
return waitFor(async () => {
|
|
3500
3902
|
const stack = await CloudFormationStack.lookup(cfn, stackName);
|
|
3501
3903
|
if (!stack.exists) {
|
|
3502
|
-
await
|
|
3904
|
+
await ioHelper.notify(debug3((0, import_util19.format)("Stack %s does not exist", stackName)));
|
|
3503
3905
|
return null;
|
|
3504
3906
|
}
|
|
3505
3907
|
const status = stack.stackStatus;
|
|
3506
3908
|
if (status.isInProgress) {
|
|
3507
|
-
await
|
|
3909
|
+
await ioHelper.notify(debug3((0, import_util19.format)("Stack %s has an ongoing operation in progress and is not stable (%s)", stackName, status)));
|
|
3508
3910
|
return void 0;
|
|
3509
3911
|
} else if (status.isReviewInProgress) {
|
|
3510
|
-
await
|
|
3912
|
+
await ioHelper.notify(debug3((0, import_util19.format)("Stack %s is in REVIEW_IN_PROGRESS state. Considering this is a stable status (%s)", stackName, status)));
|
|
3511
3913
|
}
|
|
3512
3914
|
return stack;
|
|
3513
3915
|
});
|
|
@@ -3604,13 +4006,13 @@ var chalk12 = __toESM(require("chalk"));
|
|
|
3604
4006
|
// ../../aws-cdk/lib/api/deployments/asset-publishing.ts
|
|
3605
4007
|
var import_cx_api4 = require("@aws-cdk/cx-api");
|
|
3606
4008
|
var import_cdk_assets3 = require("cdk-assets");
|
|
3607
|
-
async function publishAssets(manifest, sdk, targetEnv, options,
|
|
4009
|
+
async function publishAssets(manifest, sdk, targetEnv, options, ioHelper) {
|
|
3608
4010
|
if (targetEnv.account === void 0 || targetEnv.account === import_cx_api4.UNKNOWN_ACCOUNT || targetEnv.region === void 0 || targetEnv.account === import_cx_api4.UNKNOWN_REGION) {
|
|
3609
4011
|
throw new ToolkitError(`Asset publishing requires resolved account and region, got ${JSON.stringify(targetEnv)}`);
|
|
3610
4012
|
}
|
|
3611
4013
|
const publisher = new import_cdk_assets3.AssetPublishing(manifest, {
|
|
3612
4014
|
aws: new PublishingAws(sdk, targetEnv),
|
|
3613
|
-
progressListener: new PublishingProgressListener(
|
|
4015
|
+
progressListener: new PublishingProgressListener(ioHelper),
|
|
3614
4016
|
throwOnError: false,
|
|
3615
4017
|
publishInParallel: options.parallel ?? true,
|
|
3616
4018
|
buildAssets: true,
|
|
@@ -3707,18 +4109,17 @@ var EVENT_TO_LEVEL = {
|
|
|
3707
4109
|
shell_close: false
|
|
3708
4110
|
};
|
|
3709
4111
|
var BasePublishProgressListener = class {
|
|
3710
|
-
constructor(
|
|
3711
|
-
this.
|
|
3712
|
-
this.action = action;
|
|
4112
|
+
constructor(ioHelper) {
|
|
4113
|
+
this.ioHelper = ioHelper;
|
|
3713
4114
|
}
|
|
3714
4115
|
onPublishEvent(type, event) {
|
|
3715
4116
|
const level = EVENT_TO_LEVEL[type];
|
|
3716
4117
|
if (level) {
|
|
3717
|
-
void this.
|
|
4118
|
+
void this.ioHelper.notify(
|
|
3718
4119
|
formatMessage({
|
|
3719
4120
|
level,
|
|
3720
|
-
|
|
3721
|
-
|
|
4121
|
+
message: this.getMessage(type, event),
|
|
4122
|
+
data: void 0
|
|
3722
4123
|
})
|
|
3723
4124
|
);
|
|
3724
4125
|
}
|
|
@@ -3731,7 +4132,7 @@ var PublishingProgressListener = class extends BasePublishProgressListener {
|
|
|
3731
4132
|
};
|
|
3732
4133
|
|
|
3733
4134
|
// ../../aws-cdk/lib/api/deployments/checks.ts
|
|
3734
|
-
async function determineAllowCrossAccountAssetPublishing(sdk,
|
|
4135
|
+
async function determineAllowCrossAccountAssetPublishing(sdk, ioHelper, customStackName) {
|
|
3735
4136
|
try {
|
|
3736
4137
|
const stackName = customStackName || "CDKToolkit";
|
|
3737
4138
|
const stackInfo = await getBootstrapStackInfo(sdk, stackName);
|
|
@@ -3743,8 +4144,8 @@ async function determineAllowCrossAccountAssetPublishing(sdk, { ioHost, action }
|
|
|
3743
4144
|
}
|
|
3744
4145
|
return false;
|
|
3745
4146
|
} catch (e) {
|
|
3746
|
-
await
|
|
3747
|
-
await
|
|
4147
|
+
await ioHelper.notify(debug3(`Error determining cross account asset publishing: ${e}`));
|
|
4148
|
+
await ioHelper.notify(debug3("Defaulting to allowing cross account asset publishing"));
|
|
3748
4149
|
return true;
|
|
3749
4150
|
}
|
|
3750
4151
|
}
|
|
@@ -3778,14 +4179,14 @@ async function getBootstrapStackInfo(sdk, stackName) {
|
|
|
3778
4179
|
// ../../aws-cdk/lib/api/deployments/deploy-stack.ts
|
|
3779
4180
|
var import_util25 = require("util");
|
|
3780
4181
|
var chalk9 = __toESM(require("chalk"));
|
|
3781
|
-
var
|
|
4182
|
+
var uuid3 = __toESM(require("uuid"));
|
|
3782
4183
|
|
|
3783
4184
|
// ../../aws-cdk/lib/api/deployments/assets.ts
|
|
3784
4185
|
var path5 = __toESM(require("path"));
|
|
3785
4186
|
var cxschema2 = __toESM(require("@aws-cdk/cloud-assembly-schema"));
|
|
3786
4187
|
var cxapi2 = __toESM(require("@aws-cdk/cx-api"));
|
|
3787
4188
|
var chalk7 = __toESM(require("chalk"));
|
|
3788
|
-
async function addMetadataAssetsToManifest(
|
|
4189
|
+
async function addMetadataAssetsToManifest(ioHelper, stack, assetManifest, envResources, reuse) {
|
|
3789
4190
|
reuse = reuse || [];
|
|
3790
4191
|
const assets = stack.assets;
|
|
3791
4192
|
if (assets.length === 0) {
|
|
@@ -3799,23 +4200,23 @@ async function addMetadataAssetsToManifest({ ioHost, action }, stack, assetManif
|
|
|
3799
4200
|
for (const asset of assets) {
|
|
3800
4201
|
const reuseAsset = reuse.indexOf(asset.id) > -1;
|
|
3801
4202
|
if (reuseAsset) {
|
|
3802
|
-
await
|
|
4203
|
+
await ioHelper.notify(debug3(`Reusing asset ${asset.id}: ${JSON.stringify(asset)}`));
|
|
3803
4204
|
continue;
|
|
3804
4205
|
}
|
|
3805
|
-
await
|
|
4206
|
+
await ioHelper.notify(debug3(`Preparing asset ${asset.id}: ${JSON.stringify(asset)}`));
|
|
3806
4207
|
if (!stack.assembly) {
|
|
3807
4208
|
throw new ToolkitError("Unexpected: stack assembly is required in order to find assets in assembly directory");
|
|
3808
4209
|
}
|
|
3809
|
-
Object.assign(params, await prepareAsset(
|
|
4210
|
+
Object.assign(params, await prepareAsset(ioHelper, asset, assetManifest, envResources, toolkitInfo));
|
|
3810
4211
|
}
|
|
3811
4212
|
return params;
|
|
3812
4213
|
}
|
|
3813
|
-
async function prepareAsset(
|
|
4214
|
+
async function prepareAsset(ioHelper, asset, assetManifest, envResources, toolkitInfo) {
|
|
3814
4215
|
switch (asset.packaging) {
|
|
3815
4216
|
case "zip":
|
|
3816
4217
|
case "file":
|
|
3817
4218
|
return prepareFileAsset(
|
|
3818
|
-
|
|
4219
|
+
ioHelper,
|
|
3819
4220
|
asset,
|
|
3820
4221
|
assetManifest,
|
|
3821
4222
|
toolkitInfo,
|
|
@@ -3827,13 +4228,13 @@ async function prepareAsset({ ioHost, action }, asset, assetManifest, envResourc
|
|
|
3827
4228
|
throw new ToolkitError(`Unsupported packaging type: ${asset.packaging}. You might need to upgrade your aws-cdk toolkit to support this asset type.`);
|
|
3828
4229
|
}
|
|
3829
4230
|
}
|
|
3830
|
-
async function prepareFileAsset(
|
|
4231
|
+
async function prepareFileAsset(ioHelper, asset, assetManifest, toolkitInfo, packaging) {
|
|
3831
4232
|
const extension = packaging === cxschema2.FileAssetPackaging.ZIP_DIRECTORY ? ".zip" : path5.extname(asset.path);
|
|
3832
4233
|
const baseName = `${asset.sourceHash}${extension}`;
|
|
3833
4234
|
const s3Prefix = asset.id === asset.sourceHash ? "assets/" : `assets/${asset.id}/`;
|
|
3834
4235
|
const key = `${s3Prefix}${baseName}`;
|
|
3835
4236
|
const s3url = `s3://${toolkitInfo.bucketName}/${key}`;
|
|
3836
|
-
await
|
|
4237
|
+
await ioHelper.notify(debug3(`Storing asset ${asset.path} at ${s3url}`));
|
|
3837
4238
|
assetManifest.addFileAsset(asset.sourceHash, {
|
|
3838
4239
|
path: asset.path,
|
|
3839
4240
|
packaging
|
|
@@ -4592,12 +4993,12 @@ async function fetchFileFromS3(s3Url, sdk) {
|
|
|
4592
4993
|
async function exponentialBackOffRetry(fn, numOfRetries, backOff, errorCodeToRetry) {
|
|
4593
4994
|
try {
|
|
4594
4995
|
await fn();
|
|
4595
|
-
} catch (
|
|
4596
|
-
if (
|
|
4996
|
+
} catch (error4) {
|
|
4997
|
+
if (error4 && error4.name === errorCodeToRetry && numOfRetries > 0) {
|
|
4597
4998
|
await sleep(backOff);
|
|
4598
4999
|
await exponentialBackOffRetry(fn, numOfRetries - 1, backOff * 2, errorCodeToRetry);
|
|
4599
5000
|
} else {
|
|
4600
|
-
throw
|
|
5001
|
+
throw error4;
|
|
4601
5002
|
}
|
|
4602
5003
|
}
|
|
4603
5004
|
}
|
|
@@ -5178,7 +5579,7 @@ var RESOURCE_DETECTORS = {
|
|
|
5178
5579
|
},
|
|
5179
5580
|
"AWS::CDK::Metadata": async () => []
|
|
5180
5581
|
};
|
|
5181
|
-
async function tryHotswapDeployment(sdkProvider,
|
|
5582
|
+
async function tryHotswapDeployment(sdkProvider, ioHelper, assetParams, cloudFormationStack, stackArtifact, hotswapMode, hotswapPropertyOverrides) {
|
|
5182
5583
|
const resolvedEnv = await sdkProvider.resolveEnvironment(stackArtifact.environment);
|
|
5183
5584
|
const sdk = (await sdkProvider.forEnvironment(resolvedEnv, 1 /* ForWriting */)).sdk;
|
|
5184
5585
|
const currentTemplate = await loadCurrentTemplateWithNestedStacks(stackArtifact, sdk);
|
|
@@ -5200,13 +5601,13 @@ async function tryHotswapDeployment(sdkProvider, { ioHost, action }, assetParams
|
|
|
5200
5601
|
currentTemplate.nestedStacks,
|
|
5201
5602
|
hotswapPropertyOverrides
|
|
5202
5603
|
);
|
|
5203
|
-
await logNonHotswappableChanges(
|
|
5604
|
+
await logNonHotswappableChanges(ioHelper, nonHotswappableChanges, hotswapMode);
|
|
5204
5605
|
if (hotswapMode === "fall-back" /* FALL_BACK */) {
|
|
5205
5606
|
if (nonHotswappableChanges.length > 0) {
|
|
5206
5607
|
return void 0;
|
|
5207
5608
|
}
|
|
5208
5609
|
}
|
|
5209
|
-
await applyAllHotswappableChanges(sdk,
|
|
5610
|
+
await applyAllHotswappableChanges(sdk, ioHelper, hotswappableChanges);
|
|
5210
5611
|
return {
|
|
5211
5612
|
type: "did-deploy-stack",
|
|
5212
5613
|
noOp: hotswappableChanges.length === 0,
|
|
@@ -5397,51 +5798,51 @@ function isCandidateForHotswapping(change, logicalId) {
|
|
|
5397
5798
|
propertyUpdates: change.propertyUpdates
|
|
5398
5799
|
};
|
|
5399
5800
|
}
|
|
5400
|
-
async function applyAllHotswappableChanges(sdk,
|
|
5801
|
+
async function applyAllHotswappableChanges(sdk, ioHelper, hotswappableChanges) {
|
|
5401
5802
|
if (hotswappableChanges.length > 0) {
|
|
5402
|
-
await
|
|
5803
|
+
await ioHelper.notify(info3(`
|
|
5403
5804
|
${ICON} hotswapping resources:`));
|
|
5404
5805
|
}
|
|
5405
5806
|
const limit = pLimit(10);
|
|
5406
5807
|
return Promise.all(hotswappableChanges.map((hotswapOperation) => limit(() => {
|
|
5407
|
-
return applyHotswappableChange(sdk,
|
|
5808
|
+
return applyHotswappableChange(sdk, ioHelper, hotswapOperation);
|
|
5408
5809
|
})));
|
|
5409
5810
|
}
|
|
5410
|
-
async function applyHotswappableChange(sdk,
|
|
5811
|
+
async function applyHotswappableChange(sdk, ioHelper, hotswapOperation) {
|
|
5411
5812
|
const customUserAgent = `cdk-hotswap/success-${hotswapOperation.service}`;
|
|
5412
5813
|
sdk.appendCustomUserAgent(customUserAgent);
|
|
5413
5814
|
for (const name of hotswapOperation.resourceNames) {
|
|
5414
|
-
await
|
|
5815
|
+
await ioHelper.notify(info3((0, import_util23.format)(` ${ICON} %s`, chalk8.bold(name))));
|
|
5415
5816
|
}
|
|
5416
5817
|
try {
|
|
5417
5818
|
await hotswapOperation.apply(sdk);
|
|
5418
5819
|
} catch (e) {
|
|
5419
5820
|
if (e.name === "TimeoutError" || e.name === "AbortError") {
|
|
5420
|
-
const
|
|
5421
|
-
const
|
|
5422
|
-
|
|
5423
|
-
throw
|
|
5821
|
+
const result2 = JSON.parse(formatErrorMessage(e));
|
|
5822
|
+
const error4 = new ToolkitError(formatWaiterErrorResult(result2));
|
|
5823
|
+
error4.name = e.name;
|
|
5824
|
+
throw error4;
|
|
5424
5825
|
}
|
|
5425
5826
|
throw e;
|
|
5426
5827
|
}
|
|
5427
5828
|
for (const name of hotswapOperation.resourceNames) {
|
|
5428
|
-
await
|
|
5829
|
+
await ioHelper.notify(info3((0, import_util23.format)(`${ICON} %s %s`, chalk8.bold(name), chalk8.green("hotswapped!"))));
|
|
5429
5830
|
}
|
|
5430
5831
|
sdk.removeCustomUserAgent(customUserAgent);
|
|
5431
5832
|
}
|
|
5432
|
-
function formatWaiterErrorResult(
|
|
5833
|
+
function formatWaiterErrorResult(result2) {
|
|
5433
5834
|
const main = [
|
|
5434
|
-
`Resource is not in the expected state due to waiter status: ${
|
|
5435
|
-
|
|
5835
|
+
`Resource is not in the expected state due to waiter status: ${result2.state}`,
|
|
5836
|
+
result2.reason ? `${result2.reason}.` : ""
|
|
5436
5837
|
].join(". ");
|
|
5437
|
-
if (
|
|
5438
|
-
const observedResponses = Object.entries(
|
|
5838
|
+
if (result2.observedResponses != null) {
|
|
5839
|
+
const observedResponses = Object.entries(result2.observedResponses).map(([msg, count]) => ` - ${msg} (${count})`).join("\n");
|
|
5439
5840
|
return `${main} Observed responses:
|
|
5440
5841
|
${observedResponses}`;
|
|
5441
5842
|
}
|
|
5442
5843
|
return main;
|
|
5443
5844
|
}
|
|
5444
|
-
async function logNonHotswappableChanges(
|
|
5845
|
+
async function logNonHotswappableChanges(ioHelper, nonHotswappableChanges, hotswapMode) {
|
|
5445
5846
|
if (nonHotswappableChanges.length === 0) {
|
|
5446
5847
|
return;
|
|
5447
5848
|
}
|
|
@@ -5476,11 +5877,11 @@ async function logNonHotswappableChanges({ ioHost, action }, nonHotswappableChan
|
|
|
5476
5877
|
}
|
|
5477
5878
|
}
|
|
5478
5879
|
messages.push("");
|
|
5479
|
-
await
|
|
5880
|
+
await ioHelper.notify(info3(messages.join("\n")));
|
|
5480
5881
|
}
|
|
5481
5882
|
|
|
5482
5883
|
// ../../aws-cdk/lib/api/deployments/deploy-stack.ts
|
|
5483
|
-
async function deployStack(options,
|
|
5884
|
+
async function deployStack(options, ioHelper) {
|
|
5484
5885
|
const stackArtifact = options.stack;
|
|
5485
5886
|
const stackEnv = options.resolvedEnvironment;
|
|
5486
5887
|
options.sdk.appendCustomUserAgent(options.extraUserAgent);
|
|
@@ -5488,12 +5889,11 @@ async function deployStack(options, { ioHost, action }) {
|
|
|
5488
5889
|
const deployName = options.deployName || stackArtifact.stackName;
|
|
5489
5890
|
let cloudFormationStack = await CloudFormationStack.lookup(cfn, deployName);
|
|
5490
5891
|
if (cloudFormationStack.stackStatus.isCreationFailure) {
|
|
5491
|
-
await
|
|
5492
|
-
action,
|
|
5892
|
+
await ioHelper.notify(debug3(
|
|
5493
5893
|
`Found existing stack ${deployName} that had previously failed creation. Deleting it before attempting to re-create it.`
|
|
5494
5894
|
));
|
|
5495
5895
|
await cfn.deleteStack({ StackName: deployName });
|
|
5496
|
-
const deletedStack = await waitForStackDelete(cfn,
|
|
5896
|
+
const deletedStack = await waitForStackDelete(cfn, ioHelper, deployName);
|
|
5497
5897
|
if (deletedStack && deletedStack.stackStatus.name !== "DELETE_COMPLETE") {
|
|
5498
5898
|
throw new ToolkitError(
|
|
5499
5899
|
`Failed deleting stack ${deployName} that had previously failed creation (current state: ${deletedStack.stackStatus})`
|
|
@@ -5503,7 +5903,7 @@ async function deployStack(options, { ioHost, action }) {
|
|
|
5503
5903
|
}
|
|
5504
5904
|
const legacyAssets = new AssetManifestBuilder();
|
|
5505
5905
|
const assetParams = await addMetadataAssetsToManifest(
|
|
5506
|
-
|
|
5906
|
+
ioHelper,
|
|
5507
5907
|
stackArtifact,
|
|
5508
5908
|
legacyAssets,
|
|
5509
5909
|
options.envResources,
|
|
@@ -5514,11 +5914,10 @@ async function deployStack(options, { ioHost, action }) {
|
|
|
5514
5914
|
const stackParams = options.usePreviousParameters ? templateParams.updateExisting(finalParameterValues, cloudFormationStack.parameters) : templateParams.supplyAll(finalParameterValues);
|
|
5515
5915
|
const hotswapMode = options.hotswap ?? "full-deployment" /* FULL_DEPLOYMENT */;
|
|
5516
5916
|
const hotswapPropertyOverrides = options.hotswapPropertyOverrides ?? new HotswapPropertyOverrides();
|
|
5517
|
-
if (await canSkipDeploy(options, cloudFormationStack, stackParams.hasChanges(cloudFormationStack.parameters),
|
|
5518
|
-
await
|
|
5917
|
+
if (await canSkipDeploy(options, cloudFormationStack, stackParams.hasChanges(cloudFormationStack.parameters), ioHelper)) {
|
|
5918
|
+
await ioHelper.notify(debug3(`${deployName}: skipping deployment (use --force to override)`));
|
|
5519
5919
|
if (hotswapMode !== "full-deployment" /* FULL_DEPLOYMENT */) {
|
|
5520
|
-
await
|
|
5521
|
-
action,
|
|
5920
|
+
await ioHelper.notify(info3(
|
|
5522
5921
|
(0, import_util25.format)(
|
|
5523
5922
|
`
|
|
5524
5923
|
${ICON} %s
|
|
@@ -5534,7 +5933,7 @@ async function deployStack(options, { ioHost, action }) {
|
|
|
5534
5933
|
stackArn: cloudFormationStack.stackId
|
|
5535
5934
|
};
|
|
5536
5935
|
} else {
|
|
5537
|
-
await
|
|
5936
|
+
await ioHelper.notify(debug3(`${deployName}: deploying...`));
|
|
5538
5937
|
}
|
|
5539
5938
|
const bodyParameter = await makeBodyParameter(
|
|
5540
5939
|
stackArtifact,
|
|
@@ -5547,17 +5946,17 @@ async function deployStack(options, { ioHost, action }) {
|
|
|
5547
5946
|
try {
|
|
5548
5947
|
bootstrapStackName = (await options.envResources.lookupToolkit()).stackName;
|
|
5549
5948
|
} catch (e) {
|
|
5550
|
-
await
|
|
5949
|
+
await ioHelper.notify(debug3(`Could not determine the bootstrap stack name: ${e}`));
|
|
5551
5950
|
}
|
|
5552
5951
|
await publishAssets(legacyAssets.toManifest(stackArtifact.assembly.directory), options.sdkProvider, stackEnv, {
|
|
5553
5952
|
parallel: options.assetParallelism,
|
|
5554
|
-
allowCrossAccount: await determineAllowCrossAccountAssetPublishing(options.sdk,
|
|
5555
|
-
},
|
|
5953
|
+
allowCrossAccount: await determineAllowCrossAccountAssetPublishing(options.sdk, ioHelper, bootstrapStackName)
|
|
5954
|
+
}, ioHelper);
|
|
5556
5955
|
if (hotswapMode !== "full-deployment" /* FULL_DEPLOYMENT */) {
|
|
5557
5956
|
try {
|
|
5558
5957
|
const hotswapDeploymentResult = await tryHotswapDeployment(
|
|
5559
5958
|
options.sdkProvider,
|
|
5560
|
-
|
|
5959
|
+
ioHelper,
|
|
5561
5960
|
stackParams.values,
|
|
5562
5961
|
cloudFormationStack,
|
|
5563
5962
|
stackArtifact,
|
|
@@ -5567,7 +5966,7 @@ async function deployStack(options, { ioHost, action }) {
|
|
|
5567
5966
|
if (hotswapDeploymentResult) {
|
|
5568
5967
|
return hotswapDeploymentResult;
|
|
5569
5968
|
}
|
|
5570
|
-
await
|
|
5969
|
+
await ioHelper.notify(info3((0, import_util25.format)(
|
|
5571
5970
|
"Could not perform a hotswap deployment, as the stack %s contains non-Asset changes",
|
|
5572
5971
|
stackArtifact.displayName
|
|
5573
5972
|
)));
|
|
@@ -5575,13 +5974,13 @@ async function deployStack(options, { ioHost, action }) {
|
|
|
5575
5974
|
if (!(e instanceof CfnEvaluationException)) {
|
|
5576
5975
|
throw e;
|
|
5577
5976
|
}
|
|
5578
|
-
await
|
|
5977
|
+
await ioHelper.notify(info3((0, import_util25.format)(
|
|
5579
5978
|
"Could not perform a hotswap deployment, because the CloudFormation template could not be resolved: %s",
|
|
5580
5979
|
formatErrorMessage(e)
|
|
5581
5980
|
)));
|
|
5582
5981
|
}
|
|
5583
5982
|
if (hotswapMode === "fall-back" /* FALL_BACK */) {
|
|
5584
|
-
await
|
|
5983
|
+
await ioHelper.notify(info3("Falling back to doing a full deployment"));
|
|
5585
5984
|
options.sdk.appendCustomUserAgent("cdk-hotswap/fallback");
|
|
5586
5985
|
} else {
|
|
5587
5986
|
return {
|
|
@@ -5598,25 +5997,23 @@ async function deployStack(options, { ioHost, action }) {
|
|
|
5598
5997
|
stackArtifact,
|
|
5599
5998
|
stackParams,
|
|
5600
5999
|
bodyParameter,
|
|
5601
|
-
|
|
5602
|
-
action
|
|
6000
|
+
ioHelper
|
|
5603
6001
|
);
|
|
5604
6002
|
return fullDeployment.performDeployment();
|
|
5605
6003
|
}
|
|
5606
6004
|
var FullCloudFormationDeployment = class {
|
|
5607
|
-
constructor(options, cloudFormationStack, stackArtifact, stackParams, bodyParameter,
|
|
6005
|
+
constructor(options, cloudFormationStack, stackArtifact, stackParams, bodyParameter, ioHelper) {
|
|
5608
6006
|
this.options = options;
|
|
5609
6007
|
this.cloudFormationStack = cloudFormationStack;
|
|
5610
6008
|
this.stackArtifact = stackArtifact;
|
|
5611
6009
|
this.stackParams = stackParams;
|
|
5612
6010
|
this.bodyParameter = bodyParameter;
|
|
5613
|
-
this.
|
|
5614
|
-
this.action = action;
|
|
6011
|
+
this.ioHelper = ioHelper;
|
|
5615
6012
|
this.cfn = options.sdk.cloudFormation();
|
|
5616
6013
|
this.stackName = options.deployName ?? stackArtifact.stackName;
|
|
5617
6014
|
this.update = cloudFormationStack.exists && cloudFormationStack.stackStatus.name !== "REVIEW_IN_PROGRESS";
|
|
5618
6015
|
this.verb = this.update ? "update" : "create";
|
|
5619
|
-
this.uuid =
|
|
6016
|
+
this.uuid = uuid3.v4();
|
|
5620
6017
|
}
|
|
5621
6018
|
async performDeployment() {
|
|
5622
6019
|
const deploymentMethod = this.options.deploymentMethod ?? {
|
|
@@ -5639,17 +6036,16 @@ var FullCloudFormationDeployment = class {
|
|
|
5639
6036
|
const changeSetDescription = await this.createChangeSet(changeSetName, execute, importExistingResources);
|
|
5640
6037
|
await this.updateTerminationProtection();
|
|
5641
6038
|
if (changeSetHasNoChanges(changeSetDescription)) {
|
|
5642
|
-
await this.
|
|
6039
|
+
await this.ioHelper.notify(debug3((0, import_util25.format)("No changes are to be performed on %s.", this.stackName)));
|
|
5643
6040
|
if (execute) {
|
|
5644
|
-
await this.
|
|
6041
|
+
await this.ioHelper.notify(debug3((0, import_util25.format)("Deleting empty change set %s", changeSetDescription.ChangeSetId)));
|
|
5645
6042
|
await this.cfn.deleteChangeSet({
|
|
5646
6043
|
StackName: this.stackName,
|
|
5647
6044
|
ChangeSetName: changeSetName
|
|
5648
6045
|
});
|
|
5649
6046
|
}
|
|
5650
6047
|
if (this.options.force) {
|
|
5651
|
-
await this.
|
|
5652
|
-
this.action,
|
|
6048
|
+
await this.ioHelper.notify(warn2(
|
|
5653
6049
|
[
|
|
5654
6050
|
"You used the --force flag, but CloudFormation reported that the deployment would not make any changes.",
|
|
5655
6051
|
"According to CloudFormation, all resources are already up-to-date with the state in your CDK app.",
|
|
@@ -5667,7 +6063,7 @@ var FullCloudFormationDeployment = class {
|
|
|
5667
6063
|
};
|
|
5668
6064
|
}
|
|
5669
6065
|
if (!execute) {
|
|
5670
|
-
await this.
|
|
6066
|
+
await this.ioHelper.notify(info3((0, import_util25.format)(
|
|
5671
6067
|
"Changeset %s created and waiting in review for manual execution (--no-execute)",
|
|
5672
6068
|
changeSetDescription.ChangeSetId
|
|
5673
6069
|
)));
|
|
@@ -5694,8 +6090,8 @@ var FullCloudFormationDeployment = class {
|
|
|
5694
6090
|
}
|
|
5695
6091
|
async createChangeSet(changeSetName, willExecute, importExistingResources) {
|
|
5696
6092
|
await this.cleanupOldChangeset(changeSetName);
|
|
5697
|
-
await this.
|
|
5698
|
-
await this.
|
|
6093
|
+
await this.ioHelper.notify(debug3(`Attempting to create ChangeSet with name ${changeSetName} to ${this.verb} stack ${this.stackName}`));
|
|
6094
|
+
await this.ioHelper.notify(info3((0, import_util25.format)("%s: creating CloudFormation changeset...", chalk9.bold(this.stackName))));
|
|
5699
6095
|
const changeSet = await this.cfn.createChangeSet({
|
|
5700
6096
|
StackName: this.stackName,
|
|
5701
6097
|
ChangeSetName: changeSetName,
|
|
@@ -5706,21 +6102,20 @@ var FullCloudFormationDeployment = class {
|
|
|
5706
6102
|
ImportExistingResources: importExistingResources,
|
|
5707
6103
|
...this.commonPrepareOptions()
|
|
5708
6104
|
});
|
|
5709
|
-
await this.
|
|
5710
|
-
return waitForChangeSet(this.cfn,
|
|
6105
|
+
await this.ioHelper.notify(debug3((0, import_util25.format)("Initiated creation of changeset: %s; waiting for it to finish creating...", changeSet.Id)));
|
|
6106
|
+
return waitForChangeSet(this.cfn, this.ioHelper, this.stackName, changeSetName, {
|
|
5711
6107
|
fetchAll: willExecute
|
|
5712
6108
|
});
|
|
5713
6109
|
}
|
|
5714
6110
|
async executeChangeSet(changeSet) {
|
|
5715
|
-
await this.
|
|
6111
|
+
await this.ioHelper.notify(debug3((0, import_util25.format)("Initiating execution of changeset %s on stack %s", changeSet.ChangeSetId, this.stackName)));
|
|
5716
6112
|
await this.cfn.executeChangeSet({
|
|
5717
6113
|
StackName: this.stackName,
|
|
5718
6114
|
ChangeSetName: changeSet.ChangeSetName,
|
|
5719
6115
|
ClientRequestToken: `exec${this.uuid}`,
|
|
5720
6116
|
...this.commonExecuteOptions()
|
|
5721
6117
|
});
|
|
5722
|
-
await this.
|
|
5723
|
-
this.action,
|
|
6118
|
+
await this.ioHelper.notify(debug3(
|
|
5724
6119
|
(0, import_util25.format)(
|
|
5725
6120
|
"Execution of changeset %s on stack %s has started; waiting for the update to complete...",
|
|
5726
6121
|
changeSet.ChangeSetId,
|
|
@@ -5732,7 +6127,7 @@ var FullCloudFormationDeployment = class {
|
|
|
5732
6127
|
}
|
|
5733
6128
|
async cleanupOldChangeset(changeSetName) {
|
|
5734
6129
|
if (this.cloudFormationStack.exists) {
|
|
5735
|
-
await this.
|
|
6130
|
+
await this.ioHelper.notify(debug3(`Removing existing change set with name ${changeSetName} if it exists`));
|
|
5736
6131
|
await this.cfn.deleteChangeSet({
|
|
5737
6132
|
StackName: this.stackName,
|
|
5738
6133
|
ChangeSetName: changeSetName
|
|
@@ -5742,8 +6137,7 @@ var FullCloudFormationDeployment = class {
|
|
|
5742
6137
|
async updateTerminationProtection() {
|
|
5743
6138
|
const terminationProtection = this.stackArtifact.terminationProtection ?? false;
|
|
5744
6139
|
if (!!this.cloudFormationStack.terminationProtection !== terminationProtection) {
|
|
5745
|
-
await this.
|
|
5746
|
-
this.action,
|
|
6140
|
+
await this.ioHelper.notify(debug3(
|
|
5747
6141
|
(0, import_util25.format)(
|
|
5748
6142
|
"Updating termination protection from %s to %s for stack %s",
|
|
5749
6143
|
this.cloudFormationStack.terminationProtection,
|
|
@@ -5755,11 +6149,11 @@ var FullCloudFormationDeployment = class {
|
|
|
5755
6149
|
StackName: this.stackName,
|
|
5756
6150
|
EnableTerminationProtection: terminationProtection
|
|
5757
6151
|
});
|
|
5758
|
-
await this.
|
|
6152
|
+
await this.ioHelper.notify(debug3((0, import_util25.format)("Termination protection updated to %s for stack %s", terminationProtection, this.stackName)));
|
|
5759
6153
|
}
|
|
5760
6154
|
}
|
|
5761
6155
|
async directDeployment() {
|
|
5762
|
-
await this.
|
|
6156
|
+
await this.ioHelper.notify(info3((0, import_util25.format)("%s: %s stack...", chalk9.bold(this.stackName), this.update ? "updating" : "creating")));
|
|
5763
6157
|
const startTime = /* @__PURE__ */ new Date();
|
|
5764
6158
|
if (this.update) {
|
|
5765
6159
|
await this.updateTerminationProtection();
|
|
@@ -5772,7 +6166,7 @@ var FullCloudFormationDeployment = class {
|
|
|
5772
6166
|
});
|
|
5773
6167
|
} catch (err) {
|
|
5774
6168
|
if (err.message === "No updates are to be performed.") {
|
|
5775
|
-
await this.
|
|
6169
|
+
await this.ioHelper.notify(debug3((0, import_util25.format)("No updates are to be performed for stack %s", this.stackName)));
|
|
5776
6170
|
return {
|
|
5777
6171
|
type: "did-deploy-stack",
|
|
5778
6172
|
noOp: true,
|
|
@@ -5801,14 +6195,13 @@ var FullCloudFormationDeployment = class {
|
|
|
5801
6195
|
stack: this.stackArtifact,
|
|
5802
6196
|
stackName: this.stackName,
|
|
5803
6197
|
resourcesTotal: expectedChanges,
|
|
5804
|
-
|
|
5805
|
-
action: this.action,
|
|
6198
|
+
ioHelper: this.ioHelper,
|
|
5806
6199
|
changeSetCreationTime: startTime
|
|
5807
6200
|
});
|
|
5808
6201
|
await monitor.start();
|
|
5809
6202
|
let finalState = this.cloudFormationStack;
|
|
5810
6203
|
try {
|
|
5811
|
-
const successStack = await waitForStackDeploy(this.cfn,
|
|
6204
|
+
const successStack = await waitForStackDeploy(this.cfn, this.ioHelper, this.stackName);
|
|
5812
6205
|
if (!successStack) {
|
|
5813
6206
|
throw new ToolkitError("Stack deploy failed (the stack disappeared while we were deploying it)");
|
|
5814
6207
|
}
|
|
@@ -5818,7 +6211,7 @@ var FullCloudFormationDeployment = class {
|
|
|
5818
6211
|
} finally {
|
|
5819
6212
|
await monitor.stop();
|
|
5820
6213
|
}
|
|
5821
|
-
|
|
6214
|
+
debug3((0, import_util25.format)("Stack %s has completed updating", this.stackName));
|
|
5822
6215
|
return {
|
|
5823
6216
|
type: "did-deploy-stack",
|
|
5824
6217
|
noOp: false,
|
|
@@ -5854,7 +6247,7 @@ var FullCloudFormationDeployment = class {
|
|
|
5854
6247
|
};
|
|
5855
6248
|
}
|
|
5856
6249
|
};
|
|
5857
|
-
async function destroyStack(options,
|
|
6250
|
+
async function destroyStack(options, ioHelper) {
|
|
5858
6251
|
const deployName = options.deployName || options.stack.stackName;
|
|
5859
6252
|
const cfn = options.sdk.cloudFormation();
|
|
5860
6253
|
const currentStack = await CloudFormationStack.lookup(cfn, deployName);
|
|
@@ -5865,13 +6258,12 @@ async function destroyStack(options, { ioHost, action }) {
|
|
|
5865
6258
|
cfn,
|
|
5866
6259
|
stack: options.stack,
|
|
5867
6260
|
stackName: deployName,
|
|
5868
|
-
|
|
5869
|
-
action
|
|
6261
|
+
ioHelper
|
|
5870
6262
|
});
|
|
5871
6263
|
await monitor.start();
|
|
5872
6264
|
try {
|
|
5873
6265
|
await cfn.deleteStack({ StackName: deployName, RoleARN: options.roleArn });
|
|
5874
|
-
const destroyedStack = await waitForStackDelete(cfn,
|
|
6266
|
+
const destroyedStack = await waitForStackDelete(cfn, ioHelper, deployName);
|
|
5875
6267
|
if (destroyedStack && destroyedStack.stackStatus.name !== "DELETE_COMPLETE") {
|
|
5876
6268
|
throw new ToolkitError(`Failed to destroy ${deployName}: ${destroyedStack.stackStatus}`);
|
|
5877
6269
|
}
|
|
@@ -5883,47 +6275,47 @@ async function destroyStack(options, { ioHost, action }) {
|
|
|
5883
6275
|
}
|
|
5884
6276
|
}
|
|
5885
6277
|
}
|
|
5886
|
-
async function canSkipDeploy(deployStackOptions, cloudFormationStack, parameterChanges,
|
|
6278
|
+
async function canSkipDeploy(deployStackOptions, cloudFormationStack, parameterChanges, ioHelper) {
|
|
5887
6279
|
const deployName = deployStackOptions.deployName || deployStackOptions.stack.stackName;
|
|
5888
|
-
await
|
|
6280
|
+
await ioHelper.notify(debug3(`${deployName}: checking if we can skip deploy`));
|
|
5889
6281
|
if (deployStackOptions.force) {
|
|
5890
|
-
await
|
|
6282
|
+
await ioHelper.notify(debug3(`${deployName}: forced deployment`));
|
|
5891
6283
|
return false;
|
|
5892
6284
|
}
|
|
5893
6285
|
if (deployStackOptions.deploymentMethod?.method === "change-set" && deployStackOptions.deploymentMethod.execute === false) {
|
|
5894
|
-
await
|
|
6286
|
+
await ioHelper.notify(debug3(`${deployName}: --no-execute, always creating change set`));
|
|
5895
6287
|
return false;
|
|
5896
6288
|
}
|
|
5897
6289
|
if (!cloudFormationStack.exists) {
|
|
5898
|
-
await
|
|
6290
|
+
await ioHelper.notify(debug3(`${deployName}: no existing stack`));
|
|
5899
6291
|
return false;
|
|
5900
6292
|
}
|
|
5901
6293
|
if (JSON.stringify(deployStackOptions.stack.template) !== JSON.stringify(await cloudFormationStack.template())) {
|
|
5902
|
-
await
|
|
6294
|
+
await ioHelper.notify(debug3(`${deployName}: template has changed`));
|
|
5903
6295
|
return false;
|
|
5904
6296
|
}
|
|
5905
6297
|
if (!compareTags(cloudFormationStack.tags, deployStackOptions.tags ?? [])) {
|
|
5906
|
-
await
|
|
6298
|
+
await ioHelper.notify(debug3(`${deployName}: tags have changed`));
|
|
5907
6299
|
return false;
|
|
5908
6300
|
}
|
|
5909
6301
|
if (!arrayEquals(cloudFormationStack.notificationArns, deployStackOptions.notificationArns ?? [])) {
|
|
5910
|
-
await
|
|
6302
|
+
await ioHelper.notify(debug3(`${deployName}: notification arns have changed`));
|
|
5911
6303
|
return false;
|
|
5912
6304
|
}
|
|
5913
6305
|
if (!!deployStackOptions.stack.terminationProtection !== !!cloudFormationStack.terminationProtection) {
|
|
5914
|
-
await
|
|
6306
|
+
await ioHelper.notify(debug3(`${deployName}: termination protection has been updated`));
|
|
5915
6307
|
return false;
|
|
5916
6308
|
}
|
|
5917
6309
|
if (parameterChanges) {
|
|
5918
6310
|
if (parameterChanges === "ssm") {
|
|
5919
|
-
await
|
|
6311
|
+
await ioHelper.notify(debug3(`${deployName}: some parameters come from SSM so we have to assume they may have changed`));
|
|
5920
6312
|
} else {
|
|
5921
|
-
await
|
|
6313
|
+
await ioHelper.notify(debug3(`${deployName}: parameters have changed`));
|
|
5922
6314
|
}
|
|
5923
6315
|
return false;
|
|
5924
6316
|
}
|
|
5925
6317
|
if (cloudFormationStack.stackStatus.isFailure) {
|
|
5926
|
-
await
|
|
6318
|
+
await ioHelper.notify(debug3(`${deployName}: stack is in a failure state`));
|
|
5927
6319
|
return false;
|
|
5928
6320
|
}
|
|
5929
6321
|
return true;
|
|
@@ -6015,7 +6407,7 @@ function loadTree(assembly) {
|
|
|
6015
6407
|
const fileName = assembly.tree()?.file;
|
|
6016
6408
|
return fileName ? fs10.readJSONSync(path9.join(outdir, fileName)).tree : {};
|
|
6017
6409
|
} catch (e) {
|
|
6018
|
-
|
|
6410
|
+
trace2(`Failed to get tree.json file: ${e}. Proceeding with empty tree.`);
|
|
6019
6411
|
return void 0;
|
|
6020
6412
|
}
|
|
6021
6413
|
}
|
|
@@ -6023,7 +6415,7 @@ function loadTreeFromDir(outdir) {
|
|
|
6023
6415
|
try {
|
|
6024
6416
|
return fs10.readJSONSync(path9.join(outdir, "tree.json")).tree;
|
|
6025
6417
|
} catch (e) {
|
|
6026
|
-
|
|
6418
|
+
trace2(`Failed to get tree.json file: ${e}. Proceeding with empty tree.`);
|
|
6027
6419
|
return void 0;
|
|
6028
6420
|
}
|
|
6029
6421
|
}
|
|
@@ -6212,7 +6604,7 @@ var Notices = class _Notices {
|
|
|
6212
6604
|
const notices = await dataSource.fetch();
|
|
6213
6605
|
this.data = new Set(this.includeAcknowlegded ? notices : notices.filter((n) => !this.acknowledgedIssueNumbers.has(n.issueNumber)));
|
|
6214
6606
|
} catch (e) {
|
|
6215
|
-
|
|
6607
|
+
debug2(`Could not refresh notices: ${e}`);
|
|
6216
6608
|
}
|
|
6217
6609
|
}
|
|
6218
6610
|
/**
|
|
@@ -6229,9 +6621,9 @@ var Notices = class _Notices {
|
|
|
6229
6621
|
bootstrappedEnvironments: Array.from(this.bootstrappedEnvironments.values())
|
|
6230
6622
|
});
|
|
6231
6623
|
if (filteredNotices.length > 0) {
|
|
6232
|
-
|
|
6233
|
-
|
|
6234
|
-
|
|
6624
|
+
info2("");
|
|
6625
|
+
info2("NOTICES (What's this? https://github.com/aws/aws-cdk/wiki/CLI-Notices)");
|
|
6626
|
+
info2("");
|
|
6235
6627
|
for (const filtered of filteredNotices) {
|
|
6236
6628
|
const formatted = filtered.format();
|
|
6237
6629
|
switch (filtered.notice.severity) {
|
|
@@ -6239,18 +6631,18 @@ var Notices = class _Notices {
|
|
|
6239
6631
|
warning(formatted);
|
|
6240
6632
|
break;
|
|
6241
6633
|
case "error":
|
|
6242
|
-
|
|
6634
|
+
error2(formatted);
|
|
6243
6635
|
break;
|
|
6244
6636
|
default:
|
|
6245
|
-
|
|
6637
|
+
info2(formatted);
|
|
6246
6638
|
}
|
|
6247
|
-
|
|
6639
|
+
info2("");
|
|
6248
6640
|
}
|
|
6249
|
-
|
|
6641
|
+
info2(`If you don\u2019t want to see a notice anymore, use "cdk acknowledge <id>". For example, "cdk acknowledge ${filteredNotices[0].notice.issueNumber}".`);
|
|
6250
6642
|
}
|
|
6251
6643
|
if (options.showTotal ?? false) {
|
|
6252
|
-
|
|
6253
|
-
|
|
6644
|
+
info2("");
|
|
6645
|
+
info2(`There are ${filteredNotices.length} unacknowledged notice(s).`);
|
|
6254
6646
|
}
|
|
6255
6647
|
}
|
|
6256
6648
|
};
|
|
@@ -6324,7 +6716,7 @@ var WebsiteNoticeDataSource = class {
|
|
|
6324
6716
|
if (!data) {
|
|
6325
6717
|
throw new ToolkitError("'notices' key is missing");
|
|
6326
6718
|
}
|
|
6327
|
-
|
|
6719
|
+
debug2("Notices refreshed");
|
|
6328
6720
|
resolve3(data ?? []);
|
|
6329
6721
|
} catch (e) {
|
|
6330
6722
|
reject(new ToolkitError(`Failed to parse notices: ${formatErrorMessage(e)}`));
|
|
@@ -6362,7 +6754,7 @@ var CachedDataSource = class {
|
|
|
6362
6754
|
await this.save(freshData);
|
|
6363
6755
|
return freshData.notices;
|
|
6364
6756
|
} else {
|
|
6365
|
-
|
|
6757
|
+
debug2(`Reading cached notices from ${this.fileName}`);
|
|
6366
6758
|
return data;
|
|
6367
6759
|
}
|
|
6368
6760
|
}
|
|
@@ -6373,7 +6765,7 @@ var CachedDataSource = class {
|
|
|
6373
6765
|
notices: await this.dataSource.fetch()
|
|
6374
6766
|
};
|
|
6375
6767
|
} catch (e) {
|
|
6376
|
-
|
|
6768
|
+
debug2(`Could not refresh notices: ${e}`);
|
|
6377
6769
|
return {
|
|
6378
6770
|
expiration: Date.now() + TIME_TO_LIVE_ERROR,
|
|
6379
6771
|
notices: []
|
|
@@ -6388,7 +6780,7 @@ var CachedDataSource = class {
|
|
|
6388
6780
|
try {
|
|
6389
6781
|
return fs11.existsSync(this.fileName) ? await fs11.readJSON(this.fileName) : defaultValue;
|
|
6390
6782
|
} catch (e) {
|
|
6391
|
-
|
|
6783
|
+
debug2(`Failed to load notices from cache: ${e}`);
|
|
6392
6784
|
return defaultValue;
|
|
6393
6785
|
}
|
|
6394
6786
|
}
|
|
@@ -6396,7 +6788,7 @@ var CachedDataSource = class {
|
|
|
6396
6788
|
try {
|
|
6397
6789
|
await fs11.writeJSON(this.fileName, cached2);
|
|
6398
6790
|
} catch (e) {
|
|
6399
|
-
|
|
6791
|
+
debug2(`Failed to store notices in the cache: ${e}`);
|
|
6400
6792
|
}
|
|
6401
6793
|
}
|
|
6402
6794
|
};
|
|
@@ -6420,14 +6812,13 @@ var ToolkitInfo = class _ToolkitInfo {
|
|
|
6420
6812
|
static determineName(overrideName) {
|
|
6421
6813
|
return overrideName ?? DEFAULT_TOOLKIT_STACK_NAME;
|
|
6422
6814
|
}
|
|
6423
|
-
static async lookup(environment, sdk,
|
|
6815
|
+
static async lookup(environment, sdk, ioHelper, stackName) {
|
|
6424
6816
|
const cfn = sdk.cloudFormation();
|
|
6425
6817
|
stackName = _ToolkitInfo.determineName(stackName);
|
|
6426
6818
|
try {
|
|
6427
|
-
const stack = await stabilizeStack(cfn,
|
|
6819
|
+
const stack = await stabilizeStack(cfn, ioHelper, stackName);
|
|
6428
6820
|
if (!stack) {
|
|
6429
|
-
await
|
|
6430
|
-
action,
|
|
6821
|
+
await ioHelper.notify(debug3(
|
|
6431
6822
|
(0, import_util30.format)(
|
|
6432
6823
|
"The environment %s doesn't have the CDK toolkit stack (%s) installed. Use %s to setup your environment for use with the toolkit.",
|
|
6433
6824
|
environment.name,
|
|
@@ -6438,8 +6829,7 @@ var ToolkitInfo = class _ToolkitInfo {
|
|
|
6438
6829
|
return _ToolkitInfo.bootstrapStackNotFoundInfo(stackName);
|
|
6439
6830
|
}
|
|
6440
6831
|
if (stack.stackStatus.isCreationFailure) {
|
|
6441
|
-
await
|
|
6442
|
-
action,
|
|
6832
|
+
await ioHelper.notify(debug3(
|
|
6443
6833
|
(0, import_util30.format)(
|
|
6444
6834
|
"The environment %s has a CDK toolkit stack (%s) that failed to create. Use %s to try provisioning it again.",
|
|
6445
6835
|
environment.name,
|
|
@@ -6551,21 +6941,21 @@ var EnvironmentResourcesRegistry = class {
|
|
|
6551
6941
|
this.toolkitStackName = toolkitStackName;
|
|
6552
6942
|
this.cache = /* @__PURE__ */ new Map();
|
|
6553
6943
|
}
|
|
6554
|
-
for(resolvedEnvironment, sdk,
|
|
6944
|
+
for(resolvedEnvironment, sdk, ioHelper) {
|
|
6555
6945
|
const key = `${resolvedEnvironment.account}:${resolvedEnvironment.region}`;
|
|
6556
6946
|
let envCache = this.cache.get(key);
|
|
6557
6947
|
if (!envCache) {
|
|
6558
6948
|
envCache = emptyCache();
|
|
6559
6949
|
this.cache.set(key, envCache);
|
|
6560
6950
|
}
|
|
6561
|
-
return new EnvironmentResources(resolvedEnvironment, sdk,
|
|
6951
|
+
return new EnvironmentResources(resolvedEnvironment, sdk, ioHelper, envCache, this.toolkitStackName);
|
|
6562
6952
|
}
|
|
6563
6953
|
};
|
|
6564
6954
|
var EnvironmentResources = class {
|
|
6565
|
-
constructor(environment, sdk,
|
|
6955
|
+
constructor(environment, sdk, ioHelper, cache, toolkitStackName) {
|
|
6566
6956
|
this.environment = environment;
|
|
6567
6957
|
this.sdk = sdk;
|
|
6568
|
-
this.
|
|
6958
|
+
this.ioHelper = ioHelper;
|
|
6569
6959
|
this.cache = cache;
|
|
6570
6960
|
this.toolkitStackName = toolkitStackName;
|
|
6571
6961
|
}
|
|
@@ -6574,7 +6964,7 @@ var EnvironmentResources = class {
|
|
|
6574
6964
|
*/
|
|
6575
6965
|
async lookupToolkit() {
|
|
6576
6966
|
if (!this.cache.toolkitInfo) {
|
|
6577
|
-
this.cache.toolkitInfo = await ToolkitInfo.lookup(this.environment, this.sdk, this.
|
|
6967
|
+
this.cache.toolkitInfo = await ToolkitInfo.lookup(this.environment, this.sdk, this.ioHelper, this.toolkitStackName);
|
|
6578
6968
|
}
|
|
6579
6969
|
return this.cache.toolkitInfo;
|
|
6580
6970
|
}
|
|
@@ -6602,8 +6992,7 @@ var EnvironmentResources = class {
|
|
|
6602
6992
|
}
|
|
6603
6993
|
const bootstrapStack2 = await this.lookupToolkit();
|
|
6604
6994
|
if (bootstrapStack2.found && bootstrapStack2.version < BOOTSTRAP_TEMPLATE_VERSION_INTRODUCING_GETPARAMETER) {
|
|
6605
|
-
await this.
|
|
6606
|
-
this.msg.action,
|
|
6995
|
+
await this.ioHelper.notify(warn2(
|
|
6607
6996
|
`Could not read SSM parameter ${ssmParameterName}: ${formatErrorMessage(e)}, falling back to version from ${bootstrapStack2}`
|
|
6608
6997
|
));
|
|
6609
6998
|
doValidate(bootstrapStack2.version, this.environment);
|
|
@@ -6638,10 +7027,10 @@ var EnvironmentResources = class {
|
|
|
6638
7027
|
}
|
|
6639
7028
|
const ssm = this.sdk.ssm();
|
|
6640
7029
|
try {
|
|
6641
|
-
const
|
|
6642
|
-
const asNumber = parseInt(`${
|
|
7030
|
+
const result2 = await ssm.getParameter({ Name: parameterName });
|
|
7031
|
+
const asNumber = parseInt(`${result2.Parameter?.Value}`, 10);
|
|
6643
7032
|
if (isNaN(asNumber)) {
|
|
6644
|
-
throw new ToolkitError(`SSM parameter ${parameterName} not a number: ${
|
|
7033
|
+
throw new ToolkitError(`SSM parameter ${parameterName} not a number: ${result2.Parameter?.Value}`);
|
|
6645
7034
|
}
|
|
6646
7035
|
this.cache.ssmParameters.set(parameterName, asNumber);
|
|
6647
7036
|
return asNumber;
|
|
@@ -6660,7 +7049,7 @@ var EnvironmentResources = class {
|
|
|
6660
7049
|
}
|
|
6661
7050
|
const ecr = this.sdk.ecr();
|
|
6662
7051
|
try {
|
|
6663
|
-
await this.
|
|
7052
|
+
await this.ioHelper.notify(debug3(`${repositoryName}: checking if ECR repository already exists`));
|
|
6664
7053
|
const describeResponse = await ecr.describeRepositories({
|
|
6665
7054
|
repositoryNames: [repositoryName]
|
|
6666
7055
|
});
|
|
@@ -6673,7 +7062,7 @@ var EnvironmentResources = class {
|
|
|
6673
7062
|
throw e;
|
|
6674
7063
|
}
|
|
6675
7064
|
}
|
|
6676
|
-
await this.
|
|
7065
|
+
await this.ioHelper.notify(debug3(`${repositoryName}: creating ECR repository`));
|
|
6677
7066
|
const assetTag = { Key: "awscdk:asset", Value: "true" };
|
|
6678
7067
|
const response = await ecr.createRepository({
|
|
6679
7068
|
repositoryName,
|
|
@@ -6683,7 +7072,7 @@ var EnvironmentResources = class {
|
|
|
6683
7072
|
if (!repositoryUri) {
|
|
6684
7073
|
throw new ToolkitError(`CreateRepository did not return a repository URI for ${repositoryUri}`);
|
|
6685
7074
|
}
|
|
6686
|
-
await this.
|
|
7075
|
+
await this.ioHelper.notify(debug3(`${repositoryName}: enable image scanning`));
|
|
6687
7076
|
await ecr.putImageScanningConfiguration({
|
|
6688
7077
|
repositoryName,
|
|
6689
7078
|
imageScanningConfiguration: { scanOnPush: true }
|
|
@@ -6692,8 +7081,8 @@ var EnvironmentResources = class {
|
|
|
6692
7081
|
}
|
|
6693
7082
|
};
|
|
6694
7083
|
var NoBootstrapStackEnvironmentResources = class extends EnvironmentResources {
|
|
6695
|
-
constructor(environment, sdk,
|
|
6696
|
-
super(environment, sdk,
|
|
7084
|
+
constructor(environment, sdk, ioHelper) {
|
|
7085
|
+
super(environment, sdk, ioHelper, emptyCache());
|
|
6697
7086
|
}
|
|
6698
7087
|
/**
|
|
6699
7088
|
* Look up the toolkit for a given environment, using a given SDK
|
|
@@ -6726,12 +7115,11 @@ async function replaceEnvPlaceholders(object, env, sdkProvider) {
|
|
|
6726
7115
|
|
|
6727
7116
|
// ../../aws-cdk/lib/api/environment/environment-access.ts
|
|
6728
7117
|
var EnvironmentAccess = class {
|
|
6729
|
-
constructor(sdkProvider, toolkitStackName,
|
|
7118
|
+
constructor(sdkProvider, toolkitStackName, ioHelper) {
|
|
6730
7119
|
this.sdkProvider = sdkProvider;
|
|
6731
7120
|
this.sdkCache = /* @__PURE__ */ new Map();
|
|
6732
7121
|
this.environmentResources = new EnvironmentResourcesRegistry(toolkitStackName);
|
|
6733
|
-
this.
|
|
6734
|
-
this.action = action;
|
|
7122
|
+
this.ioHelper = ioHelper;
|
|
6735
7123
|
}
|
|
6736
7124
|
/**
|
|
6737
7125
|
* Resolves the environment for a stack.
|
|
@@ -6810,7 +7198,7 @@ var EnvironmentAccess = class {
|
|
|
6810
7198
|
}
|
|
6811
7199
|
if (lookupEnv.isFallbackCredentials) {
|
|
6812
7200
|
const arn = await lookupEnv.replacePlaceholders(stack.lookupRole?.arn);
|
|
6813
|
-
await this.
|
|
7201
|
+
await this.ioHelper.notify(warn2(`Lookup role ${arn} was not assumed. Proceeding with default credentials.`));
|
|
6814
7202
|
}
|
|
6815
7203
|
return lookupEnv;
|
|
6816
7204
|
}
|
|
@@ -6832,7 +7220,7 @@ var EnvironmentAccess = class {
|
|
|
6832
7220
|
try {
|
|
6833
7221
|
return await this.accessStackForLookup(stack);
|
|
6834
7222
|
} catch (e) {
|
|
6835
|
-
await this.
|
|
7223
|
+
await this.ioHelper.notify(warn2(`${formatErrorMessage(e)}`));
|
|
6836
7224
|
}
|
|
6837
7225
|
return this.accessStackForStackOperations(stack, 0 /* ForReading */);
|
|
6838
7226
|
}
|
|
@@ -6873,7 +7261,7 @@ var EnvironmentAccess = class {
|
|
|
6873
7261
|
return {
|
|
6874
7262
|
sdk: stackSdk.sdk,
|
|
6875
7263
|
resolvedEnvironment,
|
|
6876
|
-
resources: this.environmentResources.for(resolvedEnvironment, stackSdk.sdk,
|
|
7264
|
+
resources: this.environmentResources.for(resolvedEnvironment, stackSdk.sdk, this.ioHelper),
|
|
6877
7265
|
// If we asked for a role, did not successfully assume it, and yet got here without an exception: that
|
|
6878
7266
|
// means we must have fallback credentials.
|
|
6879
7267
|
isFallbackCredentials: !stackSdk.didAssumeRole && !!assumeRoleArn,
|
|
@@ -6914,12 +7302,11 @@ var Deployments = class {
|
|
|
6914
7302
|
this.publisherCache = /* @__PURE__ */ new Map();
|
|
6915
7303
|
this.assetSdkProvider = props.sdkProvider;
|
|
6916
7304
|
this.deployStackSdkProvider = props.sdkProvider;
|
|
6917
|
-
this.
|
|
6918
|
-
this.action = props.action;
|
|
7305
|
+
this.ioHelper = props.ioHelper;
|
|
6919
7306
|
this.envs = new EnvironmentAccess(
|
|
6920
7307
|
props.sdkProvider,
|
|
6921
7308
|
props.toolkitStackName ?? DEFAULT_TOOLKIT_STACK_NAME,
|
|
6922
|
-
|
|
7309
|
+
this.ioHelper
|
|
6923
7310
|
);
|
|
6924
7311
|
}
|
|
6925
7312
|
/**
|
|
@@ -6933,12 +7320,12 @@ var Deployments = class {
|
|
|
6933
7320
|
return loadCurrentTemplateWithNestedStacks(rootStackArtifact, env.sdk, retrieveProcessedTemplate);
|
|
6934
7321
|
}
|
|
6935
7322
|
async readCurrentTemplate(stackArtifact) {
|
|
6936
|
-
await this.
|
|
7323
|
+
await this.ioHelper.notify(debug3(`Reading existing template for stack ${stackArtifact.displayName}.`));
|
|
6937
7324
|
const env = await this.envs.accessStackForLookupBestEffort(stackArtifact);
|
|
6938
7325
|
return loadCurrentTemplate(stackArtifact, env.sdk);
|
|
6939
7326
|
}
|
|
6940
7327
|
async resourceIdentifierSummaries(stackArtifact) {
|
|
6941
|
-
await this.
|
|
7328
|
+
await this.ioHelper.notify(debug3(`Retrieving template summary for stack ${stackArtifact.displayName}.`));
|
|
6942
7329
|
const env = await this.envs.accessStackForReadOnlyStackOperations(stackArtifact);
|
|
6943
7330
|
const cfn = env.sdk.cloudFormation();
|
|
6944
7331
|
await uploadStackTemplateAssets(stackArtifact, this);
|
|
@@ -6960,7 +7347,7 @@ var Deployments = class {
|
|
|
6960
7347
|
}
|
|
6961
7348
|
const response = await cfn.getTemplateSummary(cfnParam);
|
|
6962
7349
|
if (!response.ResourceIdentifierSummaries) {
|
|
6963
|
-
await this.
|
|
7350
|
+
await this.ioHelper.notify(debug3('GetTemplateSummary API call did not return "ResourceIdentifierSummaries"'));
|
|
6964
7351
|
}
|
|
6965
7352
|
return response.ResourceIdentifierSummaries ?? [];
|
|
6966
7353
|
}
|
|
@@ -7008,7 +7395,7 @@ var Deployments = class {
|
|
|
7008
7395
|
resourcesToImport: options.resourcesToImport,
|
|
7009
7396
|
overrideTemplate: options.overrideTemplate,
|
|
7010
7397
|
assetParallelism: options.assetParallelism
|
|
7011
|
-
},
|
|
7398
|
+
}, this.ioHelper);
|
|
7012
7399
|
}
|
|
7013
7400
|
async rollbackStack(options) {
|
|
7014
7401
|
let resourcesToSkip = options.orphanLogicalIds ?? [];
|
|
@@ -7032,10 +7419,10 @@ var Deployments = class {
|
|
|
7032
7419
|
const executionRoleArn = await env.replacePlaceholders(options.roleArn ?? options.stack.cloudFormationExecutionRoleArn);
|
|
7033
7420
|
switch (cloudFormationStack.stackStatus.rollbackChoice) {
|
|
7034
7421
|
case 3 /* NONE */:
|
|
7035
|
-
await this.
|
|
7422
|
+
await this.ioHelper.notify(warn2(`Stack ${deployName} does not need a rollback: ${cloudFormationStack.stackStatus}`));
|
|
7036
7423
|
return { notInRollbackableState: true };
|
|
7037
7424
|
case 0 /* START_ROLLBACK */:
|
|
7038
|
-
await this.
|
|
7425
|
+
await this.ioHelper.notify(debug3(`Initiating rollback of stack ${deployName}`));
|
|
7039
7426
|
await cfn.rollbackStack({
|
|
7040
7427
|
StackName: deployName,
|
|
7041
7428
|
RoleARN: executionRoleArn,
|
|
@@ -7054,7 +7441,7 @@ var Deployments = class {
|
|
|
7054
7441
|
resourcesToSkip = poller.resourceErrors.filter((r) => !r.isStackEvent && r.parentStackLogicalIds.length === 0).map((r) => r.event.LogicalResourceId ?? "");
|
|
7055
7442
|
}
|
|
7056
7443
|
const skipDescription = resourcesToSkip.length > 0 ? ` (orphaning: ${resourcesToSkip.join(", ")})` : "";
|
|
7057
|
-
await this.
|
|
7444
|
+
await this.ioHelper.notify(warn2(`Continuing rollback of stack ${deployName}${skipDescription}`));
|
|
7058
7445
|
await cfn.continueUpdateRollback({
|
|
7059
7446
|
StackName: deployName,
|
|
7060
7447
|
ClientRequestToken: (0, import_crypto.randomUUID)(),
|
|
@@ -7063,8 +7450,7 @@ var Deployments = class {
|
|
|
7063
7450
|
});
|
|
7064
7451
|
break;
|
|
7065
7452
|
case 2 /* ROLLBACK_FAILED */:
|
|
7066
|
-
await this.
|
|
7067
|
-
this.action,
|
|
7453
|
+
await this.ioHelper.notify(warn2(
|
|
7068
7454
|
`Stack ${deployName} failed creation and rollback. This state cannot be rolled back. You can recreate this stack by running 'cdk deploy'.`
|
|
7069
7455
|
));
|
|
7070
7456
|
return { notInRollbackableState: true };
|
|
@@ -7075,14 +7461,13 @@ var Deployments = class {
|
|
|
7075
7461
|
cfn,
|
|
7076
7462
|
stack: options.stack,
|
|
7077
7463
|
stackName: deployName,
|
|
7078
|
-
|
|
7079
|
-
action: this.action
|
|
7464
|
+
ioHelper: this.ioHelper
|
|
7080
7465
|
});
|
|
7081
7466
|
await monitor.start();
|
|
7082
7467
|
let stackErrorMessage = void 0;
|
|
7083
7468
|
let finalStackState = cloudFormationStack;
|
|
7084
7469
|
try {
|
|
7085
|
-
const successStack = await stabilizeStack(cfn,
|
|
7470
|
+
const successStack = await stabilizeStack(cfn, this.ioHelper, deployName);
|
|
7086
7471
|
if (!successStack) {
|
|
7087
7472
|
throw new ToolkitError("Stack deploy failed (the stack disappeared while we were rolling it back)");
|
|
7088
7473
|
}
|
|
@@ -7118,7 +7503,7 @@ var Deployments = class {
|
|
|
7118
7503
|
roleArn: executionRoleArn,
|
|
7119
7504
|
stack: options.stack,
|
|
7120
7505
|
deployName: options.deployName
|
|
7121
|
-
},
|
|
7506
|
+
}, this.ioHelper);
|
|
7122
7507
|
}
|
|
7123
7508
|
async stackExists(options) {
|
|
7124
7509
|
let env;
|
|
@@ -7161,7 +7546,10 @@ var Deployments = class {
|
|
|
7161
7546
|
async publishSingleAsset(assetManifest, asset, options) {
|
|
7162
7547
|
const stackEnv = await this.envs.resolveStackEnvironment(options.stack);
|
|
7163
7548
|
const publisher = this.cachedPublisher(assetManifest, stackEnv, options.stackName);
|
|
7164
|
-
await publisher.publishEntry(asset, {
|
|
7549
|
+
await publisher.publishEntry(asset, {
|
|
7550
|
+
allowCrossAccount: await this.allowCrossAccountAssetPublishingForEnv(options.stack),
|
|
7551
|
+
force: options.forcePublish
|
|
7552
|
+
});
|
|
7165
7553
|
if (publisher.hasFailures) {
|
|
7166
7554
|
throw new ToolkitError(`Failed to publish asset ${asset.displayName(true)}`);
|
|
7167
7555
|
}
|
|
@@ -7169,10 +7557,7 @@ var Deployments = class {
|
|
|
7169
7557
|
async allowCrossAccountAssetPublishingForEnv(stack) {
|
|
7170
7558
|
if (this._allowCrossAccountAssetPublishing === void 0) {
|
|
7171
7559
|
const env = await this.envs.accessStackForReadOnlyStackOperations(stack);
|
|
7172
|
-
this._allowCrossAccountAssetPublishing = await determineAllowCrossAccountAssetPublishing(env.sdk,
|
|
7173
|
-
ioHost: this.ioHost,
|
|
7174
|
-
action: this.action
|
|
7175
|
-
}, this.props.toolkitStackName);
|
|
7560
|
+
this._allowCrossAccountAssetPublishing = await determineAllowCrossAccountAssetPublishing(env.sdk, this.ioHelper, this.props.toolkitStackName);
|
|
7176
7561
|
}
|
|
7177
7562
|
return this._allowCrossAccountAssetPublishing;
|
|
7178
7563
|
}
|
|
@@ -7206,15 +7591,15 @@ var Deployments = class {
|
|
|
7206
7591
|
// The AssetPublishing class takes care of role assuming etc, so it's okay to
|
|
7207
7592
|
// give it a direct `SdkProvider`.
|
|
7208
7593
|
aws: new PublishingAws(this.assetSdkProvider, env),
|
|
7209
|
-
progressListener: new ParallelSafeAssetProgress(prefix,
|
|
7594
|
+
progressListener: new ParallelSafeAssetProgress(prefix, this.ioHelper)
|
|
7210
7595
|
});
|
|
7211
7596
|
this.publisherCache.set(assetManifest, publisher);
|
|
7212
7597
|
return publisher;
|
|
7213
7598
|
}
|
|
7214
7599
|
};
|
|
7215
7600
|
var ParallelSafeAssetProgress = class extends BasePublishProgressListener {
|
|
7216
|
-
constructor(prefix,
|
|
7217
|
-
super(
|
|
7601
|
+
constructor(prefix, ioHelper) {
|
|
7602
|
+
super(ioHelper);
|
|
7218
7603
|
this.prefix = prefix;
|
|
7219
7604
|
}
|
|
7220
7605
|
getMessage(type, event) {
|
|
@@ -7247,8 +7632,7 @@ var ResourceImporter = class {
|
|
|
7247
7632
|
constructor(stack, props) {
|
|
7248
7633
|
this.stack = stack;
|
|
7249
7634
|
this.cfn = props.deployments;
|
|
7250
|
-
this.
|
|
7251
|
-
this.action = props.action;
|
|
7635
|
+
this.ioHelper = props.ioHelper;
|
|
7252
7636
|
}
|
|
7253
7637
|
/**
|
|
7254
7638
|
* Ask the user for resources to import
|
|
@@ -7276,17 +7660,17 @@ var ResourceImporter = class {
|
|
|
7276
7660
|
const descr = this.describeResource(resource.logicalId);
|
|
7277
7661
|
const idProps = contents[resource.logicalId];
|
|
7278
7662
|
if (idProps) {
|
|
7279
|
-
await this.
|
|
7663
|
+
await this.ioHelper.notify(info3((0, import_util34.format)("%s: importing using %s", chalk13.blue(descr), chalk13.blue(fmtdict(idProps)))));
|
|
7280
7664
|
ret.importResources.push(resource);
|
|
7281
7665
|
ret.resourceMap[resource.logicalId] = idProps;
|
|
7282
7666
|
delete contents[resource.logicalId];
|
|
7283
7667
|
} else {
|
|
7284
|
-
await this.
|
|
7668
|
+
await this.ioHelper.notify(info3((0, import_util34.format)("%s: skipping", chalk13.blue(descr))));
|
|
7285
7669
|
}
|
|
7286
7670
|
}
|
|
7287
7671
|
const unknown = Object.keys(contents);
|
|
7288
7672
|
if (unknown.length > 0) {
|
|
7289
|
-
await this.
|
|
7673
|
+
await this.ioHelper.notify(warn2(`Unrecognized resource identifiers in mapping file: ${unknown.join(", ")}`));
|
|
7290
7674
|
}
|
|
7291
7675
|
return ret;
|
|
7292
7676
|
}
|
|
@@ -7316,18 +7700,18 @@ var ResourceImporter = class {
|
|
|
7316
7700
|
}
|
|
7317
7701
|
async importResources(overrideTemplate, resourcesToImport, options) {
|
|
7318
7702
|
try {
|
|
7319
|
-
const
|
|
7703
|
+
const result2 = await this.cfn.deployStack({
|
|
7320
7704
|
stack: this.stack,
|
|
7321
7705
|
deployName: this.stack.stackName,
|
|
7322
7706
|
...options,
|
|
7323
7707
|
overrideTemplate,
|
|
7324
7708
|
resourcesToImport
|
|
7325
7709
|
});
|
|
7326
|
-
assertIsSuccessfulDeployStackResult(
|
|
7327
|
-
const
|
|
7328
|
-
await this.
|
|
7710
|
+
assertIsSuccessfulDeployStackResult(result2);
|
|
7711
|
+
const message2 = result2.noOp ? " \u2705 %s (no changes)" : " \u2705 %s";
|
|
7712
|
+
await this.ioHelper.notify(info3("\n" + chalk13.green((0, import_util34.format)(message2, this.stack.displayName))));
|
|
7329
7713
|
} catch (e) {
|
|
7330
|
-
await this.
|
|
7714
|
+
await this.ioHelper.notify(error3((0, import_util34.format)("\n \u274C %s failed: %s", chalk13.bold(this.stack.displayName), e), "CDK_TOOLKIT_E3900"));
|
|
7331
7715
|
throw e;
|
|
7332
7716
|
}
|
|
7333
7717
|
}
|
|
@@ -7346,7 +7730,7 @@ var ResourceImporter = class {
|
|
|
7346
7730
|
if (nonAdditions.length) {
|
|
7347
7731
|
const offendingResources = nonAdditions.map(([logId, _]) => this.describeResource(logId));
|
|
7348
7732
|
if (allowNonAdditions) {
|
|
7349
|
-
await this.
|
|
7733
|
+
await this.ioHelper.notify(warn2(`Ignoring updated/deleted resources (--force): ${offendingResources.join(", ")}`));
|
|
7350
7734
|
} else {
|
|
7351
7735
|
throw new ToolkitError(`No resource updates or deletes are allowed on import operation. Make sure to resolve pending changes to existing resources, before attempting an import. Updated/deleted resources: ${offendingResources.join(", ")} (--force to override)`);
|
|
7352
7736
|
}
|
|
@@ -7419,7 +7803,7 @@ var ResourceImporter = class {
|
|
|
7419
7803
|
const resourceName = this.describeResource(chg.logicalId);
|
|
7420
7804
|
const resourceType = chg.resourceDiff.newResourceType;
|
|
7421
7805
|
if (resourceType === void 0 || !(resourceType in resourceIdentifiers)) {
|
|
7422
|
-
await this.
|
|
7806
|
+
await this.ioHelper.notify(warn2(`${resourceName}: unsupported resource type ${resourceType}, skipping import.`));
|
|
7423
7807
|
return void 0;
|
|
7424
7808
|
}
|
|
7425
7809
|
const idPropSets = resourceIdentifiers[resourceType];
|
|
@@ -7436,7 +7820,7 @@ var ResourceImporter = class {
|
|
|
7436
7820
|
}
|
|
7437
7821
|
}
|
|
7438
7822
|
if (satisfiedPropSets.length > 0) {
|
|
7439
|
-
await this.
|
|
7823
|
+
await this.ioHelper.notify(info3(chalk13.grey(`Skipping import of ${resourceName}`)));
|
|
7440
7824
|
return void 0;
|
|
7441
7825
|
}
|
|
7442
7826
|
const prefix = `${chalk13.blue(resourceName)} (${resourceType})`;
|
|
@@ -7449,7 +7833,7 @@ var ResourceImporter = class {
|
|
|
7449
7833
|
promptPattern = `${prefix}: enter %`;
|
|
7450
7834
|
}
|
|
7451
7835
|
if (preamble) {
|
|
7452
|
-
await this.
|
|
7836
|
+
await this.ioHelper.notify(info3(preamble));
|
|
7453
7837
|
}
|
|
7454
7838
|
for (const idProps of idPropSets) {
|
|
7455
7839
|
const input = {};
|
|
@@ -7473,7 +7857,7 @@ var ResourceImporter = class {
|
|
|
7473
7857
|
return input;
|
|
7474
7858
|
}
|
|
7475
7859
|
}
|
|
7476
|
-
await this.
|
|
7860
|
+
await this.ioHelper.notify(info3(chalk13.grey(`Skipping import of ${resourceName}`)));
|
|
7477
7861
|
return void 0;
|
|
7478
7862
|
}
|
|
7479
7863
|
/**
|
|
@@ -7528,8 +7912,7 @@ var fs13 = __toESM(require("fs-extra"));
|
|
|
7528
7912
|
var ResourceMigrator = class {
|
|
7529
7913
|
constructor(props) {
|
|
7530
7914
|
this.props = props;
|
|
7531
|
-
this.
|
|
7532
|
-
this.action = props.action;
|
|
7915
|
+
this.ioHelper = props.ioHelper;
|
|
7533
7916
|
}
|
|
7534
7917
|
/**
|
|
7535
7918
|
* Checks to see if a migrate.json file exists. If it does and the source is either `filepath` or
|
|
@@ -7541,16 +7924,15 @@ var ResourceMigrator = class {
|
|
|
7541
7924
|
const stack = stacks.stackArtifacts[0];
|
|
7542
7925
|
const migrateDeployment = new ResourceImporter(stack, {
|
|
7543
7926
|
deployments: this.props.deployments,
|
|
7544
|
-
|
|
7545
|
-
action: this.action
|
|
7927
|
+
ioHelper: this.ioHelper
|
|
7546
7928
|
});
|
|
7547
7929
|
const resourcesToImport = await this.tryGetResources(await migrateDeployment.resolveEnvironment());
|
|
7548
7930
|
if (resourcesToImport) {
|
|
7549
|
-
await this.
|
|
7550
|
-
await this.
|
|
7931
|
+
await this.ioHelper.notify(info3(`${chalk14.bold(stack.displayName)}: creating stack for resource migration...`));
|
|
7932
|
+
await this.ioHelper.notify(info3(`${chalk14.bold(stack.displayName)}: importing resources into stack...`));
|
|
7551
7933
|
await this.performResourceMigration(migrateDeployment, resourcesToImport, options);
|
|
7552
7934
|
fs13.rmSync("migrate.json");
|
|
7553
|
-
await this.
|
|
7935
|
+
await this.ioHelper.notify(info3(`${chalk14.bold(stack.displayName)}: applying CDKMetadata and Outputs to stack (if applicable)...`));
|
|
7554
7936
|
}
|
|
7555
7937
|
}
|
|
7556
7938
|
/**
|
|
@@ -7566,7 +7948,7 @@ var ResourceMigrator = class {
|
|
|
7566
7948
|
rollback: options.rollback
|
|
7567
7949
|
});
|
|
7568
7950
|
elapsedDeployTime = (/* @__PURE__ */ new Date()).getTime() - startDeployTime;
|
|
7569
|
-
await this.
|
|
7951
|
+
await this.ioHelper.notify(info3(`'
|
|
7570
7952
|
\u2728 Resource migration time: ${formatTime(elapsedDeployTime)}s
|
|
7571
7953
|
'`, "CDK_TOOLKIT_I5002", {
|
|
7572
7954
|
duration: elapsedDeployTime
|
|
@@ -7590,22 +7972,35 @@ var ResourceMigrator = class {
|
|
|
7590
7972
|
// ../../aws-cdk/lib/api/logs/logs-monitor.ts
|
|
7591
7973
|
var util7 = __toESM(require("util"));
|
|
7592
7974
|
var chalk15 = __toESM(require("chalk"));
|
|
7593
|
-
var
|
|
7975
|
+
var uuid4 = __toESM(require("uuid"));
|
|
7594
7976
|
var CloudWatchLogEventMonitor = class {
|
|
7595
|
-
constructor(
|
|
7977
|
+
constructor(props) {
|
|
7596
7978
|
/**
|
|
7597
7979
|
* Map of environment (account:region) to LogGroupsAccessSettings
|
|
7598
7980
|
*/
|
|
7599
7981
|
this.envsLogGroupsAccessSettings = /* @__PURE__ */ new Map();
|
|
7600
|
-
|
|
7601
|
-
|
|
7982
|
+
/**
|
|
7983
|
+
* After reading events from all CloudWatch log groups
|
|
7984
|
+
* how long should we wait to read more events.
|
|
7985
|
+
*
|
|
7986
|
+
* If there is some error with reading events (i.e. Throttle)
|
|
7987
|
+
* then this is also how long we wait until we try again
|
|
7988
|
+
*/
|
|
7989
|
+
this.pollingInterval = 2e3;
|
|
7990
|
+
this.startTime = props.startTime?.getTime() ?? Date.now();
|
|
7991
|
+
this.ioHelper = props.ioHelper;
|
|
7602
7992
|
}
|
|
7603
7993
|
/**
|
|
7604
7994
|
* resume reading/printing events
|
|
7605
7995
|
*/
|
|
7606
|
-
activate() {
|
|
7607
|
-
this.
|
|
7608
|
-
this.
|
|
7996
|
+
async activate() {
|
|
7997
|
+
this.monitorId = uuid4.v4();
|
|
7998
|
+
await this.ioHelper.notify(IO.CDK_TOOLKIT_I5032.msg("Start monitoring log groups", {
|
|
7999
|
+
monitor: this.monitorId,
|
|
8000
|
+
logGroupNames: this.logGroupNames()
|
|
8001
|
+
}));
|
|
8002
|
+
await this.tick();
|
|
8003
|
+
this.scheduleNextTick();
|
|
7609
8004
|
}
|
|
7610
8005
|
/**
|
|
7611
8006
|
* deactivates the monitor so no new events are read
|
|
@@ -7616,9 +8011,14 @@ var CloudWatchLogEventMonitor = class {
|
|
|
7616
8011
|
* Also resets the start time to be when the new deployment was triggered
|
|
7617
8012
|
* and clears the list of tracked log groups
|
|
7618
8013
|
*/
|
|
7619
|
-
deactivate() {
|
|
7620
|
-
|
|
8014
|
+
async deactivate() {
|
|
8015
|
+
const oldMonitorId = this.monitorId;
|
|
8016
|
+
this.monitorId = void 0;
|
|
7621
8017
|
this.startTime = Date.now();
|
|
8018
|
+
await this.ioHelper.notify(IO.CDK_TOOLKIT_I5034.msg("Stopped monitoring log groups", {
|
|
8019
|
+
monitor: oldMonitorId,
|
|
8020
|
+
logGroupNames: this.logGroupNames()
|
|
8021
|
+
}));
|
|
7622
8022
|
this.envsLogGroupsAccessSettings.clear();
|
|
7623
8023
|
}
|
|
7624
8024
|
/**
|
|
@@ -7645,22 +8045,31 @@ var CloudWatchLogEventMonitor = class {
|
|
|
7645
8045
|
}
|
|
7646
8046
|
});
|
|
7647
8047
|
}
|
|
7648
|
-
|
|
7649
|
-
|
|
8048
|
+
logGroupNames() {
|
|
8049
|
+
return Array.from(this.envsLogGroupsAccessSettings.values()).flatMap((settings) => Object.keys(settings.logGroupsStartTimes));
|
|
8050
|
+
}
|
|
8051
|
+
scheduleNextTick() {
|
|
8052
|
+
if (!this.monitorId) {
|
|
8053
|
+
return;
|
|
8054
|
+
}
|
|
8055
|
+
setTimeout(() => void this.tick(), this.pollingInterval);
|
|
7650
8056
|
}
|
|
7651
8057
|
async tick() {
|
|
7652
|
-
if (!this.
|
|
8058
|
+
if (!this.monitorId) {
|
|
7653
8059
|
return;
|
|
7654
8060
|
}
|
|
7655
8061
|
try {
|
|
7656
8062
|
const events = flatten(await this.readNewEvents());
|
|
7657
|
-
|
|
7658
|
-
this.print(event);
|
|
7659
|
-
}
|
|
8063
|
+
for (const event of events) {
|
|
8064
|
+
await this.print(event);
|
|
8065
|
+
}
|
|
8066
|
+
if (!this.monitorId) {
|
|
8067
|
+
return;
|
|
8068
|
+
}
|
|
7660
8069
|
} catch (e) {
|
|
7661
|
-
|
|
8070
|
+
await this.ioHelper.notify(IO.CDK_TOOLKIT_E5035.msg("Error occurred while monitoring logs: %s", { error: e }));
|
|
7662
8071
|
}
|
|
7663
|
-
this.scheduleNextTick(
|
|
8072
|
+
this.scheduleNextTick();
|
|
7664
8073
|
}
|
|
7665
8074
|
/**
|
|
7666
8075
|
* Reads all new log events from a set of CloudWatch Log Groups
|
|
@@ -7678,15 +8087,16 @@ var CloudWatchLogEventMonitor = class {
|
|
|
7678
8087
|
/**
|
|
7679
8088
|
* Print out a cloudwatch event
|
|
7680
8089
|
*/
|
|
7681
|
-
print(event) {
|
|
7682
|
-
|
|
8090
|
+
async print(event) {
|
|
8091
|
+
await this.ioHelper.notify(IO.CDK_TOOLKIT_I5033.msg(
|
|
7683
8092
|
util7.format(
|
|
7684
8093
|
"[%s] %s %s",
|
|
7685
8094
|
chalk15.blue(event.logGroupName),
|
|
7686
8095
|
chalk15.yellow(event.timestamp.toLocaleTimeString()),
|
|
7687
8096
|
event.message.trim()
|
|
7688
|
-
)
|
|
7689
|
-
|
|
8097
|
+
),
|
|
8098
|
+
event
|
|
8099
|
+
));
|
|
7690
8100
|
}
|
|
7691
8101
|
/**
|
|
7692
8102
|
* Reads all new log events from a CloudWatch Log Group
|
|
@@ -7736,13 +8146,13 @@ var CloudWatchLogEventMonitor = class {
|
|
|
7736
8146
|
|
|
7737
8147
|
// ../../aws-cdk/lib/api/logs/find-cloudwatch-logs.ts
|
|
7738
8148
|
var IGNORE_LOGS_RESOURCE_TYPES = ["AWS::EC2::FlowLog", "AWS::CloudTrail::Trail", "AWS::CodeBuild::Project"];
|
|
7739
|
-
async function findCloudWatchLogGroups(sdkProvider,
|
|
8149
|
+
async function findCloudWatchLogGroups(sdkProvider, ioHelper, stackArtifact) {
|
|
7740
8150
|
let sdk;
|
|
7741
8151
|
const resolvedEnv = await sdkProvider.resolveEnvironment(stackArtifact.environment);
|
|
7742
8152
|
try {
|
|
7743
|
-
sdk = (await new EnvironmentAccess(sdkProvider, DEFAULT_TOOLKIT_STACK_NAME,
|
|
8153
|
+
sdk = (await new EnvironmentAccess(sdkProvider, DEFAULT_TOOLKIT_STACK_NAME, ioHelper).accessStackForLookup(stackArtifact)).sdk;
|
|
7744
8154
|
} catch (e) {
|
|
7745
|
-
|
|
8155
|
+
await ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg(`Failed to access SDK environment: ${formatErrorMessage(e)}`));
|
|
7746
8156
|
sdk = (await sdkProvider.forEnvironment(resolvedEnv, 0 /* ForReading */)).sdk;
|
|
7747
8157
|
}
|
|
7748
8158
|
const listStackResources = new LazyListStackResources(sdk, stackArtifact.stackName);
|
|
@@ -7810,12 +8220,11 @@ function findAllLogGroupNames(stackResources, evaluateCfnTemplate) {
|
|
|
7810
8220
|
|
|
7811
8221
|
// ../../aws-cdk/lib/api/work-graph/work-graph.ts
|
|
7812
8222
|
var WorkGraph = class {
|
|
7813
|
-
constructor(nodes,
|
|
8223
|
+
constructor(nodes, ioHelper) {
|
|
7814
8224
|
this.readyPool = [];
|
|
7815
8225
|
this.lazyDependencies = /* @__PURE__ */ new Map();
|
|
7816
8226
|
this.nodes = { ...nodes };
|
|
7817
|
-
this.
|
|
7818
|
-
this.action = props.action;
|
|
8227
|
+
this.ioHelper = ioHelper;
|
|
7819
8228
|
}
|
|
7820
8229
|
addNodes(...nodes) {
|
|
7821
8230
|
for (const node of nodes) {
|
|
@@ -7972,8 +8381,8 @@ var WorkGraph = class {
|
|
|
7972
8381
|
deployed(node) {
|
|
7973
8382
|
node.deploymentState = "completed" /* COMPLETED */;
|
|
7974
8383
|
}
|
|
7975
|
-
failed(node,
|
|
7976
|
-
this.error =
|
|
8384
|
+
failed(node, error4) {
|
|
8385
|
+
this.error = error4;
|
|
7977
8386
|
node.deploymentState = "failed" /* FAILED */;
|
|
7978
8387
|
this.skipRest();
|
|
7979
8388
|
this.readyPool.splice(0);
|
|
@@ -8018,7 +8427,7 @@ var WorkGraph = class {
|
|
|
8018
8427
|
* Do this in parallel, because there may be a lot of assets in an application (seen in practice: >100 assets)
|
|
8019
8428
|
*/
|
|
8020
8429
|
async removeUnnecessaryAssets(isUnnecessary) {
|
|
8021
|
-
await this.
|
|
8430
|
+
await this.ioHelper.notify(debug3("Checking for previously published assets"));
|
|
8022
8431
|
const publishes = this.nodesOfType("asset-publish");
|
|
8023
8432
|
const classifiedNodes = await parallelPromises(
|
|
8024
8433
|
8,
|
|
@@ -8028,7 +8437,7 @@ var WorkGraph = class {
|
|
|
8028
8437
|
for (const assetNode of alreadyPublished) {
|
|
8029
8438
|
this.removeNode(assetNode);
|
|
8030
8439
|
}
|
|
8031
|
-
await this.
|
|
8440
|
+
await this.ioHelper.notify(debug3(`${publishes.length} total assets, ${publishes.length - alreadyPublished.length} still need to be published`));
|
|
8032
8441
|
const unusedBuilds = this.nodesOfType("asset-build").filter((build) => this.dependees(build).length === 0);
|
|
8033
8442
|
for (const unusedBuild of unusedBuilds) {
|
|
8034
8443
|
this.removeNode(unusedBuild);
|
|
@@ -8046,7 +8455,7 @@ var WorkGraph = class {
|
|
|
8046
8455
|
this.readyPool.sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));
|
|
8047
8456
|
if (this.readyPool.length === 0 && activeCount === 0 && pendingCount > 0) {
|
|
8048
8457
|
const cycle = this.findCycle() ?? ["No cycle found!"];
|
|
8049
|
-
await this.
|
|
8458
|
+
await this.ioHelper.notify(trace3(`Cycle ${cycle.join(" -> ")} in graph ${this}`));
|
|
8050
8459
|
throw new ToolkitError(`Unable to make progress anymore, dependency cycle between remaining artifacts: ${cycle.join(" -> ")} (run with -vv for full graph)`);
|
|
8051
8460
|
}
|
|
8052
8461
|
}
|
|
@@ -8139,12 +8548,11 @@ function simplifyId(id) {
|
|
|
8139
8548
|
var cxapi3 = __toESM(require("@aws-cdk/cx-api"));
|
|
8140
8549
|
var import_cdk_assets4 = require("cdk-assets");
|
|
8141
8550
|
var WorkGraphBuilder = class _WorkGraphBuilder {
|
|
8142
|
-
constructor(
|
|
8551
|
+
constructor(ioHelper, prebuildAssets, idPrefix = "") {
|
|
8143
8552
|
this.prebuildAssets = prebuildAssets;
|
|
8144
8553
|
this.idPrefix = idPrefix;
|
|
8145
|
-
this.graph = new WorkGraph({},
|
|
8146
|
-
this.
|
|
8147
|
-
this.action = action;
|
|
8554
|
+
this.graph = new WorkGraph({}, ioHelper);
|
|
8555
|
+
this.ioHelper = ioHelper;
|
|
8148
8556
|
}
|
|
8149
8557
|
static {
|
|
8150
8558
|
/**
|
|
@@ -8238,7 +8646,7 @@ var WorkGraphBuilder = class _WorkGraphBuilder {
|
|
|
8238
8646
|
} else if (cxapi3.NestedCloudAssemblyArtifact.isNestedCloudAssemblyArtifact(artifact)) {
|
|
8239
8647
|
const assembly = new cxapi3.CloudAssembly(artifact.fullPath, { topoSort: false });
|
|
8240
8648
|
const nestedGraph = new _WorkGraphBuilder(
|
|
8241
|
-
|
|
8649
|
+
this.ioHelper,
|
|
8242
8650
|
this.prebuildAssets,
|
|
8243
8651
|
`${this.idPrefix}${artifact.id}.`
|
|
8244
8652
|
).build(assembly.artifacts);
|
|
@@ -8295,24 +8703,24 @@ var path12 = __toESM(require("path"));
|
|
|
8295
8703
|
// ../../aws-cdk/lib/api/bootstrap/deploy-bootstrap.ts
|
|
8296
8704
|
var os4 = __toESM(require("os"));
|
|
8297
8705
|
var path11 = __toESM(require("path"));
|
|
8298
|
-
var
|
|
8706
|
+
var import_cloud_assembly_schema3 = require("@aws-cdk/cloud-assembly-schema");
|
|
8299
8707
|
var import_cx_api6 = require("@aws-cdk/cx-api");
|
|
8300
8708
|
var fs14 = __toESM(require("fs-extra"));
|
|
8301
8709
|
var BootstrapStack = class _BootstrapStack {
|
|
8302
|
-
constructor(sdkProvider, sdk, resolvedEnvironment, toolkitStackName, currentToolkitInfo,
|
|
8710
|
+
constructor(sdkProvider, sdk, resolvedEnvironment, toolkitStackName, currentToolkitInfo, ioHelper) {
|
|
8303
8711
|
this.sdkProvider = sdkProvider;
|
|
8304
8712
|
this.sdk = sdk;
|
|
8305
8713
|
this.resolvedEnvironment = resolvedEnvironment;
|
|
8306
8714
|
this.toolkitStackName = toolkitStackName;
|
|
8307
8715
|
this.currentToolkitInfo = currentToolkitInfo;
|
|
8308
|
-
this.
|
|
8716
|
+
this.ioHelper = ioHelper;
|
|
8309
8717
|
}
|
|
8310
|
-
static async lookup(sdkProvider, environment, toolkitStackName,
|
|
8718
|
+
static async lookup(sdkProvider, environment, toolkitStackName, ioHelper) {
|
|
8311
8719
|
toolkitStackName = toolkitStackName ?? DEFAULT_TOOLKIT_STACK_NAME;
|
|
8312
8720
|
const resolvedEnvironment = await sdkProvider.resolveEnvironment(environment);
|
|
8313
8721
|
const sdk = (await sdkProvider.forEnvironment(resolvedEnvironment, 1 /* ForWriting */)).sdk;
|
|
8314
|
-
const currentToolkitInfo = await ToolkitInfo.lookup(resolvedEnvironment, sdk,
|
|
8315
|
-
return new _BootstrapStack(sdkProvider, sdk, resolvedEnvironment, toolkitStackName, currentToolkitInfo,
|
|
8722
|
+
const currentToolkitInfo = await ToolkitInfo.lookup(resolvedEnvironment, sdk, ioHelper, toolkitStackName);
|
|
8723
|
+
return new _BootstrapStack(sdkProvider, sdk, resolvedEnvironment, toolkitStackName, currentToolkitInfo, ioHelper);
|
|
8316
8724
|
}
|
|
8317
8725
|
get parameters() {
|
|
8318
8726
|
return this.currentToolkitInfo.found ? this.currentToolkitInfo.bootstrapStack.parameters : {};
|
|
@@ -8337,8 +8745,7 @@ var BootstrapStack = class _BootstrapStack {
|
|
|
8337
8745
|
const currentVariant = this.currentToolkitInfo.variant;
|
|
8338
8746
|
const newVariant = bootstrapVariantFromTemplate(template);
|
|
8339
8747
|
if (currentVariant !== newVariant) {
|
|
8340
|
-
await this.
|
|
8341
|
-
this.msg.action,
|
|
8748
|
+
await this.ioHelper.notify(warn2(
|
|
8342
8749
|
`Bootstrap stack already exists, containing '${currentVariant}'. Not overwriting it with a template containing '${newVariant}' (use --force if you intend to overwrite)`
|
|
8343
8750
|
));
|
|
8344
8751
|
return abortResponse;
|
|
@@ -8346,13 +8753,11 @@ var BootstrapStack = class _BootstrapStack {
|
|
|
8346
8753
|
const newVersion = bootstrapVersionFromTemplate(template);
|
|
8347
8754
|
const currentVersion = this.currentToolkitInfo.version;
|
|
8348
8755
|
if (newVersion < currentVersion) {
|
|
8349
|
-
await this.
|
|
8350
|
-
this.msg.action,
|
|
8756
|
+
await this.ioHelper.notify(warn2(
|
|
8351
8757
|
`Bootstrap stack already at version ${currentVersion}. Not downgrading it to version ${newVersion} (use --force if you intend to downgrade)`
|
|
8352
8758
|
));
|
|
8353
8759
|
if (newVersion === 0) {
|
|
8354
|
-
await this.
|
|
8355
|
-
this.msg.action,
|
|
8760
|
+
await this.ioHelper.notify(warn2(
|
|
8356
8761
|
"(Did you set the '@aws-cdk/core:newStyleStackSynthesis' feature flag in cdk.json?)"
|
|
8357
8762
|
));
|
|
8358
8763
|
}
|
|
@@ -8366,7 +8771,7 @@ var BootstrapStack = class _BootstrapStack {
|
|
|
8366
8771
|
spaces: 2
|
|
8367
8772
|
});
|
|
8368
8773
|
builder.addArtifact(this.toolkitStackName, {
|
|
8369
|
-
type:
|
|
8774
|
+
type: import_cloud_assembly_schema3.ArtifactType.AWS_CLOUDFORMATION_STACK,
|
|
8370
8775
|
environment: import_cx_api6.EnvironmentUtils.format(this.resolvedEnvironment.account, this.resolvedEnvironment.region),
|
|
8371
8776
|
properties: {
|
|
8372
8777
|
templateFile,
|
|
@@ -8386,8 +8791,8 @@ var BootstrapStack = class _BootstrapStack {
|
|
|
8386
8791
|
parameters,
|
|
8387
8792
|
usePreviousParameters: options.usePreviousParameters ?? true,
|
|
8388
8793
|
// Obviously we can't need a bootstrap stack to deploy a bootstrap stack
|
|
8389
|
-
envResources: new NoBootstrapStackEnvironmentResources(this.resolvedEnvironment, this.sdk, this.
|
|
8390
|
-
}, this.
|
|
8794
|
+
envResources: new NoBootstrapStackEnvironmentResources(this.resolvedEnvironment, this.sdk, this.ioHelper)
|
|
8795
|
+
}, this.ioHelper);
|
|
8391
8796
|
assertIsSuccessfulDeployStackResult(ret);
|
|
8392
8797
|
return ret;
|
|
8393
8798
|
}
|
|
@@ -8492,9 +8897,9 @@ function legacyBootstrapTemplate(params) {
|
|
|
8492
8897
|
|
|
8493
8898
|
// ../../aws-cdk/lib/api/bootstrap/bootstrap-environment.ts
|
|
8494
8899
|
var Bootstrapper = class {
|
|
8495
|
-
constructor(source = { source: "default" },
|
|
8900
|
+
constructor(source = { source: "default" }, ioHelper) {
|
|
8496
8901
|
this.source = source;
|
|
8497
|
-
this.
|
|
8902
|
+
this.ioHelper = ioHelper;
|
|
8498
8903
|
}
|
|
8499
8904
|
bootstrapEnvironment(environment, sdkProvider, options = {}) {
|
|
8500
8905
|
switch (this.source.source) {
|
|
@@ -8530,7 +8935,7 @@ var Bootstrapper = class {
|
|
|
8530
8935
|
throw new ToolkitError("--qualifier can only be passed for the modern bootstrap experience.");
|
|
8531
8936
|
}
|
|
8532
8937
|
const toolkitStackName = options.toolkitStackName ?? DEFAULT_TOOLKIT_STACK_NAME;
|
|
8533
|
-
const current = await BootstrapStack.lookup(sdkProvider, environment, toolkitStackName, this.
|
|
8938
|
+
const current = await BootstrapStack.lookup(sdkProvider, environment, toolkitStackName, this.ioHelper);
|
|
8534
8939
|
return current.update(
|
|
8535
8940
|
await this.loadTemplate(params),
|
|
8536
8941
|
{},
|
|
@@ -8548,7 +8953,7 @@ var Bootstrapper = class {
|
|
|
8548
8953
|
const params = options.parameters ?? {};
|
|
8549
8954
|
const bootstrapTemplate = await this.loadTemplate();
|
|
8550
8955
|
const toolkitStackName = options.toolkitStackName ?? DEFAULT_TOOLKIT_STACK_NAME;
|
|
8551
|
-
const current = await BootstrapStack.lookup(sdkProvider, environment, toolkitStackName, this.
|
|
8956
|
+
const current = await BootstrapStack.lookup(sdkProvider, environment, toolkitStackName, this.ioHelper);
|
|
8552
8957
|
const partition = await current.partition();
|
|
8553
8958
|
if (params.createCustomerMasterKey !== void 0 && params.kmsKeyId) {
|
|
8554
8959
|
throw new ToolkitError(
|
|
@@ -8575,8 +8980,7 @@ var Bootstrapper = class {
|
|
|
8575
8980
|
const cloudFormationExecutionPolicies = params.cloudFormationExecutionPolicies ?? splitCfnArray(current.parameters.CloudFormationExecutionPolicies);
|
|
8576
8981
|
if (trustedAccounts.length === 0 && cloudFormationExecutionPolicies.length === 0) {
|
|
8577
8982
|
const implicitPolicy = `arn:${partition}:iam::aws:policy/AdministratorAccess`;
|
|
8578
|
-
await this.
|
|
8579
|
-
this.msg.action,
|
|
8983
|
+
await this.ioHelper.notify(warn2(
|
|
8580
8984
|
`Using default execution policy of '${implicitPolicy}'. Pass '--cloudformation-execution-policies' to customize.`
|
|
8581
8985
|
));
|
|
8582
8986
|
} else if (cloudFormationExecutionPolicies.length === 0) {
|
|
@@ -8597,18 +9001,15 @@ var Bootstrapper = class {
|
|
|
8597
9001
|
}
|
|
8598
9002
|
if (currentPermissionsBoundary !== policyName) {
|
|
8599
9003
|
if (!currentPermissionsBoundary) {
|
|
8600
|
-
await this.
|
|
8601
|
-
this.msg.action,
|
|
9004
|
+
await this.ioHelper.notify(warn2(
|
|
8602
9005
|
`Adding new permissions boundary ${policyName}`
|
|
8603
9006
|
));
|
|
8604
9007
|
} else if (!policyName) {
|
|
8605
|
-
await this.
|
|
8606
|
-
this.msg.action,
|
|
9008
|
+
await this.ioHelper.notify(warn2(
|
|
8607
9009
|
`Removing existing permissions boundary ${currentPermissionsBoundary}`
|
|
8608
9010
|
));
|
|
8609
9011
|
} else {
|
|
8610
|
-
await this.
|
|
8611
|
-
this.msg.action,
|
|
9012
|
+
await this.ioHelper.notify(warn2(
|
|
8612
9013
|
`Changing permissions boundary from ${currentPermissionsBoundary} to ${policyName}`
|
|
8613
9014
|
));
|
|
8614
9015
|
}
|
|
@@ -8708,11 +9109,11 @@ var Bootstrapper = class {
|
|
|
8708
9109
|
}
|
|
8709
9110
|
]
|
|
8710
9111
|
};
|
|
8711
|
-
const
|
|
9112
|
+
const request2 = {
|
|
8712
9113
|
PolicyName: policyName,
|
|
8713
9114
|
PolicyDocument: JSON.stringify(policyDoc)
|
|
8714
9115
|
};
|
|
8715
|
-
const createPolicyResponse = await iam.createPolicy(
|
|
9116
|
+
const createPolicyResponse = await iam.createPolicy(request2);
|
|
8716
9117
|
if (createPolicyResponse.Policy?.Arn) {
|
|
8717
9118
|
return createPolicyResponse.Policy.Arn;
|
|
8718
9119
|
} else {
|
|
@@ -8777,8 +9178,8 @@ var AmiContextProviderPlugin = class {
|
|
|
8777
9178
|
async getValue(args) {
|
|
8778
9179
|
const region = args.region;
|
|
8779
9180
|
const account = args.account;
|
|
8780
|
-
|
|
8781
|
-
|
|
9181
|
+
info2(`Searching for AMI in ${account}:${region}`);
|
|
9182
|
+
debug2(`AMI search parameters: ${JSON.stringify(args)}`);
|
|
8782
9183
|
const ec2 = (await initContextProviderSdk(this.aws, args)).ec2();
|
|
8783
9184
|
const response = await ec2.describeImages({
|
|
8784
9185
|
Owners: args.owners,
|
|
@@ -8792,7 +9193,7 @@ var AmiContextProviderPlugin = class {
|
|
|
8792
9193
|
throw new ContextProviderError("No AMI found that matched the search criteria");
|
|
8793
9194
|
}
|
|
8794
9195
|
images.sort(descending((i) => Date.parse(i.CreationDate || "1970")));
|
|
8795
|
-
|
|
9196
|
+
debug2(`Selected image '${images[0].ImageId}' created at '${images[0].CreationDate}'`);
|
|
8796
9197
|
return images[0].ImageId;
|
|
8797
9198
|
}
|
|
8798
9199
|
};
|
|
@@ -8810,7 +9211,7 @@ var AZContextProviderPlugin = class {
|
|
|
8810
9211
|
async getValue(args) {
|
|
8811
9212
|
const region = args.region;
|
|
8812
9213
|
const account = args.account;
|
|
8813
|
-
|
|
9214
|
+
debug2(`Reading AZs for ${account}:${region}`);
|
|
8814
9215
|
const ec2 = (await initContextProviderSdk(this.aws, args)).ec2();
|
|
8815
9216
|
const response = await ec2.describeAvailabilityZones({});
|
|
8816
9217
|
if (!response.AvailabilityZones) {
|
|
@@ -8837,8 +9238,8 @@ var CcApiContextProviderPlugin = class {
|
|
|
8837
9238
|
*/
|
|
8838
9239
|
async getValue(args) {
|
|
8839
9240
|
const cloudControl = (await initContextProviderSdk(this.aws, args)).cloudControl();
|
|
8840
|
-
const
|
|
8841
|
-
return
|
|
9241
|
+
const result2 = await this.findResources(cloudControl, args);
|
|
9242
|
+
return result2;
|
|
8842
9243
|
}
|
|
8843
9244
|
async findResources(cc, args) {
|
|
8844
9245
|
if (args.exactIdentifier && args.propertyMatch) {
|
|
@@ -8863,14 +9264,14 @@ var CcApiContextProviderPlugin = class {
|
|
|
8863
9264
|
async getResource(cc, typeName, exactIdentifier, propertiesToReturn) {
|
|
8864
9265
|
const resultObjs = [];
|
|
8865
9266
|
try {
|
|
8866
|
-
const
|
|
9267
|
+
const result2 = await cc.getResource({
|
|
8867
9268
|
TypeName: typeName,
|
|
8868
9269
|
Identifier: exactIdentifier
|
|
8869
9270
|
});
|
|
8870
|
-
const id =
|
|
9271
|
+
const id = result2.ResourceDescription?.Identifier ?? "";
|
|
8871
9272
|
if (id !== "") {
|
|
8872
|
-
const propsObject = JSON.parse(
|
|
8873
|
-
const propsObj = getResultObj(propsObject,
|
|
9273
|
+
const propsObject = JSON.parse(result2.ResourceDescription?.Properties ?? "");
|
|
9274
|
+
const propsObj = getResultObj(propsObject, result2.ResourceDescription?.Identifier, propertiesToReturn);
|
|
8874
9275
|
resultObjs.push(propsObj);
|
|
8875
9276
|
} else {
|
|
8876
9277
|
throw new ContextProviderError(`Could not get resource ${exactIdentifier}.`);
|
|
@@ -8890,10 +9291,10 @@ var CcApiContextProviderPlugin = class {
|
|
|
8890
9291
|
async listResources(cc, typeName, propertyMatch, propertiesToReturn) {
|
|
8891
9292
|
const resultObjs = [];
|
|
8892
9293
|
try {
|
|
8893
|
-
const
|
|
9294
|
+
const result2 = await cc.listResources({
|
|
8894
9295
|
TypeName: typeName
|
|
8895
9296
|
});
|
|
8896
|
-
|
|
9297
|
+
result2.ResourceDescriptions?.forEach((resource) => {
|
|
8897
9298
|
const id = resource.Identifier ?? "";
|
|
8898
9299
|
if (id !== "") {
|
|
8899
9300
|
const propsObject = JSON.parse(resource.Properties ?? "");
|
|
@@ -8933,17 +9334,17 @@ var EndpointServiceAZContextProviderPlugin = class {
|
|
|
8933
9334
|
const region = args.region;
|
|
8934
9335
|
const account = args.account;
|
|
8935
9336
|
const serviceName = args.serviceName;
|
|
8936
|
-
|
|
9337
|
+
debug2(`Reading AZs for ${account}:${region}:${serviceName}`);
|
|
8937
9338
|
const ec2 = (await initContextProviderSdk(this.aws, args)).ec2();
|
|
8938
9339
|
const response = await ec2.describeVpcEndpointServices({
|
|
8939
9340
|
ServiceNames: [serviceName]
|
|
8940
9341
|
});
|
|
8941
9342
|
if (!response.ServiceDetails || response.ServiceDetails.length === 0) {
|
|
8942
|
-
|
|
9343
|
+
debug2(`Could not retrieve service details for ${account}:${region}:${serviceName}`);
|
|
8943
9344
|
return [];
|
|
8944
9345
|
}
|
|
8945
9346
|
const azs = response.ServiceDetails[0].AvailabilityZones;
|
|
8946
|
-
|
|
9347
|
+
debug2(`Endpoint service ${account}:${region}:${serviceName} is available in availability zones ${azs}`);
|
|
8947
9348
|
return azs;
|
|
8948
9349
|
}
|
|
8949
9350
|
};
|
|
@@ -8960,7 +9361,7 @@ var HostedZoneContextProviderPlugin = class {
|
|
|
8960
9361
|
throw new ContextProviderError(`HostedZoneProvider requires domainName property to be set in ${args}`);
|
|
8961
9362
|
}
|
|
8962
9363
|
const domainName = args.domainName;
|
|
8963
|
-
|
|
9364
|
+
debug2(`Reading hosted zone ${account}:${region}:${domainName}`);
|
|
8964
9365
|
const r53 = (await initContextProviderSdk(this.aws, args)).route53();
|
|
8965
9366
|
const response = await r53.listHostedZonesByName({ DNSName: domainName });
|
|
8966
9367
|
if (!response.HostedZones) {
|
|
@@ -8979,9 +9380,9 @@ var HostedZoneContextProviderPlugin = class {
|
|
|
8979
9380
|
async filterZones(r53, zones, props) {
|
|
8980
9381
|
let candidates = [];
|
|
8981
9382
|
const domainName = props.domainName.endsWith(".") ? props.domainName : `${props.domainName}.`;
|
|
8982
|
-
|
|
9383
|
+
debug2(`Found the following zones ${JSON.stringify(zones)}`);
|
|
8983
9384
|
candidates = zones.filter((zone) => zone.Name === domainName);
|
|
8984
|
-
|
|
9385
|
+
debug2(`Found the following matched name zones ${JSON.stringify(candidates)}`);
|
|
8985
9386
|
if (props.privateZone) {
|
|
8986
9387
|
candidates = candidates.filter((zone) => zone.Config && zone.Config.PrivateZone);
|
|
8987
9388
|
} else {
|
|
@@ -8992,7 +9393,7 @@ var HostedZoneContextProviderPlugin = class {
|
|
|
8992
9393
|
for (const zone of candidates) {
|
|
8993
9394
|
const data = await r53.getHostedZone({ Id: zone.Id });
|
|
8994
9395
|
if (!data.VPCs) {
|
|
8995
|
-
|
|
9396
|
+
debug2(`Expected VPC for private zone but no VPC found ${zone.Id}`);
|
|
8996
9397
|
continue;
|
|
8997
9398
|
}
|
|
8998
9399
|
if (data.VPCs.map((vpc) => vpc.VPCId).includes(props.vpcId)) {
|
|
@@ -9020,7 +9421,7 @@ var KeyContextProviderPlugin = class {
|
|
|
9020
9421
|
}
|
|
9021
9422
|
// TODO: use paginator function
|
|
9022
9423
|
async findKey(kms, args) {
|
|
9023
|
-
|
|
9424
|
+
debug2(`Listing keys in ${args.account}:${args.region}`);
|
|
9024
9425
|
let response;
|
|
9025
9426
|
let nextMarker;
|
|
9026
9427
|
do {
|
|
@@ -9047,7 +9448,7 @@ var KeyContextProviderPlugin = class {
|
|
|
9047
9448
|
if (!alias.TargetKeyId) {
|
|
9048
9449
|
throw new ContextProviderError(`Could not find any key with alias named ${args.aliasName}`);
|
|
9049
9450
|
}
|
|
9050
|
-
|
|
9451
|
+
debug2(`Key found ${alias.TargetKeyId}`);
|
|
9051
9452
|
return {
|
|
9052
9453
|
keyId: alias.TargetKeyId
|
|
9053
9454
|
};
|
|
@@ -9275,7 +9676,7 @@ var SSMContextProviderPlugin = class {
|
|
|
9275
9676
|
throw new ContextProviderError("parameterName must be provided in props for SSMContextProviderPlugin");
|
|
9276
9677
|
}
|
|
9277
9678
|
const parameterName = args.parameterName;
|
|
9278
|
-
|
|
9679
|
+
debug2(`Reading SSM parameter ${account}:${region}:${parameterName}`);
|
|
9279
9680
|
const response = await this.getSsmParameterValue(args);
|
|
9280
9681
|
const parameterNotFound = !response.Parameter || response.Parameter.Value === void 0;
|
|
9281
9682
|
const suppressError = "ignoreErrorOnMissingContext" in args && args.ignoreErrorOnMissingContext;
|
|
@@ -9324,7 +9725,7 @@ var VpcNetworkContextProviderPlugin = class {
|
|
|
9324
9725
|
}
|
|
9325
9726
|
async findVpc(ec2, args) {
|
|
9326
9727
|
const filters = Object.entries(args.filter).map(([tag, value]) => ({ Name: tag, Values: [value] }));
|
|
9327
|
-
|
|
9728
|
+
debug2(`Listing VPCs in ${args.account}:${args.region}`);
|
|
9328
9729
|
const response = await ec2.describeVpcs({ Filters: filters });
|
|
9329
9730
|
const vpcs = response.Vpcs || [];
|
|
9330
9731
|
if (vpcs.length === 0) {
|
|
@@ -9337,7 +9738,7 @@ var VpcNetworkContextProviderPlugin = class {
|
|
|
9337
9738
|
}
|
|
9338
9739
|
async readVpcProps(ec2, vpc, args) {
|
|
9339
9740
|
const vpcId = vpc.VpcId;
|
|
9340
|
-
|
|
9741
|
+
debug2(`Describing VPC ${vpcId}`);
|
|
9341
9742
|
const filters = { Filters: [{ Name: "vpc-id", Values: [vpcId] }] };
|
|
9342
9743
|
const subnetsResponse = await ec2.describeSubnets(filters);
|
|
9343
9744
|
const listedSubnets = subnetsResponse.Subnets || [];
|
|
@@ -9619,7 +10020,7 @@ async function provideContextValues(missingValues, context, sdk) {
|
|
|
9619
10020
|
value = { [cxapi4.PROVIDER_ERROR_KEY]: formatErrorMessage(e), [TRANSIENT_CONTEXT_KEY]: true };
|
|
9620
10021
|
}
|
|
9621
10022
|
context.set(key, value);
|
|
9622
|
-
|
|
10023
|
+
debug2(`Setting "${key}" context to ${JSON.stringify(value)}`);
|
|
9623
10024
|
}
|
|
9624
10025
|
}
|
|
9625
10026
|
function registerContextProvider(name, provider) {
|
|
@@ -9957,36 +10358,36 @@ var StackCollection = class _StackCollection {
|
|
|
9957
10358
|
let warnings = false;
|
|
9958
10359
|
let errors = false;
|
|
9959
10360
|
for (const stack of this.stackArtifacts) {
|
|
9960
|
-
for (const
|
|
9961
|
-
switch (
|
|
10361
|
+
for (const message2 of stack.messages) {
|
|
10362
|
+
switch (message2.level) {
|
|
9962
10363
|
case import_cx_api9.SynthesisMessageLevel.WARNING:
|
|
9963
10364
|
warnings = true;
|
|
9964
|
-
await logger("warn",
|
|
10365
|
+
await logger("warn", message2);
|
|
9965
10366
|
break;
|
|
9966
10367
|
case import_cx_api9.SynthesisMessageLevel.ERROR:
|
|
9967
10368
|
errors = true;
|
|
9968
|
-
await logger("error",
|
|
10369
|
+
await logger("error", message2);
|
|
9969
10370
|
break;
|
|
9970
10371
|
case import_cx_api9.SynthesisMessageLevel.INFO:
|
|
9971
|
-
await logger("info",
|
|
10372
|
+
await logger("info", message2);
|
|
9972
10373
|
break;
|
|
9973
10374
|
}
|
|
9974
10375
|
}
|
|
9975
10376
|
}
|
|
9976
10377
|
if (errors && failAt != "none") {
|
|
9977
|
-
throw
|
|
10378
|
+
throw AssemblyError.withStacks("Found errors", this.stackArtifacts);
|
|
9978
10379
|
}
|
|
9979
10380
|
if (warnings && failAt === "warn") {
|
|
9980
|
-
throw
|
|
10381
|
+
throw AssemblyError.withStacks("Found warnings (--strict mode)", this.stackArtifacts);
|
|
9981
10382
|
}
|
|
9982
10383
|
}
|
|
9983
10384
|
};
|
|
9984
10385
|
function indexByHierarchicalId(stacks) {
|
|
9985
|
-
const
|
|
10386
|
+
const result2 = /* @__PURE__ */ new Map();
|
|
9986
10387
|
for (const stack of stacks) {
|
|
9987
|
-
|
|
10388
|
+
result2.set(stack.hierarchicalId, stack);
|
|
9988
10389
|
}
|
|
9989
|
-
return
|
|
10390
|
+
return result2;
|
|
9990
10391
|
}
|
|
9991
10392
|
function includeDownstreamStacks(selectedStacks, allStacks) {
|
|
9992
10393
|
const added = new Array();
|
|
@@ -10002,7 +10403,7 @@ function includeDownstreamStacks(selectedStacks, allStacks) {
|
|
|
10002
10403
|
}
|
|
10003
10404
|
} while (madeProgress);
|
|
10004
10405
|
if (added.length > 0) {
|
|
10005
|
-
|
|
10406
|
+
info2("Including depending stacks: %s", chalk16.bold(added.join(", ")));
|
|
10006
10407
|
}
|
|
10007
10408
|
}
|
|
10008
10409
|
function includeUpstreamStacks(selectedStacks, allStacks) {
|
|
@@ -10021,7 +10422,7 @@ function includeUpstreamStacks(selectedStacks, allStacks) {
|
|
|
10021
10422
|
}
|
|
10022
10423
|
}
|
|
10023
10424
|
if (added.length > 0) {
|
|
10024
|
-
|
|
10425
|
+
info2("Including dependency stacks: %s", chalk16.bold(added.join(", ")));
|
|
10025
10426
|
}
|
|
10026
10427
|
}
|
|
10027
10428
|
function sanitizePatterns(patterns) {
|
|
@@ -10036,7 +10437,7 @@ var cxschema4 = __toESM(require("@aws-cdk/cloud-assembly-schema"));
|
|
|
10036
10437
|
var cxapi5 = __toESM(require("@aws-cdk/cx-api"));
|
|
10037
10438
|
var fs16 = __toESM(require("fs-extra"));
|
|
10038
10439
|
var semver6 = __toESM(require("semver"));
|
|
10039
|
-
async function prepareDefaultEnvironment(aws, logFn =
|
|
10440
|
+
async function prepareDefaultEnvironment(aws, logFn = debug2) {
|
|
10040
10441
|
const env = {};
|
|
10041
10442
|
env[cxapi5.DEFAULT_REGION_ENV] = aws.defaultRegion;
|
|
10042
10443
|
await logFn(`Setting "${cxapi5.DEFAULT_REGION_ENV}" environment variable to`, env[cxapi5.DEFAULT_REGION_ENV]);
|
|
@@ -10073,7 +10474,7 @@ async function prepareContext(settings, context, env) {
|
|
|
10073
10474
|
}
|
|
10074
10475
|
const bundlingStacks = settings.get(["bundlingStacks"]) ?? ["**"];
|
|
10075
10476
|
context[cxapi5.BUNDLING_STACKS] = bundlingStacks;
|
|
10076
|
-
|
|
10477
|
+
debug2("context:", context);
|
|
10077
10478
|
return context;
|
|
10078
10479
|
}
|
|
10079
10480
|
function appToArray(app) {
|
|
@@ -10092,7 +10493,7 @@ async function guessExecutable(app) {
|
|
|
10092
10493
|
try {
|
|
10093
10494
|
fstat = await fs16.stat(commandLine[0]);
|
|
10094
10495
|
} catch {
|
|
10095
|
-
|
|
10496
|
+
debug2(`Not a file: '${commandLine[0]}'. Using '${commandLine}' as command-line`);
|
|
10096
10497
|
return commandLine;
|
|
10097
10498
|
}
|
|
10098
10499
|
const isExecutable = (fstat.mode & fs16.constants.X_OK) !== 0;
|
|
@@ -10131,7 +10532,6 @@ function spaceAvailableForContext(env, limit) {
|
|
|
10131
10532
|
WorkGraphBuilder,
|
|
10132
10533
|
contextproviders,
|
|
10133
10534
|
findCloudWatchLogGroups,
|
|
10134
|
-
formatSdkLoggerContent,
|
|
10135
10535
|
guessExecutable,
|
|
10136
10536
|
loadTree,
|
|
10137
10537
|
prepareContext,
|