@aws-cdk/toolkit-lib 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +2 -16
- package/lib/actions/deploy/index.js +2 -17
- 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 +1419 -738
- 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 +814 -26
- package/lib/api/shared-private.js.map +4 -4
- package/lib/api/shared-public.d.ts +2519 -31
- package/lib/api/shared-public.js +88 -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 +22 -7
- 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 +149 -123
- package/lib/util/concurrency.d.ts +1 -1
- package/lib/util/concurrency.js +2 -2
- package/package.json +5 -5
- 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,
|
|
@@ -99,19 +98,19 @@ var path2 = __toESM(require("path"));
|
|
|
99
98
|
var fs3 = __toESM(require("fs-extra"));
|
|
100
99
|
|
|
101
100
|
// ../../aws-cdk/lib/logging.ts
|
|
102
|
-
var util4 = __toESM(require("util"));
|
|
103
101
|
var chalk4 = __toESM(require("chalk"));
|
|
104
102
|
|
|
105
103
|
// ../../aws-cdk/lib/toolkit/cli-io-host.ts
|
|
106
|
-
var
|
|
104
|
+
var util5 = __toESM(require("node:util"));
|
|
105
|
+
var import_cloud_assembly_schema = require("@aws-cdk/cloud-assembly-schema");
|
|
107
106
|
var chalk3 = __toESM(require("chalk"));
|
|
108
107
|
var promptly = __toESM(require("promptly"));
|
|
109
108
|
|
|
110
109
|
// ../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");
|
|
110
|
+
var TOOLKIT_ERROR_SYMBOL = Symbol.for("@aws-cdk/toolkit-lib.ToolkitError");
|
|
111
|
+
var AUTHENTICATION_ERROR_SYMBOL = Symbol.for("@aws-cdk/toolkit-lib.AuthenticationError");
|
|
112
|
+
var ASSEMBLY_ERROR_SYMBOL = Symbol.for("@aws-cdk/toolkit-lib.AssemblyError");
|
|
113
|
+
var CONTEXT_PROVIDER_ERROR_SYMBOL = Symbol.for("@aws-cdk/toolkit-lib.ContextProviderError");
|
|
115
114
|
var ToolkitError = class _ToolkitError extends Error {
|
|
116
115
|
/**
|
|
117
116
|
* Determines if a given error is an instance of ToolkitError.
|
|
@@ -141,46 +140,92 @@ var ToolkitError = class _ToolkitError extends Error {
|
|
|
141
140
|
* The type of the error, defaults to "toolkit".
|
|
142
141
|
*/
|
|
143
142
|
type;
|
|
144
|
-
|
|
145
|
-
|
|
143
|
+
/**
|
|
144
|
+
* Denotes the source of the error as the toolkit.
|
|
145
|
+
*/
|
|
146
|
+
source;
|
|
147
|
+
constructor(message2, type = "toolkit") {
|
|
148
|
+
super(message2);
|
|
146
149
|
Object.setPrototypeOf(this, _ToolkitError.prototype);
|
|
147
150
|
Object.defineProperty(this, TOOLKIT_ERROR_SYMBOL, { value: true });
|
|
148
151
|
this.name = new.target.name;
|
|
149
152
|
this.type = type;
|
|
153
|
+
this.source = "toolkit";
|
|
150
154
|
}
|
|
151
155
|
};
|
|
152
156
|
var AuthenticationError = class _AuthenticationError extends ToolkitError {
|
|
153
|
-
|
|
154
|
-
|
|
157
|
+
/**
|
|
158
|
+
* Denotes the source of the error as user.
|
|
159
|
+
*/
|
|
160
|
+
source = "user";
|
|
161
|
+
constructor(message2) {
|
|
162
|
+
super(message2, "authentication");
|
|
155
163
|
Object.setPrototypeOf(this, _AuthenticationError.prototype);
|
|
156
164
|
Object.defineProperty(this, AUTHENTICATION_ERROR_SYMBOL, { value: true });
|
|
157
165
|
}
|
|
158
166
|
};
|
|
159
167
|
var AssemblyError = class _AssemblyError extends ToolkitError {
|
|
160
|
-
|
|
161
|
-
|
|
168
|
+
/**
|
|
169
|
+
* An AssemblyError with an original error as cause
|
|
170
|
+
*/
|
|
171
|
+
static withCause(message2, error4) {
|
|
172
|
+
return new _AssemblyError(message2, void 0, error4);
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* An AssemblyError with a list of stacks as cause
|
|
176
|
+
*/
|
|
177
|
+
static withStacks(message2, stacks) {
|
|
178
|
+
return new _AssemblyError(message2, stacks);
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Denotes the source of the error as user.
|
|
182
|
+
*/
|
|
183
|
+
source = "user";
|
|
184
|
+
/**
|
|
185
|
+
* The stacks that caused the error, if available
|
|
186
|
+
*
|
|
187
|
+
* The `messages` property of each `cxapi.CloudFormationStackArtifact` will contain the respective errors.
|
|
188
|
+
* Absence indicates synthesis didn't fully complete.
|
|
189
|
+
*/
|
|
190
|
+
stacks;
|
|
191
|
+
/**
|
|
192
|
+
* The specific original cause of the error, if available
|
|
193
|
+
*/
|
|
194
|
+
cause;
|
|
195
|
+
constructor(message2, stacks, cause) {
|
|
196
|
+
super(message2, "assembly");
|
|
162
197
|
Object.setPrototypeOf(this, _AssemblyError.prototype);
|
|
163
198
|
Object.defineProperty(this, ASSEMBLY_ERROR_SYMBOL, { value: true });
|
|
199
|
+
this.stacks = stacks;
|
|
200
|
+
this.cause = cause;
|
|
164
201
|
}
|
|
165
202
|
};
|
|
166
203
|
var ContextProviderError = class _ContextProviderError extends ToolkitError {
|
|
167
|
-
|
|
168
|
-
|
|
204
|
+
/**
|
|
205
|
+
* Denotes the source of the error as user.
|
|
206
|
+
*/
|
|
207
|
+
source = "user";
|
|
208
|
+
constructor(message2) {
|
|
209
|
+
super(message2, "context-provider");
|
|
169
210
|
Object.setPrototypeOf(this, _ContextProviderError.prototype);
|
|
170
211
|
Object.defineProperty(this, CONTEXT_PROVIDER_ERROR_SYMBOL, { value: true });
|
|
171
212
|
}
|
|
172
213
|
};
|
|
173
214
|
|
|
215
|
+
// ../tmp-toolkit-helpers/src/api/io/private/span.ts
|
|
216
|
+
var util = __toESM(require("node:util"));
|
|
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";
|
|
@@ -368,6 +401,9 @@ function deepSet(x, path15, value) {
|
|
|
368
401
|
}
|
|
369
402
|
while (path15.length > 1 && isObject(x)) {
|
|
370
403
|
const key = path15.shift();
|
|
404
|
+
if (isPrototypePollutingKey(key)) {
|
|
405
|
+
continue;
|
|
406
|
+
}
|
|
371
407
|
if (!(key in x)) {
|
|
372
408
|
x[key] = {};
|
|
373
409
|
}
|
|
@@ -376,16 +412,23 @@ function deepSet(x, path15, value) {
|
|
|
376
412
|
if (!isObject(x)) {
|
|
377
413
|
throw new ToolkitError(`Expected an object, got '${x}'`);
|
|
378
414
|
}
|
|
415
|
+
const finalKey = path15[0];
|
|
416
|
+
if (isPrototypePollutingKey(finalKey)) {
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
379
419
|
if (value !== void 0) {
|
|
380
|
-
x[
|
|
420
|
+
x[finalKey] = value;
|
|
381
421
|
} else {
|
|
382
|
-
delete x[
|
|
422
|
+
delete x[finalKey];
|
|
383
423
|
}
|
|
384
424
|
}
|
|
425
|
+
function isPrototypePollutingKey(key) {
|
|
426
|
+
return key === "__proto__" || key === "constructor" || key === "prototype";
|
|
427
|
+
}
|
|
385
428
|
function deepMerge(...objects) {
|
|
386
429
|
function mergeOne(target, source) {
|
|
387
430
|
for (const key of Object.keys(source)) {
|
|
388
|
-
if (key
|
|
431
|
+
if (isPrototypePollutingKey(key)) {
|
|
389
432
|
continue;
|
|
390
433
|
}
|
|
391
434
|
const value = source[key];
|
|
@@ -412,20 +455,20 @@ function deepMerge(...objects) {
|
|
|
412
455
|
async function parallelPromises(n, promises) {
|
|
413
456
|
const ret = new Array();
|
|
414
457
|
let count = 0;
|
|
415
|
-
let
|
|
458
|
+
let error4;
|
|
416
459
|
const queue = [...promises];
|
|
417
460
|
return new Promise((ok, ko) => {
|
|
418
461
|
tick();
|
|
419
462
|
function tick() {
|
|
420
|
-
if (count === 0 &&
|
|
421
|
-
ko(
|
|
463
|
+
if (count === 0 && error4) {
|
|
464
|
+
ko(error4);
|
|
422
465
|
return;
|
|
423
466
|
}
|
|
424
467
|
if (count === 0 && queue.length === 0) {
|
|
425
468
|
ok(ret);
|
|
426
469
|
return;
|
|
427
470
|
}
|
|
428
|
-
while (count < n && queue.length > 0 && !
|
|
471
|
+
while (count < n && queue.length > 0 && !error4) {
|
|
429
472
|
const next = queue.shift();
|
|
430
473
|
if (next !== void 0) {
|
|
431
474
|
start(next);
|
|
@@ -434,10 +477,10 @@ async function parallelPromises(n, promises) {
|
|
|
434
477
|
}
|
|
435
478
|
function start(fn) {
|
|
436
479
|
count += 1;
|
|
437
|
-
fn().then((
|
|
438
|
-
ret.push(
|
|
480
|
+
fn().then((result2) => {
|
|
481
|
+
ret.push(result2);
|
|
439
482
|
}).catch((e) => {
|
|
440
|
-
|
|
483
|
+
error4 = e;
|
|
441
484
|
}).finally(() => {
|
|
442
485
|
count -= 1;
|
|
443
486
|
tick();
|
|
@@ -524,15 +567,6 @@ async function loadStructuredFile(fileName) {
|
|
|
524
567
|
const contents = await fs2.readFile(fileName, { encoding: "utf-8" });
|
|
525
568
|
return deserializeStructure(contents);
|
|
526
569
|
}
|
|
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
570
|
|
|
537
571
|
// ../tmp-toolkit-helpers/src/util/string-manipulation.ts
|
|
538
572
|
function padLeft(n, x, char = " ") {
|
|
@@ -554,6 +588,669 @@ function millisecondsToSeconds(num) {
|
|
|
554
588
|
// ../tmp-toolkit-helpers/src/util/version-range.ts
|
|
555
589
|
var semver = __toESM(require("semver"));
|
|
556
590
|
|
|
591
|
+
// ../tmp-toolkit-helpers/src/api/io/private/span.ts
|
|
592
|
+
var SpanMaker = class {
|
|
593
|
+
definition;
|
|
594
|
+
ioHelper;
|
|
595
|
+
constructor(ioHelper, definition) {
|
|
596
|
+
this.definition = definition;
|
|
597
|
+
this.ioHelper = ioHelper;
|
|
598
|
+
}
|
|
599
|
+
async begin(a, b) {
|
|
600
|
+
const spanId = uuid.v4();
|
|
601
|
+
const startTime = (/* @__PURE__ */ new Date()).getTime();
|
|
602
|
+
const notify = (msg) => {
|
|
603
|
+
return this.ioHelper.notify(withSpanId(spanId, msg));
|
|
604
|
+
};
|
|
605
|
+
const startInput = parseArgs(a, b);
|
|
606
|
+
const startMsg = startInput.message ?? `Starting ${this.definition.name} ...`;
|
|
607
|
+
const startPayload = startInput.payload;
|
|
608
|
+
await notify(this.definition.start.msg(
|
|
609
|
+
startMsg,
|
|
610
|
+
startPayload
|
|
611
|
+
));
|
|
612
|
+
const timingMsgTemplate = "\n\u2728 %s time: %ds\n";
|
|
613
|
+
const time = () => {
|
|
614
|
+
const elapsedTime = (/* @__PURE__ */ new Date()).getTime() - startTime;
|
|
615
|
+
return {
|
|
616
|
+
asMs: elapsedTime,
|
|
617
|
+
asSec: formatTime(elapsedTime)
|
|
618
|
+
};
|
|
619
|
+
};
|
|
620
|
+
return {
|
|
621
|
+
elapsedTime: async () => {
|
|
622
|
+
return time();
|
|
623
|
+
},
|
|
624
|
+
notify: async (msg) => {
|
|
625
|
+
await notify(msg);
|
|
626
|
+
},
|
|
627
|
+
timing: async (maker, message2) => {
|
|
628
|
+
const duration = time();
|
|
629
|
+
const timingMsg = message2 ? message2 : util.format(timingMsgTemplate, this.definition.name, duration.asSec);
|
|
630
|
+
await notify(maker.msg(timingMsg, {
|
|
631
|
+
duration: duration.asMs
|
|
632
|
+
}));
|
|
633
|
+
return duration;
|
|
634
|
+
},
|
|
635
|
+
end: async (x, y) => {
|
|
636
|
+
const duration = time();
|
|
637
|
+
const endInput = parseArgs(x, y);
|
|
638
|
+
const endMsg = endInput.message ?? util.format(timingMsgTemplate, this.definition.name, duration.asSec);
|
|
639
|
+
const endPayload = endInput.payload;
|
|
640
|
+
await notify(this.definition.end.msg(
|
|
641
|
+
endMsg,
|
|
642
|
+
{
|
|
643
|
+
duration: duration.asMs,
|
|
644
|
+
...endPayload
|
|
645
|
+
}
|
|
646
|
+
));
|
|
647
|
+
return duration;
|
|
648
|
+
}
|
|
649
|
+
};
|
|
650
|
+
}
|
|
651
|
+
};
|
|
652
|
+
function parseArgs(first, second) {
|
|
653
|
+
const firstIsMessage = typeof first === "string";
|
|
654
|
+
const message2 = firstIsMessage || second ? first : void 0;
|
|
655
|
+
const payload = firstIsMessage || second ? second : first;
|
|
656
|
+
return {
|
|
657
|
+
message: message2,
|
|
658
|
+
payload
|
|
659
|
+
};
|
|
660
|
+
}
|
|
661
|
+
function withSpanId(span, message2) {
|
|
662
|
+
return {
|
|
663
|
+
...message2,
|
|
664
|
+
span
|
|
665
|
+
};
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
// ../tmp-toolkit-helpers/src/api/io/private/io-helper.ts
|
|
669
|
+
var IoHelper = class _IoHelper {
|
|
670
|
+
static fromIoHost(ioHost, action) {
|
|
671
|
+
return new _IoHelper(ioHost, action);
|
|
672
|
+
}
|
|
673
|
+
ioHost;
|
|
674
|
+
action;
|
|
675
|
+
constructor(ioHost, action) {
|
|
676
|
+
this.ioHost = ioHost;
|
|
677
|
+
this.action = action;
|
|
678
|
+
}
|
|
679
|
+
/**
|
|
680
|
+
* Forward a message to the IoHost, while injection the current action
|
|
681
|
+
*/
|
|
682
|
+
notify(msg) {
|
|
683
|
+
return this.ioHost.notify({
|
|
684
|
+
...msg,
|
|
685
|
+
action: this.action
|
|
686
|
+
});
|
|
687
|
+
}
|
|
688
|
+
/**
|
|
689
|
+
* Forward a request to the IoHost, while injection the current action
|
|
690
|
+
*/
|
|
691
|
+
requestResponse(msg) {
|
|
692
|
+
return this.ioHost.requestResponse({
|
|
693
|
+
...msg,
|
|
694
|
+
action: this.action
|
|
695
|
+
});
|
|
696
|
+
}
|
|
697
|
+
/**
|
|
698
|
+
* Create a new marker from a given registry entry
|
|
699
|
+
*/
|
|
700
|
+
span(definition) {
|
|
701
|
+
return new SpanMaker(this, definition);
|
|
702
|
+
}
|
|
703
|
+
};
|
|
704
|
+
function asIoHelper(ioHost, action) {
|
|
705
|
+
return IoHelper.fromIoHost(ioHost, action);
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
// ../tmp-toolkit-helpers/src/api/io/private/level-priority.ts
|
|
709
|
+
var levels = [
|
|
710
|
+
"trace",
|
|
711
|
+
"debug",
|
|
712
|
+
"info",
|
|
713
|
+
"warn",
|
|
714
|
+
"result",
|
|
715
|
+
"error"
|
|
716
|
+
];
|
|
717
|
+
var orderedLevels = Object.fromEntries(Object.entries(levels).map((a) => a.reverse()));
|
|
718
|
+
function compareFn(a, b) {
|
|
719
|
+
return orderedLevels[a] - orderedLevels[b];
|
|
720
|
+
}
|
|
721
|
+
function isMessageRelevantForLevel(msg, level) {
|
|
722
|
+
return compareFn(msg.level, level) >= 0;
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
// ../tmp-toolkit-helpers/src/api/io/private/message-maker.ts
|
|
726
|
+
function message(level, details) {
|
|
727
|
+
const maker = (text, data) => ({
|
|
728
|
+
time: /* @__PURE__ */ new Date(),
|
|
729
|
+
level,
|
|
730
|
+
code: details.code,
|
|
731
|
+
message: text,
|
|
732
|
+
data
|
|
733
|
+
});
|
|
734
|
+
return {
|
|
735
|
+
...details,
|
|
736
|
+
level,
|
|
737
|
+
msg: maker,
|
|
738
|
+
is: (m) => m.code === details.code
|
|
739
|
+
};
|
|
740
|
+
}
|
|
741
|
+
var trace = (details) => message("trace", details);
|
|
742
|
+
var debug = (details) => message("debug", details);
|
|
743
|
+
var info = (details) => message("info", details);
|
|
744
|
+
var warn = (details) => message("warn", details);
|
|
745
|
+
var error = (details) => message("error", details);
|
|
746
|
+
var result = (details) => message("result", details);
|
|
747
|
+
function request(level, details) {
|
|
748
|
+
const maker = (text, data) => ({
|
|
749
|
+
time: /* @__PURE__ */ new Date(),
|
|
750
|
+
level,
|
|
751
|
+
code: details.code,
|
|
752
|
+
message: text,
|
|
753
|
+
data,
|
|
754
|
+
defaultResponse: details.defaultResponse
|
|
755
|
+
});
|
|
756
|
+
return {
|
|
757
|
+
...details,
|
|
758
|
+
level,
|
|
759
|
+
req: maker
|
|
760
|
+
};
|
|
761
|
+
}
|
|
762
|
+
var confirm = (details) => request("info", {
|
|
763
|
+
...details,
|
|
764
|
+
defaultResponse: true
|
|
765
|
+
});
|
|
766
|
+
|
|
767
|
+
// ../tmp-toolkit-helpers/src/api/io/private/messages.ts
|
|
768
|
+
var IO = {
|
|
769
|
+
// Defaults (0000)
|
|
770
|
+
DEFAULT_TOOLKIT_INFO: info({
|
|
771
|
+
code: "CDK_TOOLKIT_I0000",
|
|
772
|
+
description: "Default info messages emitted from the Toolkit"
|
|
773
|
+
}),
|
|
774
|
+
DEFAULT_TOOLKIT_DEBUG: debug({
|
|
775
|
+
code: "CDK_TOOLKIT_I0000",
|
|
776
|
+
description: "Default debug messages emitted from the Toolkit"
|
|
777
|
+
}),
|
|
778
|
+
DEFAULT_TOOLKIT_WARN: warn({
|
|
779
|
+
code: "CDK_TOOLKIT_W0000",
|
|
780
|
+
description: "Default warning messages emitted from the Toolkit"
|
|
781
|
+
}),
|
|
782
|
+
DEFAULT_TOOLKIT_ERROR: error({
|
|
783
|
+
code: "CDK_TOOLKIT_E0000",
|
|
784
|
+
description: "Default error messages emitted from the Toolkit"
|
|
785
|
+
}),
|
|
786
|
+
DEFAULT_TOOLKIT_TRACE: trace({
|
|
787
|
+
code: "CDK_TOOLKIT_I0000",
|
|
788
|
+
description: "Default trace messages emitted from the Toolkit"
|
|
789
|
+
}),
|
|
790
|
+
// 1: Synth (1xxx)
|
|
791
|
+
CDK_TOOLKIT_I1000: info({
|
|
792
|
+
code: "CDK_TOOLKIT_I1000",
|
|
793
|
+
description: "Provides synthesis times.",
|
|
794
|
+
interface: "Duration"
|
|
795
|
+
}),
|
|
796
|
+
CDK_TOOLKIT_I1001: trace({
|
|
797
|
+
code: "CDK_TOOLKIT_I1001",
|
|
798
|
+
description: "Cloud Assembly synthesis is starting",
|
|
799
|
+
interface: "StackSelectionDetails"
|
|
800
|
+
}),
|
|
801
|
+
CDK_TOOLKIT_I1901: result({
|
|
802
|
+
code: "CDK_TOOLKIT_I1901",
|
|
803
|
+
description: "Provides stack data",
|
|
804
|
+
interface: "StackAndAssemblyData"
|
|
805
|
+
}),
|
|
806
|
+
CDK_TOOLKIT_I1902: result({
|
|
807
|
+
code: "CDK_TOOLKIT_I1902",
|
|
808
|
+
description: "Successfully deployed stacks",
|
|
809
|
+
interface: "AssemblyData"
|
|
810
|
+
}),
|
|
811
|
+
// 2: List (2xxx)
|
|
812
|
+
CDK_TOOLKIT_I2901: result({
|
|
813
|
+
code: "CDK_TOOLKIT_I2901",
|
|
814
|
+
description: "Provides details on the selected stacks and their dependencies",
|
|
815
|
+
interface: "StackDetailsPayload"
|
|
816
|
+
}),
|
|
817
|
+
// 3: Import & Migrate
|
|
818
|
+
CDK_TOOLKIT_E3900: error({
|
|
819
|
+
code: "CDK_TOOLKIT_E3900",
|
|
820
|
+
description: "Resource import failed"
|
|
821
|
+
}),
|
|
822
|
+
// 4: Diff (4xxx)
|
|
823
|
+
// 5: Deploy & Watch (5xxx)
|
|
824
|
+
CDK_TOOLKIT_I5000: info({
|
|
825
|
+
code: "CDK_TOOLKIT_I5000",
|
|
826
|
+
description: "Provides deployment times",
|
|
827
|
+
interface: "Duration"
|
|
828
|
+
}),
|
|
829
|
+
CDK_TOOLKIT_I5001: info({
|
|
830
|
+
code: "CDK_TOOLKIT_I5001",
|
|
831
|
+
description: "Provides total time in deploy action, including synth and rollback",
|
|
832
|
+
interface: "Duration"
|
|
833
|
+
}),
|
|
834
|
+
CDK_TOOLKIT_I5002: info({
|
|
835
|
+
code: "CDK_TOOLKIT_I5002",
|
|
836
|
+
description: "Provides time for resource migration"
|
|
837
|
+
}),
|
|
838
|
+
CDK_TOOLKIT_W5021: warn({
|
|
839
|
+
code: "CDK_TOOLKIT_W5021",
|
|
840
|
+
description: "Empty non-existent stack, deployment is skipped"
|
|
841
|
+
}),
|
|
842
|
+
CDK_TOOLKIT_W5022: warn({
|
|
843
|
+
code: "CDK_TOOLKIT_W5022",
|
|
844
|
+
description: "Empty existing stack, stack will be destroyed"
|
|
845
|
+
}),
|
|
846
|
+
CDK_TOOLKIT_I5031: info({
|
|
847
|
+
code: "CDK_TOOLKIT_I5031",
|
|
848
|
+
description: "Informs about any log groups that are traced as part of the deployment"
|
|
849
|
+
}),
|
|
850
|
+
CDK_TOOLKIT_I5032: debug({
|
|
851
|
+
code: "CDK_TOOLKIT_I5032",
|
|
852
|
+
description: "Start monitoring log groups",
|
|
853
|
+
interface: "CloudWatchLogMonitorControlEvent"
|
|
854
|
+
}),
|
|
855
|
+
CDK_TOOLKIT_I5033: info({
|
|
856
|
+
code: "CDK_TOOLKIT_I5033",
|
|
857
|
+
description: "A log event received from Cloud Watch",
|
|
858
|
+
interface: "CloudWatchLogEvent"
|
|
859
|
+
}),
|
|
860
|
+
CDK_TOOLKIT_I5034: debug({
|
|
861
|
+
code: "CDK_TOOLKIT_I5034",
|
|
862
|
+
description: "Stop monitoring log groups",
|
|
863
|
+
interface: "CloudWatchLogMonitorControlEvent"
|
|
864
|
+
}),
|
|
865
|
+
CDK_TOOLKIT_E5035: error({
|
|
866
|
+
code: "CDK_TOOLKIT_E5035",
|
|
867
|
+
description: "A log monitoring error",
|
|
868
|
+
interface: "ErrorPayload"
|
|
869
|
+
}),
|
|
870
|
+
CDK_TOOLKIT_I5050: confirm({
|
|
871
|
+
code: "CDK_TOOLKIT_I5050",
|
|
872
|
+
description: "Confirm rollback during deployment",
|
|
873
|
+
interface: "ConfirmationRequest"
|
|
874
|
+
}),
|
|
875
|
+
CDK_TOOLKIT_I5060: confirm({
|
|
876
|
+
code: "CDK_TOOLKIT_I5060",
|
|
877
|
+
description: "Confirm deploy security sensitive changes",
|
|
878
|
+
interface: "DeployConfirmationRequest"
|
|
879
|
+
}),
|
|
880
|
+
CDK_TOOLKIT_I5100: info({
|
|
881
|
+
code: "CDK_TOOLKIT_I5100",
|
|
882
|
+
description: "Stack deploy progress",
|
|
883
|
+
interface: "StackDeployProgress"
|
|
884
|
+
}),
|
|
885
|
+
// Assets (52xx)
|
|
886
|
+
CDK_TOOLKIT_I5210: trace({
|
|
887
|
+
code: "CDK_TOOLKIT_I5210",
|
|
888
|
+
description: "Started building a specific asset",
|
|
889
|
+
interface: "BuildAsset"
|
|
890
|
+
}),
|
|
891
|
+
CDK_TOOLKIT_I5211: trace({
|
|
892
|
+
code: "CDK_TOOLKIT_I5211",
|
|
893
|
+
description: "Building the asset has completed",
|
|
894
|
+
interface: "Duration"
|
|
895
|
+
}),
|
|
896
|
+
CDK_TOOLKIT_I5220: trace({
|
|
897
|
+
code: "CDK_TOOLKIT_I5220",
|
|
898
|
+
description: "Started publishing a specific asset",
|
|
899
|
+
interface: "PublishAsset"
|
|
900
|
+
}),
|
|
901
|
+
CDK_TOOLKIT_I5221: trace({
|
|
902
|
+
code: "CDK_TOOLKIT_I5221",
|
|
903
|
+
description: "Publishing the asset has completed",
|
|
904
|
+
interface: "Duration"
|
|
905
|
+
}),
|
|
906
|
+
// Watch (53xx)
|
|
907
|
+
CDK_TOOLKIT_I5310: debug({
|
|
908
|
+
code: "CDK_TOOLKIT_I5310",
|
|
909
|
+
description: "The computed settings used for file watching",
|
|
910
|
+
interface: "WatchSettings"
|
|
911
|
+
}),
|
|
912
|
+
CDK_TOOLKIT_I5311: info({
|
|
913
|
+
code: "CDK_TOOLKIT_I5311",
|
|
914
|
+
description: "File watching started",
|
|
915
|
+
interface: "FileWatchEvent"
|
|
916
|
+
}),
|
|
917
|
+
CDK_TOOLKIT_I5312: info({
|
|
918
|
+
code: "CDK_TOOLKIT_I5312",
|
|
919
|
+
description: "File event detected, starting deployment",
|
|
920
|
+
interface: "FileWatchEvent"
|
|
921
|
+
}),
|
|
922
|
+
CDK_TOOLKIT_I5313: info({
|
|
923
|
+
code: "CDK_TOOLKIT_I5313",
|
|
924
|
+
description: "File event detected during active deployment, changes are queued",
|
|
925
|
+
interface: "FileWatchEvent"
|
|
926
|
+
}),
|
|
927
|
+
CDK_TOOLKIT_I5314: info({
|
|
928
|
+
code: "CDK_TOOLKIT_I5314",
|
|
929
|
+
description: "Initial watch deployment started"
|
|
930
|
+
}),
|
|
931
|
+
CDK_TOOLKIT_I5315: info({
|
|
932
|
+
code: "CDK_TOOLKIT_I5315",
|
|
933
|
+
description: "Queued watch deployment started"
|
|
934
|
+
}),
|
|
935
|
+
// Hotswap (54xx)
|
|
936
|
+
CDK_TOOLKIT_I5400: trace({
|
|
937
|
+
code: "CDK_TOOLKIT_I5400",
|
|
938
|
+
description: "Starting a hotswap deployment",
|
|
939
|
+
interface: "HotswapDeployment"
|
|
940
|
+
}),
|
|
941
|
+
CDK_TOOLKIT_I5410: info({
|
|
942
|
+
code: "CDK_TOOLKIT_I5410",
|
|
943
|
+
description: "Hotswap deployment has ended, a full deployment might still follow if needed",
|
|
944
|
+
interface: "Duration"
|
|
945
|
+
}),
|
|
946
|
+
// Stack Monitor (55xx)
|
|
947
|
+
CDK_TOOLKIT_I5501: info({
|
|
948
|
+
code: "CDK_TOOLKIT_I5501",
|
|
949
|
+
description: "Stack Monitoring: Start monitoring of a single stack",
|
|
950
|
+
interface: "StackMonitoringControlEvent"
|
|
951
|
+
}),
|
|
952
|
+
CDK_TOOLKIT_I5502: info({
|
|
953
|
+
code: "CDK_TOOLKIT_I5502",
|
|
954
|
+
description: "Stack Monitoring: Activity event for a single stack",
|
|
955
|
+
interface: "StackActivity"
|
|
956
|
+
}),
|
|
957
|
+
CDK_TOOLKIT_I5503: info({
|
|
958
|
+
code: "CDK_TOOLKIT_I5503",
|
|
959
|
+
description: "Stack Monitoring: Finished monitoring of a single stack",
|
|
960
|
+
interface: "StackMonitoringControlEvent"
|
|
961
|
+
}),
|
|
962
|
+
// Success (59xx)
|
|
963
|
+
CDK_TOOLKIT_I5900: result({
|
|
964
|
+
code: "CDK_TOOLKIT_I5900",
|
|
965
|
+
description: "Deployment results on success",
|
|
966
|
+
interface: "SuccessfulDeployStackResult"
|
|
967
|
+
}),
|
|
968
|
+
CDK_TOOLKIT_I5901: info({
|
|
969
|
+
code: "CDK_TOOLKIT_I5901",
|
|
970
|
+
description: "Generic deployment success messages"
|
|
971
|
+
}),
|
|
972
|
+
CDK_TOOLKIT_W5400: warn({
|
|
973
|
+
code: "CDK_TOOLKIT_W5400",
|
|
974
|
+
description: "Hotswap disclosure message"
|
|
975
|
+
}),
|
|
976
|
+
// errors
|
|
977
|
+
CDK_TOOLKIT_E5001: error({
|
|
978
|
+
code: "CDK_TOOLKIT_E5001",
|
|
979
|
+
description: "No stacks found"
|
|
980
|
+
}),
|
|
981
|
+
CDK_TOOLKIT_E5500: error({
|
|
982
|
+
code: "CDK_TOOLKIT_E5500",
|
|
983
|
+
description: "Stack Monitoring error",
|
|
984
|
+
interface: "ErrorPayload"
|
|
985
|
+
}),
|
|
986
|
+
// 6: Rollback (6xxx)
|
|
987
|
+
CDK_TOOLKIT_I6000: info({
|
|
988
|
+
code: "CDK_TOOLKIT_I6000",
|
|
989
|
+
description: "Provides rollback times",
|
|
990
|
+
interface: "Duration"
|
|
991
|
+
}),
|
|
992
|
+
CDK_TOOLKIT_I6100: info({
|
|
993
|
+
code: "CDK_TOOLKIT_I6100",
|
|
994
|
+
description: "Stack rollback progress",
|
|
995
|
+
interface: "StackRollbackProgress"
|
|
996
|
+
}),
|
|
997
|
+
CDK_TOOLKIT_E6001: error({
|
|
998
|
+
code: "CDK_TOOLKIT_E6001",
|
|
999
|
+
description: "No stacks found"
|
|
1000
|
+
}),
|
|
1001
|
+
CDK_TOOLKIT_E6900: error({
|
|
1002
|
+
code: "CDK_TOOLKIT_E6900",
|
|
1003
|
+
description: "Rollback failed",
|
|
1004
|
+
interface: "ErrorPayload"
|
|
1005
|
+
}),
|
|
1006
|
+
// 7: Destroy (7xxx)
|
|
1007
|
+
CDK_TOOLKIT_I7000: info({
|
|
1008
|
+
code: "CDK_TOOLKIT_I7000",
|
|
1009
|
+
description: "Provides destroy times",
|
|
1010
|
+
interface: "Duration"
|
|
1011
|
+
}),
|
|
1012
|
+
CDK_TOOLKIT_I7001: trace({
|
|
1013
|
+
code: "CDK_TOOLKIT_I7001",
|
|
1014
|
+
description: "Provides destroy time for a single stack",
|
|
1015
|
+
interface: "Duration"
|
|
1016
|
+
}),
|
|
1017
|
+
CDK_TOOLKIT_I7010: confirm({
|
|
1018
|
+
code: "CDK_TOOLKIT_I7010",
|
|
1019
|
+
description: "Confirm destroy stacks",
|
|
1020
|
+
interface: "ConfirmationRequest"
|
|
1021
|
+
}),
|
|
1022
|
+
CDK_TOOLKIT_I7100: info({
|
|
1023
|
+
code: "CDK_TOOLKIT_I7100",
|
|
1024
|
+
description: "Stack destroy progress",
|
|
1025
|
+
interface: "StackDestroyProgress"
|
|
1026
|
+
}),
|
|
1027
|
+
CDK_TOOLKIT_I7101: trace({
|
|
1028
|
+
code: "CDK_TOOLKIT_I7101",
|
|
1029
|
+
description: "Start stack destroying",
|
|
1030
|
+
interface: "StackDestroy"
|
|
1031
|
+
}),
|
|
1032
|
+
CDK_TOOLKIT_I7900: result({
|
|
1033
|
+
code: "CDK_TOOLKIT_I7900",
|
|
1034
|
+
description: "Stack deletion succeeded",
|
|
1035
|
+
interface: "cxapi.CloudFormationStackArtifact"
|
|
1036
|
+
}),
|
|
1037
|
+
CDK_TOOLKIT_E7010: error({
|
|
1038
|
+
code: "CDK_TOOLKIT_E7010",
|
|
1039
|
+
description: "Action was aborted due to negative confirmation of request"
|
|
1040
|
+
}),
|
|
1041
|
+
CDK_TOOLKIT_E7900: error({
|
|
1042
|
+
code: "CDK_TOOLKIT_E7900",
|
|
1043
|
+
description: "Stack deletion failed",
|
|
1044
|
+
interface: "ErrorPayload"
|
|
1045
|
+
}),
|
|
1046
|
+
// 9: Bootstrap (9xxx)
|
|
1047
|
+
CDK_TOOLKIT_I9000: info({
|
|
1048
|
+
code: "CDK_TOOLKIT_I9000",
|
|
1049
|
+
description: "Provides bootstrap times",
|
|
1050
|
+
interface: "Duration"
|
|
1051
|
+
}),
|
|
1052
|
+
CDK_TOOLKIT_I9100: info({
|
|
1053
|
+
code: "CDK_TOOLKIT_I9100",
|
|
1054
|
+
description: "Bootstrap progress",
|
|
1055
|
+
interface: "BootstrapEnvironmentProgress"
|
|
1056
|
+
}),
|
|
1057
|
+
CDK_TOOLKIT_I9900: result({
|
|
1058
|
+
code: "CDK_TOOLKIT_I9900",
|
|
1059
|
+
description: "Bootstrap results on success",
|
|
1060
|
+
interface: "cxapi.Environment"
|
|
1061
|
+
}),
|
|
1062
|
+
CDK_TOOLKIT_E9900: error({
|
|
1063
|
+
code: "CDK_TOOLKIT_E9900",
|
|
1064
|
+
description: "Bootstrap failed",
|
|
1065
|
+
interface: "ErrorPayload"
|
|
1066
|
+
}),
|
|
1067
|
+
// Notices
|
|
1068
|
+
CDK_TOOLKIT_I0100: info({
|
|
1069
|
+
code: "CDK_TOOLKIT_I0100",
|
|
1070
|
+
description: "Notices decoration (the header or footer of a list of notices)"
|
|
1071
|
+
}),
|
|
1072
|
+
CDK_TOOLKIT_W0101: warn({
|
|
1073
|
+
code: "CDK_TOOLKIT_W0101",
|
|
1074
|
+
description: "A notice that is marked as a warning"
|
|
1075
|
+
}),
|
|
1076
|
+
CDK_TOOLKIT_E0101: error({
|
|
1077
|
+
code: "CDK_TOOLKIT_E0101",
|
|
1078
|
+
description: "A notice that is marked as an error"
|
|
1079
|
+
}),
|
|
1080
|
+
CDK_TOOLKIT_I0101: info({
|
|
1081
|
+
code: "CDK_TOOLKIT_I0101",
|
|
1082
|
+
description: "A notice that is marked as informational"
|
|
1083
|
+
}),
|
|
1084
|
+
// Assembly codes
|
|
1085
|
+
CDK_ASSEMBLY_I0010: debug({
|
|
1086
|
+
code: "CDK_ASSEMBLY_I0010",
|
|
1087
|
+
description: "Generic environment preparation debug messages"
|
|
1088
|
+
}),
|
|
1089
|
+
CDK_ASSEMBLY_W0010: warn({
|
|
1090
|
+
code: "CDK_ASSEMBLY_W0010",
|
|
1091
|
+
description: "Emitted if the found framework version does not support context overflow"
|
|
1092
|
+
}),
|
|
1093
|
+
CDK_ASSEMBLY_I0042: debug({
|
|
1094
|
+
code: "CDK_ASSEMBLY_I0042",
|
|
1095
|
+
description: "Writing updated context",
|
|
1096
|
+
interface: "UpdatedContext"
|
|
1097
|
+
}),
|
|
1098
|
+
CDK_ASSEMBLY_I0240: debug({
|
|
1099
|
+
code: "CDK_ASSEMBLY_I0240",
|
|
1100
|
+
description: "Context lookup was stopped as no further progress was made. ",
|
|
1101
|
+
interface: "MissingContext"
|
|
1102
|
+
}),
|
|
1103
|
+
CDK_ASSEMBLY_I0241: debug({
|
|
1104
|
+
code: "CDK_ASSEMBLY_I0241",
|
|
1105
|
+
description: "Fetching missing context. This is an iterative message that may appear multiple times with different missing keys.",
|
|
1106
|
+
interface: "MissingContext"
|
|
1107
|
+
}),
|
|
1108
|
+
CDK_ASSEMBLY_I1000: debug({
|
|
1109
|
+
code: "CDK_ASSEMBLY_I1000",
|
|
1110
|
+
description: "Cloud assembly output starts"
|
|
1111
|
+
}),
|
|
1112
|
+
CDK_ASSEMBLY_I1001: info({
|
|
1113
|
+
code: "CDK_ASSEMBLY_I1001",
|
|
1114
|
+
description: "Output lines emitted by the cloud assembly to stdout"
|
|
1115
|
+
}),
|
|
1116
|
+
CDK_ASSEMBLY_E1002: error({
|
|
1117
|
+
code: "CDK_ASSEMBLY_E1002",
|
|
1118
|
+
description: "Output lines emitted by the cloud assembly to stderr"
|
|
1119
|
+
}),
|
|
1120
|
+
CDK_ASSEMBLY_I1003: info({
|
|
1121
|
+
code: "CDK_ASSEMBLY_I1003",
|
|
1122
|
+
description: "Cloud assembly output finished"
|
|
1123
|
+
}),
|
|
1124
|
+
CDK_ASSEMBLY_E1111: error({
|
|
1125
|
+
code: "CDK_ASSEMBLY_E1111",
|
|
1126
|
+
description: "Incompatible CDK CLI version. Upgrade needed.",
|
|
1127
|
+
interface: "ErrorPayload"
|
|
1128
|
+
}),
|
|
1129
|
+
CDK_ASSEMBLY_I0150: debug({
|
|
1130
|
+
code: "CDK_ASSEMBLY_I0150",
|
|
1131
|
+
description: "Indicates the use of a pre-synthesized cloud assembly directory"
|
|
1132
|
+
}),
|
|
1133
|
+
// Assembly Annotations
|
|
1134
|
+
CDK_ASSEMBLY_I9999: info({
|
|
1135
|
+
code: "CDK_ASSEMBLY_I9999",
|
|
1136
|
+
description: "Annotations emitted by the cloud assembly",
|
|
1137
|
+
interface: "cxapi.SynthesisMessage"
|
|
1138
|
+
}),
|
|
1139
|
+
CDK_ASSEMBLY_W9999: warn({
|
|
1140
|
+
code: "CDK_ASSEMBLY_W9999",
|
|
1141
|
+
description: "Warnings emitted by the cloud assembly",
|
|
1142
|
+
interface: "cxapi.SynthesisMessage"
|
|
1143
|
+
}),
|
|
1144
|
+
CDK_ASSEMBLY_E9999: error({
|
|
1145
|
+
code: "CDK_ASSEMBLY_E9999",
|
|
1146
|
+
description: "Errors emitted by the cloud assembly",
|
|
1147
|
+
interface: "cxapi.SynthesisMessage"
|
|
1148
|
+
}),
|
|
1149
|
+
// SDK codes
|
|
1150
|
+
CDK_SDK_I0000: trace({
|
|
1151
|
+
code: "CDK_SDK_I0000",
|
|
1152
|
+
description: "An SDK message."
|
|
1153
|
+
}),
|
|
1154
|
+
CDK_SDK_I0100: trace({
|
|
1155
|
+
code: "CDK_SDK_I0100",
|
|
1156
|
+
description: "An SDK trace. SDK traces are emitted as traces to the IoHost, but contain the original SDK logging level.",
|
|
1157
|
+
interface: "SdkTrace"
|
|
1158
|
+
})
|
|
1159
|
+
};
|
|
1160
|
+
var SPAN = {
|
|
1161
|
+
SYNTH_ASSEMBLY: {
|
|
1162
|
+
name: "Synthesis",
|
|
1163
|
+
start: IO.CDK_TOOLKIT_I1001,
|
|
1164
|
+
end: IO.CDK_TOOLKIT_I1000
|
|
1165
|
+
},
|
|
1166
|
+
DEPLOY_STACK: {
|
|
1167
|
+
name: "Deployment",
|
|
1168
|
+
start: IO.CDK_TOOLKIT_I5100,
|
|
1169
|
+
end: IO.CDK_TOOLKIT_I5001
|
|
1170
|
+
},
|
|
1171
|
+
ROLLBACK_STACK: {
|
|
1172
|
+
name: "Rollback",
|
|
1173
|
+
start: IO.CDK_TOOLKIT_I6100,
|
|
1174
|
+
end: IO.CDK_TOOLKIT_I6000
|
|
1175
|
+
},
|
|
1176
|
+
DESTROY_STACK: {
|
|
1177
|
+
name: "Destroy",
|
|
1178
|
+
start: IO.CDK_TOOLKIT_I7100,
|
|
1179
|
+
end: IO.CDK_TOOLKIT_I7001
|
|
1180
|
+
},
|
|
1181
|
+
DESTROY_ACTION: {
|
|
1182
|
+
name: "Destroy",
|
|
1183
|
+
start: IO.CDK_TOOLKIT_I7101,
|
|
1184
|
+
end: IO.CDK_TOOLKIT_I7000
|
|
1185
|
+
},
|
|
1186
|
+
BOOTSTRAP_SINGLE: {
|
|
1187
|
+
name: "Bootstrap",
|
|
1188
|
+
start: IO.CDK_TOOLKIT_I9100,
|
|
1189
|
+
end: IO.CDK_TOOLKIT_I9000
|
|
1190
|
+
},
|
|
1191
|
+
BUILD_ASSET: {
|
|
1192
|
+
name: "Build Asset",
|
|
1193
|
+
start: IO.CDK_TOOLKIT_I5210,
|
|
1194
|
+
end: IO.CDK_TOOLKIT_I5211
|
|
1195
|
+
},
|
|
1196
|
+
PUBLISH_ASSET: {
|
|
1197
|
+
name: "Publish Asset",
|
|
1198
|
+
start: IO.CDK_TOOLKIT_I5220,
|
|
1199
|
+
end: IO.CDK_TOOLKIT_I5221
|
|
1200
|
+
},
|
|
1201
|
+
HOTSWAP: {
|
|
1202
|
+
name: "hotswap-deployment",
|
|
1203
|
+
start: IO.CDK_TOOLKIT_I5400,
|
|
1204
|
+
end: IO.CDK_TOOLKIT_I5410
|
|
1205
|
+
}
|
|
1206
|
+
};
|
|
1207
|
+
|
|
1208
|
+
// ../tmp-toolkit-helpers/src/api/io/private/io-default-messages.ts
|
|
1209
|
+
var util2 = __toESM(require("util"));
|
|
1210
|
+
var IoDefaultMessages = class {
|
|
1211
|
+
constructor(ioHelper) {
|
|
1212
|
+
this.ioHelper = ioHelper;
|
|
1213
|
+
}
|
|
1214
|
+
notify(msg) {
|
|
1215
|
+
return this.ioHelper.notify(msg);
|
|
1216
|
+
}
|
|
1217
|
+
requestResponse(msg) {
|
|
1218
|
+
return this.ioHelper.requestResponse(msg);
|
|
1219
|
+
}
|
|
1220
|
+
error(input, ...args) {
|
|
1221
|
+
this.emitMessage(IO.DEFAULT_TOOLKIT_ERROR, input, ...args);
|
|
1222
|
+
}
|
|
1223
|
+
warn(input, ...args) {
|
|
1224
|
+
this.emitMessage(IO.DEFAULT_TOOLKIT_WARN, input, ...args);
|
|
1225
|
+
}
|
|
1226
|
+
warning(input, ...args) {
|
|
1227
|
+
this.emitMessage(IO.DEFAULT_TOOLKIT_WARN, input, ...args);
|
|
1228
|
+
}
|
|
1229
|
+
info(input, ...args) {
|
|
1230
|
+
this.emitMessage(IO.DEFAULT_TOOLKIT_INFO, input, ...args);
|
|
1231
|
+
}
|
|
1232
|
+
debug(input, ...args) {
|
|
1233
|
+
this.emitMessage(IO.DEFAULT_TOOLKIT_DEBUG, input, ...args);
|
|
1234
|
+
}
|
|
1235
|
+
trace(input, ...args) {
|
|
1236
|
+
this.emitMessage(IO.DEFAULT_TOOLKIT_TRACE, input, ...args);
|
|
1237
|
+
}
|
|
1238
|
+
result(input, ...args) {
|
|
1239
|
+
const message2 = args.length > 0 ? util2.format(input, ...args) : input;
|
|
1240
|
+
void this.ioHelper.notify({
|
|
1241
|
+
time: /* @__PURE__ */ new Date(),
|
|
1242
|
+
code: IO.DEFAULT_TOOLKIT_INFO.code,
|
|
1243
|
+
level: "result",
|
|
1244
|
+
message: message2,
|
|
1245
|
+
data: void 0
|
|
1246
|
+
});
|
|
1247
|
+
}
|
|
1248
|
+
emitMessage(maker, input, ...args) {
|
|
1249
|
+
const message2 = args.length > 0 ? util2.format(input, ...args) : input;
|
|
1250
|
+
void this.ioHelper.notify(maker.msg(message2));
|
|
1251
|
+
}
|
|
1252
|
+
};
|
|
1253
|
+
|
|
557
1254
|
// ../../aws-cdk/lib/cli/activity-printer/base.ts
|
|
558
1255
|
var ActivityPrinterBase = class {
|
|
559
1256
|
constructor(props) {
|
|
@@ -581,14 +1278,14 @@ var ActivityPrinterBase = class {
|
|
|
581
1278
|
* Receive a stack activity message
|
|
582
1279
|
*/
|
|
583
1280
|
notify(msg) {
|
|
584
|
-
switch (
|
|
585
|
-
case
|
|
1281
|
+
switch (true) {
|
|
1282
|
+
case IO.CDK_TOOLKIT_I5501.is(msg):
|
|
586
1283
|
this.start(msg.data);
|
|
587
1284
|
break;
|
|
588
|
-
case
|
|
1285
|
+
case IO.CDK_TOOLKIT_I5502.is(msg):
|
|
589
1286
|
this.activity(msg.data);
|
|
590
1287
|
break;
|
|
591
|
-
case
|
|
1288
|
+
case IO.CDK_TOOLKIT_I5503.is(msg):
|
|
592
1289
|
this.stop();
|
|
593
1290
|
break;
|
|
594
1291
|
default:
|
|
@@ -659,7 +1356,7 @@ var ActivityPrinterBase = class {
|
|
|
659
1356
|
};
|
|
660
1357
|
|
|
661
1358
|
// ../../aws-cdk/lib/cli/activity-printer/history.ts
|
|
662
|
-
var
|
|
1359
|
+
var util3 = __toESM(require("util"));
|
|
663
1360
|
var chalk = __toESM(require("chalk"));
|
|
664
1361
|
var HistoryActivityPrinter = class _HistoryActivityPrinter extends ActivityPrinterBase {
|
|
665
1362
|
constructor(props) {
|
|
@@ -719,7 +1416,7 @@ var HistoryActivityPrinter = class _HistoryActivityPrinter extends ActivityPrint
|
|
|
719
1416
|
const resourceName = metadata ? metadata.constructPath : event.LogicalResourceId || "";
|
|
720
1417
|
const logicalId = resourceName !== event.LogicalResourceId ? `(${event.LogicalResourceId}) ` : "";
|
|
721
1418
|
this.stream.write(
|
|
722
|
-
|
|
1419
|
+
util3.format(
|
|
723
1420
|
"%s | %s%s | %s | %s | %s %s%s%s\n",
|
|
724
1421
|
event.StackName,
|
|
725
1422
|
progress !== false ? `${activity.progress.formatted} | ` : "",
|
|
@@ -744,7 +1441,7 @@ var HistoryActivityPrinter = class _HistoryActivityPrinter extends ActivityPrint
|
|
|
744
1441
|
}
|
|
745
1442
|
if (Object.keys(this.resourcesInProgress).length > 0) {
|
|
746
1443
|
this.stream.write(
|
|
747
|
-
|
|
1444
|
+
util3.format(
|
|
748
1445
|
"%s Currently in progress: %s\n",
|
|
749
1446
|
progress,
|
|
750
1447
|
chalk.bold(Object.keys(this.resourcesInProgress).join(", "))
|
|
@@ -771,7 +1468,7 @@ function colorFromStatusResult(status) {
|
|
|
771
1468
|
}
|
|
772
1469
|
|
|
773
1470
|
// ../../aws-cdk/lib/cli/activity-printer/current.ts
|
|
774
|
-
var
|
|
1471
|
+
var util4 = __toESM(require("util"));
|
|
775
1472
|
var chalk2 = __toESM(require("chalk"));
|
|
776
1473
|
|
|
777
1474
|
// ../../aws-cdk/lib/cli/activity-printer/display.ts
|
|
@@ -855,7 +1552,7 @@ var CurrentActivityPrinter = class _CurrentActivityPrinter extends ActivityPrint
|
|
|
855
1552
|
...toPrint.map((res) => {
|
|
856
1553
|
const color = colorFromStatusActivity(res.event.ResourceStatus);
|
|
857
1554
|
const resourceName = res.metadata?.constructPath ?? res.event.LogicalResourceId ?? "";
|
|
858
|
-
return
|
|
1555
|
+
return util4.format(
|
|
859
1556
|
"%s | %s | %s | %s%s",
|
|
860
1557
|
padLeft(_CurrentActivityPrinter.TIMESTAMP_WIDTH, new Date(res.event.Timestamp).toLocaleTimeString()),
|
|
861
1558
|
color(padRight(_CurrentActivityPrinter.STATUS_WIDTH, (res.event.ResourceStatus || "").slice(0, _CurrentActivityPrinter.STATUS_WIDTH))),
|
|
@@ -875,7 +1572,7 @@ var CurrentActivityPrinter = class _CurrentActivityPrinter extends ActivityPrint
|
|
|
875
1572
|
continue;
|
|
876
1573
|
}
|
|
877
1574
|
lines.push(
|
|
878
|
-
|
|
1575
|
+
util4.format(
|
|
879
1576
|
chalk2.red("%s | %s | %s | %s%s") + "\n",
|
|
880
1577
|
padLeft(_CurrentActivityPrinter.TIMESTAMP_WIDTH, new Date(failure.event.Timestamp).toLocaleTimeString()),
|
|
881
1578
|
padRight(_CurrentActivityPrinter.STATUS_WIDTH, (failure.event.ResourceStatus || "").slice(0, _CurrentActivityPrinter.STATUS_WIDTH)),
|
|
@@ -884,9 +1581,9 @@ var CurrentActivityPrinter = class _CurrentActivityPrinter extends ActivityPrint
|
|
|
884
1581
|
this.failureReasonOnNextLine(failure)
|
|
885
1582
|
)
|
|
886
1583
|
);
|
|
887
|
-
const
|
|
888
|
-
if (
|
|
889
|
-
lines.push(chalk2.red(` ${
|
|
1584
|
+
const trace4 = failure.metadata?.entry?.trace;
|
|
1585
|
+
if (trace4) {
|
|
1586
|
+
lines.push(chalk2.red(` ${trace4.join("\n \\_ ")}
|
|
890
1587
|
`));
|
|
891
1588
|
}
|
|
892
1589
|
}
|
|
@@ -944,24 +1641,24 @@ function shorten(maxWidth, p) {
|
|
|
944
1641
|
}
|
|
945
1642
|
|
|
946
1643
|
// ../../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
1644
|
var CliIoHost = class _CliIoHost {
|
|
956
1645
|
constructor(props = {}) {
|
|
1646
|
+
/**
|
|
1647
|
+
* Configure the target stream for notices
|
|
1648
|
+
*
|
|
1649
|
+
* (Not a setter because there's no need for additional logic when this value
|
|
1650
|
+
* is changed yet)
|
|
1651
|
+
*/
|
|
1652
|
+
this.noticesDestination = "stderr";
|
|
957
1653
|
this._progress = "bar" /* BAR */;
|
|
958
1654
|
// Corked Logging
|
|
959
1655
|
this.corkedCounter = 0;
|
|
960
1656
|
this.corkedLoggingBuffer = [];
|
|
961
|
-
this.
|
|
962
|
-
this.
|
|
963
|
-
this.
|
|
964
|
-
this.
|
|
1657
|
+
this.currentAction = props.currentAction ?? "none";
|
|
1658
|
+
this.isTTY = props.isTTY ?? process.stdout.isTTY ?? false;
|
|
1659
|
+
this.logLevel = props.logLevel ?? "info";
|
|
1660
|
+
this.isCI = props.isCI ?? isCI();
|
|
1661
|
+
this.requireDeployApproval = props.requireDeployApproval ?? import_cloud_assembly_schema.RequireApproval.BROADENING;
|
|
965
1662
|
this.stackProgress = props.stackProgress ?? "bar" /* BAR */;
|
|
966
1663
|
}
|
|
967
1664
|
/**
|
|
@@ -997,7 +1694,7 @@ var CliIoHost = class _CliIoHost {
|
|
|
997
1694
|
if (this._progress === "events" /* EVENTS */) {
|
|
998
1695
|
return this._progress;
|
|
999
1696
|
}
|
|
1000
|
-
const verboseLogging =
|
|
1697
|
+
const verboseLogging = isMessageRelevantForLevel({ level: "debug" }, this.logLevel);
|
|
1001
1698
|
if (verboseLogging) {
|
|
1002
1699
|
return "events" /* EVENTS */;
|
|
1003
1700
|
}
|
|
@@ -1011,60 +1708,6 @@ var CliIoHost = class _CliIoHost {
|
|
|
1011
1708
|
}
|
|
1012
1709
|
return this._progress;
|
|
1013
1710
|
}
|
|
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
1711
|
/**
|
|
1069
1712
|
* Executes a block of code with corked logging. All log messages during execution
|
|
1070
1713
|
* are buffered and only written when all nested cork blocks complete (when CORK_COUNTER reaches 0).
|
|
@@ -1102,7 +1745,7 @@ var CliIoHost = class _CliIoHost {
|
|
|
1102
1745
|
await this.activityPrinter.notify(msg);
|
|
1103
1746
|
return;
|
|
1104
1747
|
}
|
|
1105
|
-
if (
|
|
1748
|
+
if (!isMessageRelevantForLevel(msg, this.logLevel)) {
|
|
1106
1749
|
return;
|
|
1107
1750
|
}
|
|
1108
1751
|
if (this.corkedCounter > 0) {
|
|
@@ -1110,8 +1753,8 @@ var CliIoHost = class _CliIoHost {
|
|
|
1110
1753
|
return;
|
|
1111
1754
|
}
|
|
1112
1755
|
const output = this.formatMessage(msg);
|
|
1113
|
-
const stream = this.selectStream(msg
|
|
1114
|
-
stream
|
|
1756
|
+
const stream = this.selectStream(msg);
|
|
1757
|
+
stream?.write(output);
|
|
1115
1758
|
}
|
|
1116
1759
|
/**
|
|
1117
1760
|
* Detect stack activity messages so they can be send to the printer.
|
|
@@ -1123,10 +1766,40 @@ var CliIoHost = class _CliIoHost {
|
|
|
1123
1766
|
"CDK_TOOLKIT_I5503"
|
|
1124
1767
|
].includes(msg.code);
|
|
1125
1768
|
}
|
|
1769
|
+
/**
|
|
1770
|
+
* Detect special messages encode information about whether or not
|
|
1771
|
+
* they require approval
|
|
1772
|
+
*/
|
|
1773
|
+
skipApprovalStep(msg) {
|
|
1774
|
+
const approvalToolkitCodes = ["CDK_TOOLKIT_I5060"];
|
|
1775
|
+
if (!approvalToolkitCodes.includes(msg.code)) {
|
|
1776
|
+
false;
|
|
1777
|
+
}
|
|
1778
|
+
switch (this.requireDeployApproval) {
|
|
1779
|
+
// Never require approval
|
|
1780
|
+
case import_cloud_assembly_schema.RequireApproval.NEVER:
|
|
1781
|
+
return true;
|
|
1782
|
+
// Always require approval
|
|
1783
|
+
case import_cloud_assembly_schema.RequireApproval.ANYCHANGE:
|
|
1784
|
+
return false;
|
|
1785
|
+
// Require approval if changes include broadening permissions
|
|
1786
|
+
case import_cloud_assembly_schema.RequireApproval.BROADENING:
|
|
1787
|
+
return ["none", "non-broadening"].includes(msg.data?.permissionChangeType);
|
|
1788
|
+
}
|
|
1789
|
+
}
|
|
1790
|
+
/**
|
|
1791
|
+
* Determines the output stream, based on message and configuration.
|
|
1792
|
+
*/
|
|
1793
|
+
selectStream(msg) {
|
|
1794
|
+
if (isNoticesMessage(msg)) {
|
|
1795
|
+
return targetStreamObject(this.noticesDestination);
|
|
1796
|
+
}
|
|
1797
|
+
return this.selectStreamFromLevel(msg.level);
|
|
1798
|
+
}
|
|
1126
1799
|
/**
|
|
1127
1800
|
* Determines the output stream, based on message level and configuration.
|
|
1128
1801
|
*/
|
|
1129
|
-
|
|
1802
|
+
selectStreamFromLevel(level) {
|
|
1130
1803
|
switch (level) {
|
|
1131
1804
|
case "error":
|
|
1132
1805
|
return process.stderr;
|
|
@@ -1160,6 +1833,9 @@ var CliIoHost = class _CliIoHost {
|
|
|
1160
1833
|
if (concurrency > 1) {
|
|
1161
1834
|
throw new ToolkitError(`${motivation}, but concurrency is greater than 1 so we are unable to get a confirmation from the user`);
|
|
1162
1835
|
}
|
|
1836
|
+
if (this.skipApprovalStep(msg)) {
|
|
1837
|
+
return true;
|
|
1838
|
+
}
|
|
1163
1839
|
if (isConfirmationPrompt(msg)) {
|
|
1164
1840
|
const confirmed = await promptly.confirm(`${chalk3.cyan(msg.message)} (y/n)`);
|
|
1165
1841
|
if (!confirmed) {
|
|
@@ -1179,7 +1855,7 @@ var CliIoHost = class _CliIoHost {
|
|
|
1179
1855
|
* Formats a message for console output with optional color support
|
|
1180
1856
|
*/
|
|
1181
1857
|
formatMessage(msg) {
|
|
1182
|
-
let message_text = this.
|
|
1858
|
+
let message_text = this.isTTY ? styleMap[msg.level](msg.message) : msg.message;
|
|
1183
1859
|
return (msg.level === "debug" || msg.level === "trace" ? `[${this.formatTime(msg.time)}] ${message_text}` : message_text) + "\n";
|
|
1184
1860
|
}
|
|
1185
1861
|
/**
|
|
@@ -1194,7 +1870,7 @@ var CliIoHost = class _CliIoHost {
|
|
|
1194
1870
|
*/
|
|
1195
1871
|
makeActivityPrinter() {
|
|
1196
1872
|
const props = {
|
|
1197
|
-
stream: this.
|
|
1873
|
+
stream: this.selectStreamFromLevel("info")
|
|
1198
1874
|
};
|
|
1199
1875
|
switch (this.stackProgress) {
|
|
1200
1876
|
case "events" /* EVENTS */:
|
|
@@ -1213,7 +1889,7 @@ function isConfirmationPrompt(msg) {
|
|
|
1213
1889
|
function extractPromptInfo(msg) {
|
|
1214
1890
|
const isNumber = typeof msg.defaultResponse === "number";
|
|
1215
1891
|
return {
|
|
1216
|
-
default:
|
|
1892
|
+
default: util5.format(msg.defaultResponse),
|
|
1217
1893
|
convertAnswer: isNumber ? (v) => Number(v) : (v) => String(v)
|
|
1218
1894
|
};
|
|
1219
1895
|
}
|
|
@@ -1228,40 +1904,50 @@ var styleMap = {
|
|
|
1228
1904
|
function isCI() {
|
|
1229
1905
|
return process.env.CI !== void 0 && process.env.CI !== "false" && process.env.CI !== "0";
|
|
1230
1906
|
}
|
|
1907
|
+
function targetStreamObject(x) {
|
|
1908
|
+
switch (x) {
|
|
1909
|
+
case "stderr":
|
|
1910
|
+
return process.stderr;
|
|
1911
|
+
case "stdout":
|
|
1912
|
+
return process.stdout;
|
|
1913
|
+
case "drop":
|
|
1914
|
+
return void 0;
|
|
1915
|
+
}
|
|
1916
|
+
}
|
|
1917
|
+
function isNoticesMessage(msg) {
|
|
1918
|
+
return IO.CDK_TOOLKIT_I0100.is(msg) || IO.CDK_TOOLKIT_W0101.is(msg) || IO.CDK_TOOLKIT_E0101.is(msg) || IO.CDK_TOOLKIT_I0101.is(msg);
|
|
1919
|
+
}
|
|
1231
1920
|
|
|
1232
1921
|
// ../../aws-cdk/lib/logging.ts
|
|
1233
|
-
function formatMessageAndLog(level, input,
|
|
1234
|
-
const
|
|
1235
|
-
const
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
}
|
|
1247
|
-
function getDefaultCode(level, category = "TOOLKIT") {
|
|
1248
|
-
const levelIndicator = level === "error" ? "E" : level === "warn" ? "W" : "I";
|
|
1249
|
-
return `CDK_${category}_${levelIndicator}0000`;
|
|
1922
|
+
function formatMessageAndLog(level, input, ...args) {
|
|
1923
|
+
const singletonHost = CliIoHost.instance();
|
|
1924
|
+
const helper = asIoHelper(singletonHost, singletonHost.currentAction);
|
|
1925
|
+
if (typeof input === "string") {
|
|
1926
|
+
const messages = new IoDefaultMessages(helper);
|
|
1927
|
+
messages[level](input, ...args);
|
|
1928
|
+
} else {
|
|
1929
|
+
void helper.notify({
|
|
1930
|
+
data: void 0,
|
|
1931
|
+
time: /* @__PURE__ */ new Date(),
|
|
1932
|
+
level,
|
|
1933
|
+
...input
|
|
1934
|
+
});
|
|
1935
|
+
}
|
|
1250
1936
|
}
|
|
1251
|
-
var
|
|
1252
|
-
return formatMessageAndLog("error", input,
|
|
1937
|
+
var error2 = (input, ...args) => {
|
|
1938
|
+
return formatMessageAndLog("error", input, ...args);
|
|
1253
1939
|
};
|
|
1254
1940
|
var warning = (input, ...args) => {
|
|
1255
|
-
return formatMessageAndLog("warn", input,
|
|
1941
|
+
return formatMessageAndLog("warn", input, ...args);
|
|
1256
1942
|
};
|
|
1257
|
-
var
|
|
1258
|
-
return formatMessageAndLog("info", input,
|
|
1943
|
+
var info2 = (input, ...args) => {
|
|
1944
|
+
return formatMessageAndLog("info", input, ...args);
|
|
1259
1945
|
};
|
|
1260
|
-
var
|
|
1261
|
-
return formatMessageAndLog("debug", input,
|
|
1946
|
+
var debug2 = (input, ...args) => {
|
|
1947
|
+
return formatMessageAndLog("debug", input, ...args);
|
|
1262
1948
|
};
|
|
1263
|
-
var
|
|
1264
|
-
return formatMessageAndLog("trace", input,
|
|
1949
|
+
var trace2 = (input, ...args) => {
|
|
1950
|
+
return formatMessageAndLog("trace", input, ...args);
|
|
1265
1951
|
};
|
|
1266
1952
|
|
|
1267
1953
|
// ../../aws-cdk/lib/api/aws-auth/account-cache.ts
|
|
@@ -1292,7 +1978,7 @@ var AccountAccessKeyCache = class _AccountAccessKeyCache {
|
|
|
1292
1978
|
async fetch(accessKeyId, resolver) {
|
|
1293
1979
|
const cached2 = await this.get(accessKeyId);
|
|
1294
1980
|
if (cached2) {
|
|
1295
|
-
|
|
1981
|
+
debug2(`Retrieved account ID ${cached2.accountId} from disk cache`);
|
|
1296
1982
|
return cached2;
|
|
1297
1983
|
}
|
|
1298
1984
|
const account = await resolver();
|
|
@@ -1408,7 +2094,7 @@ function readIfPossible(filename) {
|
|
|
1408
2094
|
}
|
|
1409
2095
|
return fs4.readFileSync(filename, { encoding: "utf-8" });
|
|
1410
2096
|
} catch (e) {
|
|
1411
|
-
|
|
2097
|
+
debug2(e);
|
|
1412
2098
|
return void 0;
|
|
1413
2099
|
}
|
|
1414
2100
|
}
|
|
@@ -1721,19 +2407,19 @@ var SDK = class {
|
|
|
1721
2407
|
return cachedAsync(this, CURRENT_ACCOUNT_KEY, async () => {
|
|
1722
2408
|
const creds = await this.credProvider();
|
|
1723
2409
|
return SDK.accountCache.fetch(creds.accessKeyId, async () => {
|
|
1724
|
-
|
|
2410
|
+
debug2("Looking up default account ID from STS");
|
|
1725
2411
|
const client = new import_client_sts.STSClient({
|
|
1726
2412
|
...this.config,
|
|
1727
2413
|
retryStrategy: this.stsRetryStrategy
|
|
1728
2414
|
});
|
|
1729
2415
|
const command = new import_client_sts.GetCallerIdentityCommand({});
|
|
1730
|
-
const
|
|
1731
|
-
const accountId =
|
|
1732
|
-
const partition =
|
|
2416
|
+
const result2 = await client.send(command);
|
|
2417
|
+
const accountId = result2.Account;
|
|
2418
|
+
const partition = result2.Arn.split(":")[1];
|
|
1733
2419
|
if (!accountId) {
|
|
1734
2420
|
throw new AuthenticationError("STS didn't return an account ID");
|
|
1735
2421
|
}
|
|
1736
|
-
|
|
2422
|
+
debug2("Default account ID:", accountId);
|
|
1737
2423
|
this._credentialsValidated = true;
|
|
1738
2424
|
return { accountId, partition };
|
|
1739
2425
|
});
|
|
@@ -1858,7 +2544,7 @@ var AwsCliCompatible = class _AwsCliCompatible {
|
|
|
1858
2544
|
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
2545
|
if (!region) {
|
|
1860
2546
|
const usedProfile = !profile ? "" : ` (profile: "${profile}")`;
|
|
1861
|
-
|
|
2547
|
+
debug2(
|
|
1862
2548
|
`Unable to determine AWS region from environment or AWS configuration${usedProfile}, defaulting to '${defaultRegion}'`
|
|
1863
2549
|
);
|
|
1864
2550
|
return defaultRegion;
|
|
@@ -1876,7 +2562,7 @@ function getRegionFromIniFile(profile, data) {
|
|
|
1876
2562
|
function tryGetCACert(bundlePath) {
|
|
1877
2563
|
const path15 = bundlePath || caBundlePathFromEnvironment();
|
|
1878
2564
|
if (path15) {
|
|
1879
|
-
|
|
2565
|
+
debug2("Using CA bundle path: %s", path15);
|
|
1880
2566
|
return readIfPossible(path15);
|
|
1881
2567
|
}
|
|
1882
2568
|
return void 0;
|
|
@@ -1905,7 +2591,7 @@ function shouldPrioritizeEnv() {
|
|
|
1905
2591
|
return false;
|
|
1906
2592
|
}
|
|
1907
2593
|
async function regionFromMetadataService() {
|
|
1908
|
-
|
|
2594
|
+
debug2("Looking up AWS region in the EC2 Instance Metadata Service (IMDS).");
|
|
1909
2595
|
try {
|
|
1910
2596
|
const metadataService = new import_ec2_metadata_service.MetadataService({
|
|
1911
2597
|
httpOptions: {
|
|
@@ -1916,20 +2602,20 @@ async function regionFromMetadataService() {
|
|
|
1916
2602
|
const document = await metadataService.request("/latest/dynamic/instance-identity/document", {});
|
|
1917
2603
|
return JSON.parse(document).region;
|
|
1918
2604
|
} catch (e) {
|
|
1919
|
-
|
|
2605
|
+
debug2(`Unable to retrieve AWS region from IMDS: ${e}`);
|
|
1920
2606
|
}
|
|
1921
2607
|
}
|
|
1922
2608
|
async function tokenCodeFn(serialArn) {
|
|
1923
|
-
|
|
2609
|
+
debug2("Require MFA token for serial ARN", serialArn);
|
|
1924
2610
|
try {
|
|
1925
2611
|
const token = await promptly2.prompt(`MFA token for ${serialArn}: `, {
|
|
1926
2612
|
trim: true,
|
|
1927
2613
|
default: ""
|
|
1928
2614
|
});
|
|
1929
|
-
|
|
2615
|
+
debug2("Successfully got MFA token from user");
|
|
1930
2616
|
return token;
|
|
1931
2617
|
} catch (err) {
|
|
1932
|
-
|
|
2618
|
+
debug2("Failed to get MFA token", err);
|
|
1933
2619
|
const e = new AuthenticationError(`Error fetching MFA token: ${err.message ?? err}`);
|
|
1934
2620
|
e.name = "SharedIniFileCredentialsProviderFailure";
|
|
1935
2621
|
throw e;
|
|
@@ -1937,10 +2623,10 @@ async function tokenCodeFn(serialArn) {
|
|
|
1937
2623
|
}
|
|
1938
2624
|
|
|
1939
2625
|
// ../../aws-cdk/lib/api/aws-auth/credential-plugins.ts
|
|
1940
|
-
var
|
|
2626
|
+
var import_util11 = require("util");
|
|
1941
2627
|
|
|
1942
2628
|
// ../../aws-cdk/lib/api/plugin/plugin.ts
|
|
1943
|
-
var
|
|
2629
|
+
var import_util10 = require("util");
|
|
1944
2630
|
var chalk5 = __toESM(require("chalk"));
|
|
1945
2631
|
|
|
1946
2632
|
// ../../aws-cdk/lib/api/plugin/context-provider-plugin.ts
|
|
@@ -1974,14 +2660,14 @@ var PluginHost = class _PluginHost {
|
|
|
1974
2660
|
try {
|
|
1975
2661
|
const plugin = require(moduleSpec);
|
|
1976
2662
|
if (!isPlugin(plugin)) {
|
|
1977
|
-
|
|
2663
|
+
error2(`Module ${chalk5.green(moduleSpec)} is not a valid plug-in, or has an unsupported version.`);
|
|
1978
2664
|
throw new ToolkitError(`Module ${moduleSpec} does not define a valid plug-in.`);
|
|
1979
2665
|
}
|
|
1980
2666
|
if (plugin.init) {
|
|
1981
2667
|
plugin.init(this);
|
|
1982
2668
|
}
|
|
1983
2669
|
} catch (e) {
|
|
1984
|
-
|
|
2670
|
+
error2(`Unable to load ${chalk5.green(moduleSpec)}: ${e.stack}`);
|
|
1985
2671
|
throw new ToolkitError(`Unable to load plug-in: ${moduleSpec}: ${e}`);
|
|
1986
2672
|
}
|
|
1987
2673
|
function isPlugin(x) {
|
|
@@ -2030,7 +2716,7 @@ var PluginHost = class _PluginHost {
|
|
|
2030
2716
|
*/
|
|
2031
2717
|
registerContextProviderAlpha(pluginProviderName, provider) {
|
|
2032
2718
|
if (!isContextProviderPlugin(provider)) {
|
|
2033
|
-
throw new ToolkitError(`Object you gave me does not look like a ContextProviderPlugin: ${(0,
|
|
2719
|
+
throw new ToolkitError(`Object you gave me does not look like a ContextProviderPlugin: ${(0, import_util10.inspect)(provider)}`);
|
|
2034
2720
|
}
|
|
2035
2721
|
this.contextProviderPlugins[pluginProviderName] = provider;
|
|
2036
2722
|
}
|
|
@@ -2063,7 +2749,7 @@ var CredentialPlugins = class {
|
|
|
2063
2749
|
available = false;
|
|
2064
2750
|
}
|
|
2065
2751
|
if (!available) {
|
|
2066
|
-
|
|
2752
|
+
debug2("Credentials source %s is not available, ignoring it.", source.name);
|
|
2067
2753
|
continue;
|
|
2068
2754
|
}
|
|
2069
2755
|
triedSources.push(source);
|
|
@@ -2077,7 +2763,7 @@ var CredentialPlugins = class {
|
|
|
2077
2763
|
if (!canProvide) {
|
|
2078
2764
|
continue;
|
|
2079
2765
|
}
|
|
2080
|
-
|
|
2766
|
+
debug2(`Using ${source.name} credentials for account ${awsAccountId}`);
|
|
2081
2767
|
return {
|
|
2082
2768
|
credentials: await v3ProviderFromPlugin(() => source.getProvider(awsAccountId, mode, {
|
|
2083
2769
|
supportsV3Providers: true
|
|
@@ -2099,7 +2785,7 @@ async function v3ProviderFromPlugin(producer) {
|
|
|
2099
2785
|
} else if (isV2Credentials(initial)) {
|
|
2100
2786
|
return v3ProviderFromV2Credentials(initial);
|
|
2101
2787
|
} else {
|
|
2102
|
-
throw new AuthenticationError(`Plugin returned a value that doesn't resemble AWS credentials: ${(0,
|
|
2788
|
+
throw new AuthenticationError(`Plugin returned a value that doesn't resemble AWS credentials: ${(0, import_util11.inspect)(initial)}`);
|
|
2103
2789
|
}
|
|
2104
2790
|
}
|
|
2105
2791
|
function v3ProviderFromV2Credentials(x) {
|
|
@@ -2118,7 +2804,7 @@ function refreshFromPluginProvider(current, producer) {
|
|
|
2118
2804
|
if (credentialsAboutToExpire(current)) {
|
|
2119
2805
|
const newCreds = await producer();
|
|
2120
2806
|
if (!isV3Credentials(newCreds)) {
|
|
2121
|
-
throw new AuthenticationError(`Plugin initially returned static V3 credentials but now returned something else: ${(0,
|
|
2807
|
+
throw new AuthenticationError(`Plugin initially returned static V3 credentials but now returned something else: ${(0, import_util11.inspect)(newCreds)}`);
|
|
2122
2808
|
}
|
|
2123
2809
|
current = newCreds;
|
|
2124
2810
|
}
|
|
@@ -2195,8 +2881,8 @@ var SdkProvider = class {
|
|
|
2195
2881
|
throw err;
|
|
2196
2882
|
}
|
|
2197
2883
|
if (baseCreds.source === "correctDefault" || baseCreds.source === "plugin") {
|
|
2198
|
-
|
|
2199
|
-
const logger = quiet ?
|
|
2884
|
+
debug2(err.message);
|
|
2885
|
+
const logger = quiet ? debug2 : warning;
|
|
2200
2886
|
logger(
|
|
2201
2887
|
`${fmtObtainedCredentials(baseCreds)} could not be used to assume '${options.assumeRoleArn}', but are for the right account. Proceeding anyway.`
|
|
2202
2888
|
);
|
|
@@ -2269,7 +2955,7 @@ var SdkProvider = class {
|
|
|
2269
2955
|
);
|
|
2270
2956
|
return void 0;
|
|
2271
2957
|
}
|
|
2272
|
-
|
|
2958
|
+
debug2(`Unable to determine the default AWS account (${e.name}): ${formatErrorMessage(e)}`);
|
|
2273
2959
|
return void 0;
|
|
2274
2960
|
}
|
|
2275
2961
|
});
|
|
@@ -2316,7 +3002,7 @@ var SdkProvider = class {
|
|
|
2316
3002
|
* otherwise it will be the current credentials.
|
|
2317
3003
|
*/
|
|
2318
3004
|
async withAssumedRole(mainCredentials, roleArn, externalId, additionalOptions, region) {
|
|
2319
|
-
|
|
3005
|
+
debug2(`Assuming role '${roleArn}'.`);
|
|
2320
3006
|
region = region ?? this.defaultRegion;
|
|
2321
3007
|
const sourceDescription = fmtObtainedCredentials(mainCredentials);
|
|
2322
3008
|
try {
|
|
@@ -2343,7 +3029,7 @@ var SdkProvider = class {
|
|
|
2343
3029
|
if (err.name === "ExpiredToken") {
|
|
2344
3030
|
throw err;
|
|
2345
3031
|
}
|
|
2346
|
-
|
|
3032
|
+
debug2(`Assuming role failed: ${err.message}`);
|
|
2347
3033
|
throw new AuthenticationError(
|
|
2348
3034
|
[
|
|
2349
3035
|
"Could not assume role in target account",
|
|
@@ -2406,42 +3092,6 @@ async function initContextProviderSdk(aws, options) {
|
|
|
2406
3092
|
return (await aws.forEnvironment(import_cx_api.EnvironmentUtils.make(account, region), 0 /* ForReading */, creds)).sdk;
|
|
2407
3093
|
}
|
|
2408
3094
|
|
|
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
3095
|
// ../../aws-cdk/lib/api/settings.ts
|
|
2446
3096
|
var os3 = __toESM(require("os"));
|
|
2447
3097
|
var fs_path = __toESM(require("path"));
|
|
@@ -2673,7 +3323,6 @@ function formatMessage(msg, category = "TOOLKIT") {
|
|
|
2673
3323
|
return {
|
|
2674
3324
|
time: /* @__PURE__ */ new Date(),
|
|
2675
3325
|
level: msg.level,
|
|
2676
|
-
action: msg.action,
|
|
2677
3326
|
code: msg.code ?? defaultMessageCode(msg.level, category),
|
|
2678
3327
|
message: msg.message,
|
|
2679
3328
|
data: msg.data
|
|
@@ -2683,56 +3332,50 @@ function defaultMessageCode(level, category = "TOOLKIT") {
|
|
|
2683
3332
|
const levelIndicator = level === "error" ? "E" : level === "warn" ? "W" : "I";
|
|
2684
3333
|
return `CDK_${category}_${levelIndicator}0000`;
|
|
2685
3334
|
}
|
|
2686
|
-
var
|
|
3335
|
+
var error3 = (message2, code, payload) => {
|
|
2687
3336
|
return formatMessage({
|
|
2688
3337
|
level: "error",
|
|
2689
|
-
action,
|
|
2690
3338
|
code,
|
|
2691
|
-
message,
|
|
3339
|
+
message: message2,
|
|
2692
3340
|
data: payload
|
|
2693
3341
|
});
|
|
2694
3342
|
};
|
|
2695
|
-
var
|
|
3343
|
+
var warn2 = (message2, code, payload) => {
|
|
2696
3344
|
return formatMessage({
|
|
2697
3345
|
level: "warn",
|
|
2698
|
-
action,
|
|
2699
3346
|
code,
|
|
2700
|
-
message,
|
|
3347
|
+
message: message2,
|
|
2701
3348
|
data: payload
|
|
2702
3349
|
});
|
|
2703
3350
|
};
|
|
2704
|
-
var
|
|
3351
|
+
var info3 = (message2, code, payload) => {
|
|
2705
3352
|
return formatMessage({
|
|
2706
3353
|
level: "info",
|
|
2707
|
-
action,
|
|
2708
3354
|
code,
|
|
2709
|
-
message,
|
|
3355
|
+
message: message2,
|
|
2710
3356
|
data: payload
|
|
2711
3357
|
});
|
|
2712
3358
|
};
|
|
2713
|
-
var
|
|
3359
|
+
var debug3 = (message2, code, payload) => {
|
|
2714
3360
|
return formatMessage({
|
|
2715
3361
|
level: "debug",
|
|
2716
|
-
action,
|
|
2717
3362
|
code,
|
|
2718
|
-
message,
|
|
3363
|
+
message: message2,
|
|
2719
3364
|
data: payload
|
|
2720
3365
|
});
|
|
2721
3366
|
};
|
|
2722
|
-
var
|
|
3367
|
+
var trace3 = (message2, code, payload) => {
|
|
2723
3368
|
return formatMessage({
|
|
2724
3369
|
level: "trace",
|
|
2725
|
-
action,
|
|
2726
3370
|
code,
|
|
2727
|
-
message,
|
|
3371
|
+
message: message2,
|
|
2728
3372
|
data: payload
|
|
2729
3373
|
});
|
|
2730
3374
|
};
|
|
2731
3375
|
|
|
2732
3376
|
// ../../aws-cdk/lib/api/stack-events/stack-activity-monitor.ts
|
|
2733
|
-
var
|
|
2734
|
-
var
|
|
2735
|
-
var uuid = __toESM(require("uuid"));
|
|
3377
|
+
var util7 = __toESM(require("util"));
|
|
3378
|
+
var uuid2 = __toESM(require("uuid"));
|
|
2736
3379
|
|
|
2737
3380
|
// ../../aws-cdk/lib/api/stack-events/stack-event-poller.ts
|
|
2738
3381
|
var StackEventPoller = class _StackEventPoller {
|
|
@@ -2844,8 +3487,37 @@ function isStackTerminalState(state) {
|
|
|
2844
3487
|
return !(state ?? "").endsWith("_IN_PROGRESS");
|
|
2845
3488
|
}
|
|
2846
3489
|
|
|
3490
|
+
// ../tmp-toolkit-helpers/src/api/resource-metadata/resource-metadata.ts
|
|
3491
|
+
var import_cloud_assembly_schema2 = require("@aws-cdk/cloud-assembly-schema");
|
|
3492
|
+
function resourceMetadata(stack, logicalId) {
|
|
3493
|
+
const metadata = stack.manifest?.metadata;
|
|
3494
|
+
if (!metadata) {
|
|
3495
|
+
return void 0;
|
|
3496
|
+
}
|
|
3497
|
+
for (const path15 of Object.keys(metadata)) {
|
|
3498
|
+
const entry = metadata[path15].filter((e) => e.type === import_cloud_assembly_schema2.ArtifactMetadataEntryType.LOGICAL_ID).find((e) => e.data === logicalId);
|
|
3499
|
+
if (entry) {
|
|
3500
|
+
return {
|
|
3501
|
+
entry,
|
|
3502
|
+
constructPath: simplifyConstructPath(path15, stack.stackName)
|
|
3503
|
+
};
|
|
3504
|
+
}
|
|
3505
|
+
}
|
|
3506
|
+
return void 0;
|
|
3507
|
+
}
|
|
3508
|
+
function simplifyConstructPath(path15, stackName) {
|
|
3509
|
+
path15 = path15.replace(/\/Resource$/, "");
|
|
3510
|
+
path15 = path15.replace(/^\//, "");
|
|
3511
|
+
if (stackName) {
|
|
3512
|
+
if (path15.startsWith(stackName + "/")) {
|
|
3513
|
+
path15 = path15.slice(stackName.length + 1);
|
|
3514
|
+
}
|
|
3515
|
+
}
|
|
3516
|
+
return path15;
|
|
3517
|
+
}
|
|
3518
|
+
|
|
2847
3519
|
// ../../aws-cdk/lib/api/stack-events/stack-progress-monitor.ts
|
|
2848
|
-
var
|
|
3520
|
+
var util6 = __toESM(require("util"));
|
|
2849
3521
|
var StackProgressMonitor = class {
|
|
2850
3522
|
constructor(resourcesTotal) {
|
|
2851
3523
|
/**
|
|
@@ -2894,9 +3566,9 @@ var StackProgressMonitor = class {
|
|
|
2894
3566
|
*/
|
|
2895
3567
|
get formatted() {
|
|
2896
3568
|
if (this.resourcesTotal == null) {
|
|
2897
|
-
return padLeft(3,
|
|
3569
|
+
return padLeft(3, util6.format("%s", this.resourcesDone));
|
|
2898
3570
|
}
|
|
2899
|
-
return
|
|
3571
|
+
return util6.format(
|
|
2900
3572
|
"%s/%s",
|
|
2901
3573
|
padLeft(this.resourceDigits, this.resourcesDone.toString()),
|
|
2902
3574
|
padLeft(this.resourceDigits, this.resourcesTotal.toString())
|
|
@@ -2932,8 +3604,7 @@ var StackProgressMonitor = class {
|
|
|
2932
3604
|
var StackActivityMonitor = class {
|
|
2933
3605
|
constructor({
|
|
2934
3606
|
cfn,
|
|
2935
|
-
|
|
2936
|
-
action,
|
|
3607
|
+
ioHelper,
|
|
2937
3608
|
stack,
|
|
2938
3609
|
stackName,
|
|
2939
3610
|
resourcesTotal,
|
|
@@ -2941,8 +3612,7 @@ var StackActivityMonitor = class {
|
|
|
2941
3612
|
pollingInterval = 2e3
|
|
2942
3613
|
}) {
|
|
2943
3614
|
this.errors = [];
|
|
2944
|
-
this.
|
|
2945
|
-
this.action = action;
|
|
3615
|
+
this.ioHelper = ioHelper;
|
|
2946
3616
|
this.stack = stack;
|
|
2947
3617
|
this.stackName = stackName;
|
|
2948
3618
|
this.progressMonitor = new StackProgressMonitor(resourcesTotal);
|
|
@@ -2953,8 +3623,8 @@ var StackActivityMonitor = class {
|
|
|
2953
3623
|
});
|
|
2954
3624
|
}
|
|
2955
3625
|
async start() {
|
|
2956
|
-
this.monitorId =
|
|
2957
|
-
await this.
|
|
3626
|
+
this.monitorId = uuid2.v4();
|
|
3627
|
+
await this.ioHelper.notify(debug3(`Deploying ${this.stackName}`, "CDK_TOOLKIT_I5501", {
|
|
2958
3628
|
deployment: this.monitorId,
|
|
2959
3629
|
stack: this.stack,
|
|
2960
3630
|
stackName: this.stackName,
|
|
@@ -2970,7 +3640,7 @@ var StackActivityMonitor = class {
|
|
|
2970
3640
|
clearTimeout(this.tickTimer);
|
|
2971
3641
|
}
|
|
2972
3642
|
await this.finalPollToEnd(oldMonitorId);
|
|
2973
|
-
await this.
|
|
3643
|
+
await this.ioHelper.notify(debug3(`Completed ${this.stackName}`, "CDK_TOOLKIT_I5503", {
|
|
2974
3644
|
deployment: oldMonitorId,
|
|
2975
3645
|
stack: this.stack,
|
|
2976
3646
|
stackName: this.stackName,
|
|
@@ -2995,9 +3665,8 @@ var StackActivityMonitor = class {
|
|
|
2995
3665
|
return;
|
|
2996
3666
|
}
|
|
2997
3667
|
} catch (e) {
|
|
2998
|
-
await this.
|
|
2999
|
-
|
|
3000
|
-
util6.format("Error occurred while monitoring stack: %s", e),
|
|
3668
|
+
await this.ioHelper.notify(error3(
|
|
3669
|
+
util7.format("Error occurred while monitoring stack: %s", e),
|
|
3001
3670
|
"CDK_TOOLKIT_E5500",
|
|
3002
3671
|
{ error: e }
|
|
3003
3672
|
));
|
|
@@ -3009,16 +3678,7 @@ var StackActivityMonitor = class {
|
|
|
3009
3678
|
if (!logicalId || !metadata) {
|
|
3010
3679
|
return void 0;
|
|
3011
3680
|
}
|
|
3012
|
-
|
|
3013
|
-
const entry = metadata[path15].filter((e) => e.type === import_cloud_assembly_schema.ArtifactMetadataEntryType.LOGICAL_ID).find((e) => e.data === logicalId);
|
|
3014
|
-
if (entry) {
|
|
3015
|
-
return {
|
|
3016
|
-
entry,
|
|
3017
|
-
constructPath: this.simplifyConstructPath(path15)
|
|
3018
|
-
};
|
|
3019
|
-
}
|
|
3020
|
-
}
|
|
3021
|
-
return void 0;
|
|
3681
|
+
return resourceMetadata(this.stack, logicalId);
|
|
3022
3682
|
}
|
|
3023
3683
|
/**
|
|
3024
3684
|
* Reads all new events from the stack history
|
|
@@ -3038,7 +3698,7 @@ var StackActivityMonitor = class {
|
|
|
3038
3698
|
progress: this.progressMonitor.progress
|
|
3039
3699
|
};
|
|
3040
3700
|
this.checkForErrors(activity);
|
|
3041
|
-
await this.
|
|
3701
|
+
await this.ioHelper.notify(info3(this.formatActivity(activity, true), "CDK_TOOLKIT_I5502", activity));
|
|
3042
3702
|
}
|
|
3043
3703
|
}
|
|
3044
3704
|
/**
|
|
@@ -3061,7 +3721,7 @@ var StackActivityMonitor = class {
|
|
|
3061
3721
|
const metadata = activity.metadata;
|
|
3062
3722
|
const resourceName = metadata ? metadata.constructPath : event.LogicalResourceId || "";
|
|
3063
3723
|
const logicalId = resourceName !== event.LogicalResourceId ? `(${event.LogicalResourceId}) ` : "";
|
|
3064
|
-
return
|
|
3724
|
+
return util7.format(
|
|
3065
3725
|
"%s | %s%s | %s | %s | %s %s%s%s",
|
|
3066
3726
|
event.StackName,
|
|
3067
3727
|
progress !== false ? `${activity.progress.formatted} | ` : "",
|
|
@@ -3083,14 +3743,6 @@ var StackActivityMonitor = class {
|
|
|
3083
3743
|
}
|
|
3084
3744
|
}
|
|
3085
3745
|
}
|
|
3086
|
-
simplifyConstructPath(path15) {
|
|
3087
|
-
path15 = path15.replace(/\/Resource$/, "");
|
|
3088
|
-
path15 = path15.replace(/^\//, "");
|
|
3089
|
-
if (path15.startsWith(this.stackName + "/")) {
|
|
3090
|
-
path15 = path15.slice(this.stackName.length + 1);
|
|
3091
|
-
}
|
|
3092
|
-
return path15;
|
|
3093
|
-
}
|
|
3094
3746
|
};
|
|
3095
3747
|
|
|
3096
3748
|
// ../../aws-cdk/lib/api/stack-events/stack-status.ts
|
|
@@ -3173,7 +3825,7 @@ async function makeBodyParameter(stack, resolvedEnvironment, assetManifest, reso
|
|
|
3173
3825
|
}
|
|
3174
3826
|
const toolkitInfo = await resources.lookupToolkit();
|
|
3175
3827
|
if (!toolkitInfo.found) {
|
|
3176
|
-
|
|
3828
|
+
error2(
|
|
3177
3829
|
`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
3830
|
Run the following command in order to setup an S3 bucket in this environment, and then re-deploy:
|
|
3179
3831
|
|
|
@@ -3202,7 +3854,7 @@ Run the following command in order to setup an S3 bucket in this environment, an
|
|
|
3202
3854
|
}
|
|
3203
3855
|
);
|
|
3204
3856
|
const templateURL = `${toolkitInfo.bucketUrl}/${key}`;
|
|
3205
|
-
|
|
3857
|
+
debug2("Storing template in S3 at:", templateURL);
|
|
3206
3858
|
return { TemplateURL: templateURL };
|
|
3207
3859
|
}
|
|
3208
3860
|
async function restUrlFromManifest(url, environment) {
|
|
@@ -3306,11 +3958,11 @@ var CloudFormationStack = class _CloudFormationStack {
|
|
|
3306
3958
|
if (!this.exists) {
|
|
3307
3959
|
return {};
|
|
3308
3960
|
}
|
|
3309
|
-
const
|
|
3961
|
+
const result2 = {};
|
|
3310
3962
|
(this.stack.Outputs || []).forEach((output) => {
|
|
3311
|
-
|
|
3963
|
+
result2[output.OutputKey] = output.OutputValue;
|
|
3312
3964
|
});
|
|
3313
|
-
return
|
|
3965
|
+
return result2;
|
|
3314
3966
|
}
|
|
3315
3967
|
/**
|
|
3316
3968
|
* The stack's status
|
|
@@ -3394,23 +4046,23 @@ async function describeChangeSet(cfn, stackName, changeSetName, { fetchAll }) {
|
|
|
3394
4046
|
}
|
|
3395
4047
|
async function waitFor(valueProvider, timeout = 5e3) {
|
|
3396
4048
|
while (true) {
|
|
3397
|
-
const
|
|
3398
|
-
if (
|
|
4049
|
+
const result2 = await valueProvider();
|
|
4050
|
+
if (result2 === null) {
|
|
3399
4051
|
return void 0;
|
|
3400
|
-
} else if (
|
|
3401
|
-
return
|
|
4052
|
+
} else if (result2 !== void 0) {
|
|
4053
|
+
return result2;
|
|
3402
4054
|
}
|
|
3403
4055
|
await new Promise((cb) => setTimeout(cb, timeout));
|
|
3404
4056
|
}
|
|
3405
4057
|
}
|
|
3406
|
-
async function waitForChangeSet(cfn,
|
|
3407
|
-
await
|
|
4058
|
+
async function waitForChangeSet(cfn, ioHelper, stackName, changeSetName, { fetchAll }) {
|
|
4059
|
+
await ioHelper.notify(debug3((0, import_util19.format)("Waiting for changeset %s on stack %s to finish creating...", changeSetName, stackName)));
|
|
3408
4060
|
const ret = await waitFor(async () => {
|
|
3409
4061
|
const description = await describeChangeSet(cfn, stackName, changeSetName, {
|
|
3410
4062
|
fetchAll
|
|
3411
4063
|
});
|
|
3412
4064
|
if (description.Status === "CREATE_PENDING" || description.Status === "CREATE_IN_PROGRESS") {
|
|
3413
|
-
await
|
|
4065
|
+
await ioHelper.notify(debug3((0, import_util19.format)("Changeset %s on stack %s is still creating", changeSetName, stackName)));
|
|
3414
4066
|
return void 0;
|
|
3415
4067
|
}
|
|
3416
4068
|
if (description.Status === import_client_cloudformation3.ChangeSetStatus.CREATE_COMPLETE || changeSetHasNoChanges(description)) {
|
|
@@ -3464,8 +4116,8 @@ function changeSetHasNoChanges(description) {
|
|
|
3464
4116
|
];
|
|
3465
4117
|
return description.Status === "FAILED" && noChangeErrorPrefixes.some((p) => (description.StatusReason ?? "").startsWith(p));
|
|
3466
4118
|
}
|
|
3467
|
-
async function waitForStackDelete(cfn,
|
|
3468
|
-
const stack = await stabilizeStack(cfn,
|
|
4119
|
+
async function waitForStackDelete(cfn, ioHelper, stackName) {
|
|
4120
|
+
const stack = await stabilizeStack(cfn, ioHelper, stackName);
|
|
3469
4121
|
if (!stack) {
|
|
3470
4122
|
return void 0;
|
|
3471
4123
|
}
|
|
@@ -3479,8 +4131,8 @@ async function waitForStackDelete(cfn, { ioHost, action }, stackName) {
|
|
|
3479
4131
|
}
|
|
3480
4132
|
return stack;
|
|
3481
4133
|
}
|
|
3482
|
-
async function waitForStackDeploy(cfn,
|
|
3483
|
-
const stack = await stabilizeStack(cfn,
|
|
4134
|
+
async function waitForStackDeploy(cfn, ioHelper, stackName) {
|
|
4135
|
+
const stack = await stabilizeStack(cfn, ioHelper, stackName);
|
|
3484
4136
|
if (!stack) {
|
|
3485
4137
|
return void 0;
|
|
3486
4138
|
}
|
|
@@ -3494,20 +4146,20 @@ async function waitForStackDeploy(cfn, { ioHost, action }, stackName) {
|
|
|
3494
4146
|
}
|
|
3495
4147
|
return stack;
|
|
3496
4148
|
}
|
|
3497
|
-
async function stabilizeStack(cfn,
|
|
3498
|
-
await
|
|
4149
|
+
async function stabilizeStack(cfn, ioHelper, stackName) {
|
|
4150
|
+
await ioHelper.notify(debug3((0, import_util19.format)("Waiting for stack %s to finish creating or updating...", stackName)));
|
|
3499
4151
|
return waitFor(async () => {
|
|
3500
4152
|
const stack = await CloudFormationStack.lookup(cfn, stackName);
|
|
3501
4153
|
if (!stack.exists) {
|
|
3502
|
-
await
|
|
4154
|
+
await ioHelper.notify(debug3((0, import_util19.format)("Stack %s does not exist", stackName)));
|
|
3503
4155
|
return null;
|
|
3504
4156
|
}
|
|
3505
4157
|
const status = stack.stackStatus;
|
|
3506
4158
|
if (status.isInProgress) {
|
|
3507
|
-
await
|
|
4159
|
+
await ioHelper.notify(debug3((0, import_util19.format)("Stack %s has an ongoing operation in progress and is not stable (%s)", stackName, status)));
|
|
3508
4160
|
return void 0;
|
|
3509
4161
|
} else if (status.isReviewInProgress) {
|
|
3510
|
-
await
|
|
4162
|
+
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
4163
|
}
|
|
3512
4164
|
return stack;
|
|
3513
4165
|
});
|
|
@@ -3604,13 +4256,13 @@ var chalk12 = __toESM(require("chalk"));
|
|
|
3604
4256
|
// ../../aws-cdk/lib/api/deployments/asset-publishing.ts
|
|
3605
4257
|
var import_cx_api4 = require("@aws-cdk/cx-api");
|
|
3606
4258
|
var import_cdk_assets3 = require("cdk-assets");
|
|
3607
|
-
async function publishAssets(manifest, sdk, targetEnv, options,
|
|
4259
|
+
async function publishAssets(manifest, sdk, targetEnv, options, ioHelper) {
|
|
3608
4260
|
if (targetEnv.account === void 0 || targetEnv.account === import_cx_api4.UNKNOWN_ACCOUNT || targetEnv.region === void 0 || targetEnv.account === import_cx_api4.UNKNOWN_REGION) {
|
|
3609
4261
|
throw new ToolkitError(`Asset publishing requires resolved account and region, got ${JSON.stringify(targetEnv)}`);
|
|
3610
4262
|
}
|
|
3611
4263
|
const publisher = new import_cdk_assets3.AssetPublishing(manifest, {
|
|
3612
4264
|
aws: new PublishingAws(sdk, targetEnv),
|
|
3613
|
-
progressListener: new PublishingProgressListener(
|
|
4265
|
+
progressListener: new PublishingProgressListener(ioHelper),
|
|
3614
4266
|
throwOnError: false,
|
|
3615
4267
|
publishInParallel: options.parallel ?? true,
|
|
3616
4268
|
buildAssets: true,
|
|
@@ -3707,18 +4359,17 @@ var EVENT_TO_LEVEL = {
|
|
|
3707
4359
|
shell_close: false
|
|
3708
4360
|
};
|
|
3709
4361
|
var BasePublishProgressListener = class {
|
|
3710
|
-
constructor(
|
|
3711
|
-
this.
|
|
3712
|
-
this.action = action;
|
|
4362
|
+
constructor(ioHelper) {
|
|
4363
|
+
this.ioHelper = ioHelper;
|
|
3713
4364
|
}
|
|
3714
4365
|
onPublishEvent(type, event) {
|
|
3715
4366
|
const level = EVENT_TO_LEVEL[type];
|
|
3716
4367
|
if (level) {
|
|
3717
|
-
void this.
|
|
4368
|
+
void this.ioHelper.notify(
|
|
3718
4369
|
formatMessage({
|
|
3719
4370
|
level,
|
|
3720
|
-
|
|
3721
|
-
|
|
4371
|
+
message: this.getMessage(type, event),
|
|
4372
|
+
data: void 0
|
|
3722
4373
|
})
|
|
3723
4374
|
);
|
|
3724
4375
|
}
|
|
@@ -3731,7 +4382,7 @@ var PublishingProgressListener = class extends BasePublishProgressListener {
|
|
|
3731
4382
|
};
|
|
3732
4383
|
|
|
3733
4384
|
// ../../aws-cdk/lib/api/deployments/checks.ts
|
|
3734
|
-
async function determineAllowCrossAccountAssetPublishing(sdk,
|
|
4385
|
+
async function determineAllowCrossAccountAssetPublishing(sdk, ioHelper, customStackName) {
|
|
3735
4386
|
try {
|
|
3736
4387
|
const stackName = customStackName || "CDKToolkit";
|
|
3737
4388
|
const stackInfo = await getBootstrapStackInfo(sdk, stackName);
|
|
@@ -3743,8 +4394,8 @@ async function determineAllowCrossAccountAssetPublishing(sdk, { ioHost, action }
|
|
|
3743
4394
|
}
|
|
3744
4395
|
return false;
|
|
3745
4396
|
} catch (e) {
|
|
3746
|
-
await
|
|
3747
|
-
await
|
|
4397
|
+
await ioHelper.notify(debug3(`Error determining cross account asset publishing: ${e}`));
|
|
4398
|
+
await ioHelper.notify(debug3("Defaulting to allowing cross account asset publishing"));
|
|
3748
4399
|
return true;
|
|
3749
4400
|
}
|
|
3750
4401
|
}
|
|
@@ -3778,14 +4429,14 @@ async function getBootstrapStackInfo(sdk, stackName) {
|
|
|
3778
4429
|
// ../../aws-cdk/lib/api/deployments/deploy-stack.ts
|
|
3779
4430
|
var import_util25 = require("util");
|
|
3780
4431
|
var chalk9 = __toESM(require("chalk"));
|
|
3781
|
-
var
|
|
4432
|
+
var uuid3 = __toESM(require("uuid"));
|
|
3782
4433
|
|
|
3783
4434
|
// ../../aws-cdk/lib/api/deployments/assets.ts
|
|
3784
4435
|
var path5 = __toESM(require("path"));
|
|
3785
4436
|
var cxschema2 = __toESM(require("@aws-cdk/cloud-assembly-schema"));
|
|
3786
4437
|
var cxapi2 = __toESM(require("@aws-cdk/cx-api"));
|
|
3787
4438
|
var chalk7 = __toESM(require("chalk"));
|
|
3788
|
-
async function addMetadataAssetsToManifest(
|
|
4439
|
+
async function addMetadataAssetsToManifest(ioHelper, stack, assetManifest, envResources, reuse) {
|
|
3789
4440
|
reuse = reuse || [];
|
|
3790
4441
|
const assets = stack.assets;
|
|
3791
4442
|
if (assets.length === 0) {
|
|
@@ -3799,23 +4450,23 @@ async function addMetadataAssetsToManifest({ ioHost, action }, stack, assetManif
|
|
|
3799
4450
|
for (const asset of assets) {
|
|
3800
4451
|
const reuseAsset = reuse.indexOf(asset.id) > -1;
|
|
3801
4452
|
if (reuseAsset) {
|
|
3802
|
-
await
|
|
4453
|
+
await ioHelper.notify(debug3(`Reusing asset ${asset.id}: ${JSON.stringify(asset)}`));
|
|
3803
4454
|
continue;
|
|
3804
4455
|
}
|
|
3805
|
-
await
|
|
4456
|
+
await ioHelper.notify(debug3(`Preparing asset ${asset.id}: ${JSON.stringify(asset)}`));
|
|
3806
4457
|
if (!stack.assembly) {
|
|
3807
4458
|
throw new ToolkitError("Unexpected: stack assembly is required in order to find assets in assembly directory");
|
|
3808
4459
|
}
|
|
3809
|
-
Object.assign(params, await prepareAsset(
|
|
4460
|
+
Object.assign(params, await prepareAsset(ioHelper, asset, assetManifest, envResources, toolkitInfo));
|
|
3810
4461
|
}
|
|
3811
4462
|
return params;
|
|
3812
4463
|
}
|
|
3813
|
-
async function prepareAsset(
|
|
4464
|
+
async function prepareAsset(ioHelper, asset, assetManifest, envResources, toolkitInfo) {
|
|
3814
4465
|
switch (asset.packaging) {
|
|
3815
4466
|
case "zip":
|
|
3816
4467
|
case "file":
|
|
3817
4468
|
return prepareFileAsset(
|
|
3818
|
-
|
|
4469
|
+
ioHelper,
|
|
3819
4470
|
asset,
|
|
3820
4471
|
assetManifest,
|
|
3821
4472
|
toolkitInfo,
|
|
@@ -3827,13 +4478,13 @@ async function prepareAsset({ ioHost, action }, asset, assetManifest, envResourc
|
|
|
3827
4478
|
throw new ToolkitError(`Unsupported packaging type: ${asset.packaging}. You might need to upgrade your aws-cdk toolkit to support this asset type.`);
|
|
3828
4479
|
}
|
|
3829
4480
|
}
|
|
3830
|
-
async function prepareFileAsset(
|
|
4481
|
+
async function prepareFileAsset(ioHelper, asset, assetManifest, toolkitInfo, packaging) {
|
|
3831
4482
|
const extension = packaging === cxschema2.FileAssetPackaging.ZIP_DIRECTORY ? ".zip" : path5.extname(asset.path);
|
|
3832
4483
|
const baseName = `${asset.sourceHash}${extension}`;
|
|
3833
4484
|
const s3Prefix = asset.id === asset.sourceHash ? "assets/" : `assets/${asset.id}/`;
|
|
3834
4485
|
const key = `${s3Prefix}${baseName}`;
|
|
3835
4486
|
const s3url = `s3://${toolkitInfo.bucketName}/${key}`;
|
|
3836
|
-
await
|
|
4487
|
+
await ioHelper.notify(debug3(`Storing asset ${asset.path} at ${s3url}`));
|
|
3837
4488
|
assetManifest.addFileAsset(asset.sourceHash, {
|
|
3838
4489
|
path: asset.path,
|
|
3839
4490
|
packaging
|
|
@@ -3936,8 +4587,9 @@ var CfnEvaluationException = class extends Error {
|
|
|
3936
4587
|
};
|
|
3937
4588
|
var EvaluateCloudFormationTemplate = class _EvaluateCloudFormationTemplate {
|
|
3938
4589
|
constructor(props) {
|
|
3939
|
-
this.
|
|
3940
|
-
this.
|
|
4590
|
+
this.stackArtifact = props.stackArtifact;
|
|
4591
|
+
this.stackName = props.stackName ?? props.stackArtifact.stackName;
|
|
4592
|
+
this.template = props.template ?? props.stackArtifact.template;
|
|
3941
4593
|
this.context = {
|
|
3942
4594
|
"AWS::AccountId": props.account,
|
|
3943
4595
|
"AWS::Region": props.region,
|
|
@@ -3956,6 +4608,7 @@ var EvaluateCloudFormationTemplate = class _EvaluateCloudFormationTemplate {
|
|
|
3956
4608
|
async createNestedEvaluateCloudFormationTemplate(stackName, nestedTemplate, nestedStackParameters) {
|
|
3957
4609
|
const evaluatedParams = await this.evaluateCfnExpression(nestedStackParameters);
|
|
3958
4610
|
return new _EvaluateCloudFormationTemplate({
|
|
4611
|
+
stackArtifact: this.stackArtifact,
|
|
3959
4612
|
stackName,
|
|
3960
4613
|
template: nestedTemplate,
|
|
3961
4614
|
parameters: evaluatedParams,
|
|
@@ -4084,6 +4737,9 @@ var EvaluateCloudFormationTemplate = class _EvaluateCloudFormationTemplate {
|
|
|
4084
4737
|
getResourceProperty(logicalId, propertyName) {
|
|
4085
4738
|
return this.template.Resources?.[logicalId]?.Properties?.[propertyName];
|
|
4086
4739
|
}
|
|
4740
|
+
metadataFor(logicalId) {
|
|
4741
|
+
return resourceMetadata(this.stackArtifact, logicalId);
|
|
4742
|
+
}
|
|
4087
4743
|
references(logicalId, templateElement) {
|
|
4088
4744
|
if (typeof templateElement === "string") {
|
|
4089
4745
|
return logicalId === templateElement;
|
|
@@ -4492,16 +5148,17 @@ async function isHotswappableAppSyncChange(logicalId, change, evaluateCfnTemplat
|
|
|
4492
5148
|
} else {
|
|
4493
5149
|
physicalName = arn;
|
|
4494
5150
|
}
|
|
5151
|
+
if (!physicalName) {
|
|
5152
|
+
return ret;
|
|
5153
|
+
}
|
|
4495
5154
|
ret.push({
|
|
5155
|
+
change: {
|
|
5156
|
+
cause: change
|
|
5157
|
+
},
|
|
4496
5158
|
hotswappable: true,
|
|
4497
|
-
resourceType: change.newValue.Type,
|
|
4498
|
-
propsChanged: namesOfHotswappableChanges,
|
|
4499
5159
|
service: "appsync",
|
|
4500
5160
|
resourceNames: [`${change.newValue.Type} '${physicalName}'`],
|
|
4501
5161
|
apply: async (sdk) => {
|
|
4502
|
-
if (!physicalName) {
|
|
4503
|
-
return;
|
|
4504
|
-
}
|
|
4505
5162
|
const sdkProperties = {
|
|
4506
5163
|
...change.oldValue.Properties,
|
|
4507
5164
|
Definition: change.newValue.Properties?.Definition,
|
|
@@ -4592,12 +5249,12 @@ async function fetchFileFromS3(s3Url, sdk) {
|
|
|
4592
5249
|
async function exponentialBackOffRetry(fn, numOfRetries, backOff, errorCodeToRetry) {
|
|
4593
5250
|
try {
|
|
4594
5251
|
await fn();
|
|
4595
|
-
} catch (
|
|
4596
|
-
if (
|
|
5252
|
+
} catch (error4) {
|
|
5253
|
+
if (error4 && error4.name === errorCodeToRetry && numOfRetries > 0) {
|
|
4597
5254
|
await sleep(backOff);
|
|
4598
5255
|
await exponentialBackOffRetry(fn, numOfRetries - 1, backOff * 2, errorCodeToRetry);
|
|
4599
5256
|
} else {
|
|
4600
|
-
throw
|
|
5257
|
+
throw error4;
|
|
4601
5258
|
}
|
|
4602
5259
|
}
|
|
4603
5260
|
}
|
|
@@ -4621,16 +5278,17 @@ async function isHotswappableCodeBuildProjectChange(logicalId, change, evaluateC
|
|
|
4621
5278
|
logicalId,
|
|
4622
5279
|
change.newValue.Properties?.Name
|
|
4623
5280
|
);
|
|
5281
|
+
if (!projectName) {
|
|
5282
|
+
return ret;
|
|
5283
|
+
}
|
|
4624
5284
|
ret.push({
|
|
5285
|
+
change: {
|
|
5286
|
+
cause: change
|
|
5287
|
+
},
|
|
4625
5288
|
hotswappable: true,
|
|
4626
|
-
resourceType: change.newValue.Type,
|
|
4627
|
-
propsChanged: classifiedChanges.namesOfHotswappableProps,
|
|
4628
5289
|
service: "codebuild",
|
|
4629
5290
|
resourceNames: [`CodeBuild Project '${projectName}'`],
|
|
4630
5291
|
apply: async (sdk) => {
|
|
4631
|
-
if (!projectName) {
|
|
4632
|
-
return;
|
|
4633
|
-
}
|
|
4634
5292
|
updateProjectInput.name = projectName;
|
|
4635
5293
|
for (const updatedPropName in change.propertyUpdates) {
|
|
4636
5294
|
const updatedProp = change.propertyUpdates[updatedPropName];
|
|
@@ -4666,6 +5324,7 @@ function convertSourceCloudformationKeyToSdkKey(key) {
|
|
|
4666
5324
|
}
|
|
4667
5325
|
|
|
4668
5326
|
// ../../aws-cdk/lib/api/hotswap/ecs-services.ts
|
|
5327
|
+
var ECS_SERVICE_RESOURCE_TYPE = "AWS::ECS::Service";
|
|
4669
5328
|
async function isHotswappableEcsServiceChange(logicalId, change, evaluateCfnTemplate, hotswapPropertyOverrides) {
|
|
4670
5329
|
if (change.newValue.Type !== "AWS::ECS::TaskDefinition") {
|
|
4671
5330
|
return [];
|
|
@@ -4675,7 +5334,7 @@ async function isHotswappableEcsServiceChange(logicalId, change, evaluateCfnTemp
|
|
|
4675
5334
|
classifiedChanges.reportNonHotswappablePropertyChanges(ret);
|
|
4676
5335
|
const resourcesReferencingTaskDef = evaluateCfnTemplate.findReferencesTo(logicalId);
|
|
4677
5336
|
const ecsServiceResourcesReferencingTaskDef = resourcesReferencingTaskDef.filter(
|
|
4678
|
-
(r) => r.Type ===
|
|
5337
|
+
(r) => r.Type === ECS_SERVICE_RESOURCE_TYPE
|
|
4679
5338
|
);
|
|
4680
5339
|
const ecsServicesReferencingTaskDef = new Array();
|
|
4681
5340
|
for (const ecsServiceResource of ecsServiceResourcesReferencingTaskDef) {
|
|
@@ -4688,7 +5347,7 @@ async function isHotswappableEcsServiceChange(logicalId, change, evaluateCfnTemp
|
|
|
4688
5347
|
reportNonHotswappableChange(ret, change, void 0, "No ECS services reference the changed task definition", false);
|
|
4689
5348
|
}
|
|
4690
5349
|
if (resourcesReferencingTaskDef.length > ecsServicesReferencingTaskDef.length) {
|
|
4691
|
-
const nonEcsServiceTaskDefRefs = resourcesReferencingTaskDef.filter((r) => r.Type !==
|
|
5350
|
+
const nonEcsServiceTaskDefRefs = resourcesReferencingTaskDef.filter((r) => r.Type !== ECS_SERVICE_RESOURCE_TYPE);
|
|
4692
5351
|
for (const taskRef of nonEcsServiceTaskDefRefs) {
|
|
4693
5352
|
reportNonHotswappableChange(
|
|
4694
5353
|
ret,
|
|
@@ -4702,9 +5361,10 @@ async function isHotswappableEcsServiceChange(logicalId, change, evaluateCfnTemp
|
|
|
4702
5361
|
if (namesOfHotswappableChanges.length > 0) {
|
|
4703
5362
|
const taskDefinitionResource = await prepareTaskDefinitionChange(evaluateCfnTemplate, logicalId, change);
|
|
4704
5363
|
ret.push({
|
|
5364
|
+
change: {
|
|
5365
|
+
cause: change
|
|
5366
|
+
},
|
|
4705
5367
|
hotswappable: true,
|
|
4706
|
-
resourceType: change.newValue.Type,
|
|
4707
|
-
propsChanged: namesOfHotswappableChanges,
|
|
4708
5368
|
service: "ecs-service",
|
|
4709
5369
|
resourceNames: [
|
|
4710
5370
|
`ECS Task Definition '${await taskDefinitionResource.Family}'`,
|
|
@@ -4794,17 +5454,7 @@ var import_stream = require("stream");
|
|
|
4794
5454
|
var archiver2 = require("archiver");
|
|
4795
5455
|
async function isHotswappableLambdaFunctionChange(logicalId, change, evaluateCfnTemplate) {
|
|
4796
5456
|
if (change.newValue.Type === "AWS::Lambda::Version") {
|
|
4797
|
-
return [
|
|
4798
|
-
{
|
|
4799
|
-
hotswappable: true,
|
|
4800
|
-
resourceType: "AWS::Lambda::Version",
|
|
4801
|
-
resourceNames: [],
|
|
4802
|
-
propsChanged: [],
|
|
4803
|
-
service: "lambda",
|
|
4804
|
-
apply: async (_sdk) => {
|
|
4805
|
-
}
|
|
4806
|
-
}
|
|
4807
|
-
];
|
|
5457
|
+
return [];
|
|
4808
5458
|
}
|
|
4809
5459
|
if (change.newValue.Type === "AWS::Lambda::Alias") {
|
|
4810
5460
|
return classifyAliasChanges(change);
|
|
@@ -4820,36 +5470,27 @@ async function isHotswappableLambdaFunctionChange(logicalId, change, evaluateCfn
|
|
|
4820
5470
|
change.newValue.Properties?.FunctionName
|
|
4821
5471
|
);
|
|
4822
5472
|
const namesOfHotswappableChanges = Object.keys(classifiedChanges.hotswappableProps);
|
|
4823
|
-
if (namesOfHotswappableChanges.length > 0) {
|
|
5473
|
+
if (functionName && namesOfHotswappableChanges.length > 0) {
|
|
5474
|
+
const lambdaCodeChange = await evaluateLambdaFunctionProps(
|
|
5475
|
+
classifiedChanges.hotswappableProps,
|
|
5476
|
+
change.newValue.Properties?.Runtime,
|
|
5477
|
+
evaluateCfnTemplate
|
|
5478
|
+
);
|
|
5479
|
+
if (lambdaCodeChange === void 0) {
|
|
5480
|
+
return ret;
|
|
5481
|
+
}
|
|
5482
|
+
const dependencies = await dependantResources(logicalId, functionName, evaluateCfnTemplate);
|
|
4824
5483
|
ret.push({
|
|
5484
|
+
change: {
|
|
5485
|
+
cause: change
|
|
5486
|
+
},
|
|
4825
5487
|
hotswappable: true,
|
|
4826
|
-
resourceType: change.newValue.Type,
|
|
4827
|
-
propsChanged: namesOfHotswappableChanges,
|
|
4828
5488
|
service: "lambda",
|
|
4829
5489
|
resourceNames: [
|
|
4830
5490
|
`Lambda Function '${functionName}'`,
|
|
4831
|
-
|
|
4832
|
-
...await renderVersions(logicalId, evaluateCfnTemplate, [`Lambda Version for Function '${functionName}'`]),
|
|
4833
|
-
// add any Aliases that we are hotswapping here
|
|
4834
|
-
...await renderAliases(
|
|
4835
|
-
logicalId,
|
|
4836
|
-
evaluateCfnTemplate,
|
|
4837
|
-
async (alias) => `Lambda Alias '${alias}' for Function '${functionName}'`
|
|
4838
|
-
)
|
|
5491
|
+
...dependencies.map((d) => d.description ?? `${d.resourceType} '${d.physicalName}'`)
|
|
4839
5492
|
],
|
|
4840
5493
|
apply: async (sdk) => {
|
|
4841
|
-
const lambdaCodeChange = await evaluateLambdaFunctionProps(
|
|
4842
|
-
classifiedChanges.hotswappableProps,
|
|
4843
|
-
change.newValue.Properties?.Runtime,
|
|
4844
|
-
evaluateCfnTemplate
|
|
4845
|
-
);
|
|
4846
|
-
if (lambdaCodeChange === void 0) {
|
|
4847
|
-
return;
|
|
4848
|
-
}
|
|
4849
|
-
if (!functionName) {
|
|
4850
|
-
return;
|
|
4851
|
-
}
|
|
4852
|
-
const { versionsReferencingFunction, aliasesNames } = await versionsAndAliases(logicalId, evaluateCfnTemplate);
|
|
4853
5494
|
const lambda = sdk.lambda();
|
|
4854
5495
|
const operations = [];
|
|
4855
5496
|
if (lambdaCodeChange.code !== void 0 || lambdaCodeChange.configurations !== void 0) {
|
|
@@ -4877,17 +5518,19 @@ async function isHotswappableLambdaFunctionChange(logicalId, change, evaluateCfn
|
|
|
4877
5518
|
const updateFunctionCodeResponse = await lambda.updateFunctionConfiguration(updateRequest);
|
|
4878
5519
|
await waitForLambdasPropertiesUpdateToFinish(updateFunctionCodeResponse, lambda, functionName);
|
|
4879
5520
|
}
|
|
4880
|
-
|
|
5521
|
+
const versions = dependencies.filter((d) => d.resourceType === "AWS::Lambda::Version");
|
|
5522
|
+
if (versions.length) {
|
|
4881
5523
|
const publishVersionPromise = lambda.publishVersion({
|
|
4882
5524
|
FunctionName: functionName
|
|
4883
5525
|
});
|
|
4884
|
-
|
|
5526
|
+
const aliases = dependencies.filter((d) => d.resourceType === "AWS::Lambda::Alias");
|
|
5527
|
+
if (aliases.length) {
|
|
4885
5528
|
const versionUpdate = await publishVersionPromise;
|
|
4886
|
-
for (const alias of
|
|
5529
|
+
for (const alias of aliases) {
|
|
4887
5530
|
operations.push(
|
|
4888
5531
|
lambda.updateAlias({
|
|
4889
5532
|
FunctionName: functionName,
|
|
4890
|
-
Name: alias,
|
|
5533
|
+
Name: alias.physicalName,
|
|
4891
5534
|
FunctionVersion: versionUpdate.Version
|
|
4892
5535
|
})
|
|
4893
5536
|
);
|
|
@@ -4907,18 +5550,6 @@ function classifyAliasChanges(change) {
|
|
|
4907
5550
|
const ret = [];
|
|
4908
5551
|
const classifiedChanges = classifyChanges(change, ["FunctionVersion"]);
|
|
4909
5552
|
classifiedChanges.reportNonHotswappablePropertyChanges(ret);
|
|
4910
|
-
const namesOfHotswappableChanges = Object.keys(classifiedChanges.hotswappableProps);
|
|
4911
|
-
if (namesOfHotswappableChanges.length > 0) {
|
|
4912
|
-
ret.push({
|
|
4913
|
-
hotswappable: true,
|
|
4914
|
-
resourceType: change.newValue.Type,
|
|
4915
|
-
propsChanged: [],
|
|
4916
|
-
service: "lambda",
|
|
4917
|
-
resourceNames: [],
|
|
4918
|
-
apply: async (_sdk) => {
|
|
4919
|
-
}
|
|
4920
|
-
});
|
|
4921
|
-
}
|
|
4922
5553
|
return ret;
|
|
4923
5554
|
}
|
|
4924
5555
|
async function evaluateLambdaFunctionProps(hotswappablePropChanges, runtime, evaluateCfnTemplate) {
|
|
@@ -5023,40 +5654,54 @@ function determineCodeFileExtFromRuntime(runtime) {
|
|
|
5023
5654
|
async function versionsAndAliases(logicalId, evaluateCfnTemplate) {
|
|
5024
5655
|
const versionsReferencingFunction = evaluateCfnTemplate.findReferencesTo(logicalId).filter((r) => r.Type === "AWS::Lambda::Version");
|
|
5025
5656
|
const aliasesReferencingVersions = flatMap(versionsReferencingFunction, (v) => evaluateCfnTemplate.findReferencesTo(v.LogicalId));
|
|
5026
|
-
|
|
5027
|
-
return { versionsReferencingFunction, aliasesNames };
|
|
5028
|
-
}
|
|
5029
|
-
async function renderAliases(logicalId, evaluateCfnTemplate, callbackfn) {
|
|
5030
|
-
const aliasesNames = (await versionsAndAliases(logicalId, evaluateCfnTemplate)).aliasesNames;
|
|
5031
|
-
return Promise.all(aliasesNames.map(callbackfn));
|
|
5657
|
+
return { versionsReferencingFunction, aliasesReferencingVersions };
|
|
5032
5658
|
}
|
|
5033
|
-
async function
|
|
5034
|
-
const
|
|
5035
|
-
|
|
5659
|
+
async function dependantResources(logicalId, functionName, evaluateCfnTemplate) {
|
|
5660
|
+
const candidates = await versionsAndAliases(logicalId, evaluateCfnTemplate);
|
|
5661
|
+
const aliases = await Promise.all(candidates.aliasesReferencingVersions.map(async (a) => {
|
|
5662
|
+
const name = await evaluateCfnTemplate.evaluateCfnExpression(a.Properties?.Name);
|
|
5663
|
+
return {
|
|
5664
|
+
logicalId: a.LogicalId,
|
|
5665
|
+
physicalName: name,
|
|
5666
|
+
resourceType: "AWS::Lambda::Alias",
|
|
5667
|
+
description: `Lambda Alias '${name}' for Function '${functionName}'`
|
|
5668
|
+
};
|
|
5669
|
+
}));
|
|
5670
|
+
const versions = candidates.versionsReferencingFunction.map((v) => ({
|
|
5671
|
+
logicalId: v.LogicalId,
|
|
5672
|
+
resourceType: v.Type,
|
|
5673
|
+
description: `Lambda Version for Function '${functionName}'`
|
|
5674
|
+
}));
|
|
5675
|
+
return [
|
|
5676
|
+
...versions,
|
|
5677
|
+
...aliases
|
|
5678
|
+
];
|
|
5036
5679
|
}
|
|
5037
5680
|
|
|
5038
5681
|
// ../../aws-cdk/lib/api/hotswap/s3-bucket-deployments.ts
|
|
5039
5682
|
var REQUIRED_BY_CFN = "required-to-be-present-by-cfn";
|
|
5683
|
+
var CDK_BUCKET_DEPLOYMENT_CFN_TYPE = "Custom::CDKBucketDeployment";
|
|
5040
5684
|
async function isHotswappableS3BucketDeploymentChange(_logicalId, change, evaluateCfnTemplate) {
|
|
5041
5685
|
const ret = [];
|
|
5042
|
-
if (change.newValue.Type !==
|
|
5686
|
+
if (change.newValue.Type !== CDK_BUCKET_DEPLOYMENT_CFN_TYPE) {
|
|
5043
5687
|
return [];
|
|
5044
5688
|
}
|
|
5045
5689
|
const customResourceProperties = await evaluateCfnTemplate.evaluateCfnExpression({
|
|
5046
5690
|
...change.newValue.Properties,
|
|
5047
5691
|
ServiceToken: void 0
|
|
5048
5692
|
});
|
|
5693
|
+
const functionName = await evaluateCfnTemplate.evaluateCfnExpression(change.newValue.Properties?.ServiceToken);
|
|
5694
|
+
if (!functionName) {
|
|
5695
|
+
return ret;
|
|
5696
|
+
}
|
|
5049
5697
|
ret.push({
|
|
5698
|
+
change: {
|
|
5699
|
+
cause: change
|
|
5700
|
+
},
|
|
5050
5701
|
hotswappable: true,
|
|
5051
|
-
resourceType: change.newValue.Type,
|
|
5052
|
-
propsChanged: ["*"],
|
|
5053
5702
|
service: "custom-s3-deployment",
|
|
5054
5703
|
resourceNames: [`Contents of S3 Bucket '${customResourceProperties.DestinationBucketName}'`],
|
|
5055
5704
|
apply: async (sdk) => {
|
|
5056
|
-
const functionName = await evaluateCfnTemplate.evaluateCfnExpression(change.newValue.Properties?.ServiceToken);
|
|
5057
|
-
if (!functionName) {
|
|
5058
|
-
return;
|
|
5059
|
-
}
|
|
5060
5705
|
await sdk.lambda().invokeCommand({
|
|
5061
5706
|
FunctionName: functionName,
|
|
5062
5707
|
// Lambda refuses to take a direct JSON object and requires it to be stringify()'d
|
|
@@ -5134,16 +5779,17 @@ async function isHotswappableStateMachineChange(logicalId, change, evaluateCfnTe
|
|
|
5134
5779
|
const stateMachineArn = stateMachineNameInCfnTemplate ? await evaluateCfnTemplate.evaluateCfnExpression({
|
|
5135
5780
|
"Fn::Sub": "arn:${AWS::Partition}:states:${AWS::Region}:${AWS::AccountId}:stateMachine:" + stateMachineNameInCfnTemplate
|
|
5136
5781
|
}) : await evaluateCfnTemplate.findPhysicalNameFor(logicalId);
|
|
5782
|
+
if (!stateMachineArn) {
|
|
5783
|
+
return ret;
|
|
5784
|
+
}
|
|
5137
5785
|
ret.push({
|
|
5786
|
+
change: {
|
|
5787
|
+
cause: change
|
|
5788
|
+
},
|
|
5138
5789
|
hotswappable: true,
|
|
5139
|
-
resourceType: change.newValue.Type,
|
|
5140
|
-
propsChanged: namesOfHotswappableChanges,
|
|
5141
5790
|
service: "stepfunctions-service",
|
|
5142
5791
|
resourceNames: [`${change.newValue.Type} '${stateMachineArn?.split(":")[6]}'`],
|
|
5143
5792
|
apply: async (sdk) => {
|
|
5144
|
-
if (!stateMachineArn) {
|
|
5145
|
-
return;
|
|
5146
|
-
}
|
|
5147
5793
|
await sdk.stepFunctions().updateStateMachine({
|
|
5148
5794
|
stateMachineArn,
|
|
5149
5795
|
definition: await evaluateCfnTemplate.evaluateCfnExpression(change.propertyUpdates.DefinitionString.newValue)
|
|
@@ -5178,13 +5824,36 @@ var RESOURCE_DETECTORS = {
|
|
|
5178
5824
|
},
|
|
5179
5825
|
"AWS::CDK::Metadata": async () => []
|
|
5180
5826
|
};
|
|
5181
|
-
async function tryHotswapDeployment(sdkProvider,
|
|
5182
|
-
const
|
|
5827
|
+
async function tryHotswapDeployment(sdkProvider, ioHelper, assetParams, cloudFormationStack, stackArtifact, hotswapMode, hotswapPropertyOverrides) {
|
|
5828
|
+
const hotswapSpan = await ioHelper.span(SPAN.HOTSWAP).begin({
|
|
5829
|
+
stack: stackArtifact,
|
|
5830
|
+
mode: hotswapMode
|
|
5831
|
+
});
|
|
5832
|
+
const result2 = await hotswapDeployment(
|
|
5833
|
+
sdkProvider,
|
|
5834
|
+
hotswapSpan,
|
|
5835
|
+
assetParams,
|
|
5836
|
+
stackArtifact,
|
|
5837
|
+
hotswapMode,
|
|
5838
|
+
hotswapPropertyOverrides
|
|
5839
|
+
);
|
|
5840
|
+
await hotswapSpan.end();
|
|
5841
|
+
if (result2?.hotswapped === true) {
|
|
5842
|
+
return {
|
|
5843
|
+
type: "did-deploy-stack",
|
|
5844
|
+
noOp: result2.hotswappableChanges.length === 0,
|
|
5845
|
+
stackArn: cloudFormationStack.stackId,
|
|
5846
|
+
outputs: cloudFormationStack.outputs
|
|
5847
|
+
};
|
|
5848
|
+
}
|
|
5849
|
+
return void 0;
|
|
5850
|
+
}
|
|
5851
|
+
async function hotswapDeployment(sdkProvider, ioSpan, assetParams, stack, hotswapMode, hotswapPropertyOverrides) {
|
|
5852
|
+
const resolvedEnv = await sdkProvider.resolveEnvironment(stack.environment);
|
|
5183
5853
|
const sdk = (await sdkProvider.forEnvironment(resolvedEnv, 1 /* ForWriting */)).sdk;
|
|
5184
|
-
const currentTemplate = await loadCurrentTemplateWithNestedStacks(
|
|
5854
|
+
const currentTemplate = await loadCurrentTemplateWithNestedStacks(stack, sdk);
|
|
5185
5855
|
const evaluateCfnTemplate = new EvaluateCloudFormationTemplate({
|
|
5186
|
-
|
|
5187
|
-
template: stackArtifact.template,
|
|
5856
|
+
stackArtifact: stack,
|
|
5188
5857
|
parameters: assetParams,
|
|
5189
5858
|
account: resolvedEnv.account,
|
|
5190
5859
|
region: resolvedEnv.region,
|
|
@@ -5192,7 +5861,7 @@ async function tryHotswapDeployment(sdkProvider, { ioHost, action }, assetParams
|
|
|
5192
5861
|
sdk,
|
|
5193
5862
|
nestedStacks: currentTemplate.nestedStacks
|
|
5194
5863
|
});
|
|
5195
|
-
const stackChanges = cfn_diff.fullDiff(currentTemplate.deployedRootTemplate,
|
|
5864
|
+
const stackChanges = cfn_diff.fullDiff(currentTemplate.deployedRootTemplate, stack.template);
|
|
5196
5865
|
const { hotswappableChanges, nonHotswappableChanges } = await classifyResourceChanges(
|
|
5197
5866
|
stackChanges,
|
|
5198
5867
|
evaluateCfnTemplate,
|
|
@@ -5200,18 +5869,23 @@ async function tryHotswapDeployment(sdkProvider, { ioHost, action }, assetParams
|
|
|
5200
5869
|
currentTemplate.nestedStacks,
|
|
5201
5870
|
hotswapPropertyOverrides
|
|
5202
5871
|
);
|
|
5203
|
-
await logNonHotswappableChanges(
|
|
5204
|
-
if (hotswapMode === "fall-back"
|
|
5872
|
+
await logNonHotswappableChanges(ioSpan, nonHotswappableChanges, hotswapMode);
|
|
5873
|
+
if (hotswapMode === "fall-back") {
|
|
5205
5874
|
if (nonHotswappableChanges.length > 0) {
|
|
5206
|
-
return
|
|
5875
|
+
return {
|
|
5876
|
+
stack,
|
|
5877
|
+
hotswapped: false,
|
|
5878
|
+
hotswappableChanges,
|
|
5879
|
+
nonHotswappableChanges
|
|
5880
|
+
};
|
|
5207
5881
|
}
|
|
5208
5882
|
}
|
|
5209
|
-
await applyAllHotswappableChanges(sdk,
|
|
5883
|
+
await applyAllHotswappableChanges(sdk, ioSpan, hotswappableChanges);
|
|
5210
5884
|
return {
|
|
5211
|
-
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
|
|
5885
|
+
stack,
|
|
5886
|
+
hotswapped: true,
|
|
5887
|
+
hotswappableChanges,
|
|
5888
|
+
nonHotswappableChanges
|
|
5215
5889
|
};
|
|
5216
5890
|
}
|
|
5217
5891
|
async function classifyResourceChanges(stackChanges, evaluateCfnTemplate, sdk, nestedStackNames, hotswapPropertyOverrides) {
|
|
@@ -5397,62 +6071,62 @@ function isCandidateForHotswapping(change, logicalId) {
|
|
|
5397
6071
|
propertyUpdates: change.propertyUpdates
|
|
5398
6072
|
};
|
|
5399
6073
|
}
|
|
5400
|
-
async function applyAllHotswappableChanges(sdk,
|
|
6074
|
+
async function applyAllHotswappableChanges(sdk, ioSpan, hotswappableChanges) {
|
|
5401
6075
|
if (hotswappableChanges.length > 0) {
|
|
5402
|
-
await
|
|
6076
|
+
await ioSpan.notify(IO.DEFAULT_TOOLKIT_INFO.msg(`
|
|
5403
6077
|
${ICON} hotswapping resources:`));
|
|
5404
6078
|
}
|
|
5405
6079
|
const limit = pLimit(10);
|
|
5406
6080
|
return Promise.all(hotswappableChanges.map((hotswapOperation) => limit(() => {
|
|
5407
|
-
return applyHotswappableChange(sdk,
|
|
6081
|
+
return applyHotswappableChange(sdk, ioSpan, hotswapOperation);
|
|
5408
6082
|
})));
|
|
5409
6083
|
}
|
|
5410
|
-
async function applyHotswappableChange(sdk,
|
|
6084
|
+
async function applyHotswappableChange(sdk, ioSpan, hotswapOperation) {
|
|
5411
6085
|
const customUserAgent = `cdk-hotswap/success-${hotswapOperation.service}`;
|
|
5412
6086
|
sdk.appendCustomUserAgent(customUserAgent);
|
|
5413
6087
|
for (const name of hotswapOperation.resourceNames) {
|
|
5414
|
-
await
|
|
6088
|
+
await ioSpan.notify(IO.DEFAULT_TOOLKIT_INFO.msg((0, import_util23.format)(` ${ICON} %s`, chalk8.bold(name))));
|
|
5415
6089
|
}
|
|
5416
6090
|
try {
|
|
5417
6091
|
await hotswapOperation.apply(sdk);
|
|
5418
6092
|
} catch (e) {
|
|
5419
6093
|
if (e.name === "TimeoutError" || e.name === "AbortError") {
|
|
5420
|
-
const
|
|
5421
|
-
const
|
|
5422
|
-
|
|
5423
|
-
throw
|
|
6094
|
+
const result2 = JSON.parse(formatErrorMessage(e));
|
|
6095
|
+
const error4 = new ToolkitError(formatWaiterErrorResult(result2));
|
|
6096
|
+
error4.name = e.name;
|
|
6097
|
+
throw error4;
|
|
5424
6098
|
}
|
|
5425
6099
|
throw e;
|
|
5426
6100
|
}
|
|
5427
6101
|
for (const name of hotswapOperation.resourceNames) {
|
|
5428
|
-
await
|
|
6102
|
+
await ioSpan.notify(IO.DEFAULT_TOOLKIT_INFO.msg((0, import_util23.format)(`${ICON} %s %s`, chalk8.bold(name), chalk8.green("hotswapped!"))));
|
|
5429
6103
|
}
|
|
5430
6104
|
sdk.removeCustomUserAgent(customUserAgent);
|
|
5431
6105
|
}
|
|
5432
|
-
function formatWaiterErrorResult(
|
|
6106
|
+
function formatWaiterErrorResult(result2) {
|
|
5433
6107
|
const main = [
|
|
5434
|
-
`Resource is not in the expected state due to waiter status: ${
|
|
5435
|
-
|
|
6108
|
+
`Resource is not in the expected state due to waiter status: ${result2.state}`,
|
|
6109
|
+
result2.reason ? `${result2.reason}.` : ""
|
|
5436
6110
|
].join(". ");
|
|
5437
|
-
if (
|
|
5438
|
-
const observedResponses = Object.entries(
|
|
6111
|
+
if (result2.observedResponses != null) {
|
|
6112
|
+
const observedResponses = Object.entries(result2.observedResponses).map(([msg, count]) => ` - ${msg} (${count})`).join("\n");
|
|
5439
6113
|
return `${main} Observed responses:
|
|
5440
6114
|
${observedResponses}`;
|
|
5441
6115
|
}
|
|
5442
6116
|
return main;
|
|
5443
6117
|
}
|
|
5444
|
-
async function logNonHotswappableChanges(
|
|
6118
|
+
async function logNonHotswappableChanges(ioSpan, nonHotswappableChanges, hotswapMode) {
|
|
5445
6119
|
if (nonHotswappableChanges.length === 0) {
|
|
5446
6120
|
return;
|
|
5447
6121
|
}
|
|
5448
|
-
if (hotswapMode === "hotswap-only"
|
|
6122
|
+
if (hotswapMode === "hotswap-only") {
|
|
5449
6123
|
nonHotswappableChanges = nonHotswappableChanges.filter((change) => change.hotswapOnlyVisible === true);
|
|
5450
6124
|
if (nonHotswappableChanges.length === 0) {
|
|
5451
6125
|
return;
|
|
5452
6126
|
}
|
|
5453
6127
|
}
|
|
5454
6128
|
const messages = [""];
|
|
5455
|
-
if (hotswapMode === "hotswap-only"
|
|
6129
|
+
if (hotswapMode === "hotswap-only") {
|
|
5456
6130
|
messages.push((0, import_util23.format)("%s %s", chalk8.red("\u26A0\uFE0F"), chalk8.red("The following non-hotswappable changes were found. To reconcile these using CloudFormation, specify --hotswap-fallback")));
|
|
5457
6131
|
} else {
|
|
5458
6132
|
messages.push((0, import_util23.format)("%s %s", chalk8.red("\u26A0\uFE0F"), chalk8.red("The following non-hotswappable changes were found:")));
|
|
@@ -5476,11 +6150,11 @@ async function logNonHotswappableChanges({ ioHost, action }, nonHotswappableChan
|
|
|
5476
6150
|
}
|
|
5477
6151
|
}
|
|
5478
6152
|
messages.push("");
|
|
5479
|
-
await
|
|
6153
|
+
await ioSpan.notify(IO.DEFAULT_TOOLKIT_INFO.msg(messages.join("\n")));
|
|
5480
6154
|
}
|
|
5481
6155
|
|
|
5482
6156
|
// ../../aws-cdk/lib/api/deployments/deploy-stack.ts
|
|
5483
|
-
async function deployStack(options,
|
|
6157
|
+
async function deployStack(options, ioHelper) {
|
|
5484
6158
|
const stackArtifact = options.stack;
|
|
5485
6159
|
const stackEnv = options.resolvedEnvironment;
|
|
5486
6160
|
options.sdk.appendCustomUserAgent(options.extraUserAgent);
|
|
@@ -5488,12 +6162,11 @@ async function deployStack(options, { ioHost, action }) {
|
|
|
5488
6162
|
const deployName = options.deployName || stackArtifact.stackName;
|
|
5489
6163
|
let cloudFormationStack = await CloudFormationStack.lookup(cfn, deployName);
|
|
5490
6164
|
if (cloudFormationStack.stackStatus.isCreationFailure) {
|
|
5491
|
-
await
|
|
5492
|
-
action,
|
|
6165
|
+
await ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg(
|
|
5493
6166
|
`Found existing stack ${deployName} that had previously failed creation. Deleting it before attempting to re-create it.`
|
|
5494
6167
|
));
|
|
5495
6168
|
await cfn.deleteStack({ StackName: deployName });
|
|
5496
|
-
const deletedStack = await waitForStackDelete(cfn,
|
|
6169
|
+
const deletedStack = await waitForStackDelete(cfn, ioHelper, deployName);
|
|
5497
6170
|
if (deletedStack && deletedStack.stackStatus.name !== "DELETE_COMPLETE") {
|
|
5498
6171
|
throw new ToolkitError(
|
|
5499
6172
|
`Failed deleting stack ${deployName} that had previously failed creation (current state: ${deletedStack.stackStatus})`
|
|
@@ -5503,7 +6176,7 @@ async function deployStack(options, { ioHost, action }) {
|
|
|
5503
6176
|
}
|
|
5504
6177
|
const legacyAssets = new AssetManifestBuilder();
|
|
5505
6178
|
const assetParams = await addMetadataAssetsToManifest(
|
|
5506
|
-
|
|
6179
|
+
ioHelper,
|
|
5507
6180
|
stackArtifact,
|
|
5508
6181
|
legacyAssets,
|
|
5509
6182
|
options.envResources,
|
|
@@ -5514,11 +6187,10 @@ async function deployStack(options, { ioHost, action }) {
|
|
|
5514
6187
|
const stackParams = options.usePreviousParameters ? templateParams.updateExisting(finalParameterValues, cloudFormationStack.parameters) : templateParams.supplyAll(finalParameterValues);
|
|
5515
6188
|
const hotswapMode = options.hotswap ?? "full-deployment" /* FULL_DEPLOYMENT */;
|
|
5516
6189
|
const hotswapPropertyOverrides = options.hotswapPropertyOverrides ?? new HotswapPropertyOverrides();
|
|
5517
|
-
if (await canSkipDeploy(options, cloudFormationStack, stackParams.hasChanges(cloudFormationStack.parameters),
|
|
5518
|
-
await
|
|
6190
|
+
if (await canSkipDeploy(options, cloudFormationStack, stackParams.hasChanges(cloudFormationStack.parameters), ioHelper)) {
|
|
6191
|
+
await ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg(`${deployName}: skipping deployment (use --force to override)`));
|
|
5519
6192
|
if (hotswapMode !== "full-deployment" /* FULL_DEPLOYMENT */) {
|
|
5520
|
-
await
|
|
5521
|
-
action,
|
|
6193
|
+
await ioHelper.notify(IO.DEFAULT_TOOLKIT_INFO.msg(
|
|
5522
6194
|
(0, import_util25.format)(
|
|
5523
6195
|
`
|
|
5524
6196
|
${ICON} %s
|
|
@@ -5534,7 +6206,7 @@ async function deployStack(options, { ioHost, action }) {
|
|
|
5534
6206
|
stackArn: cloudFormationStack.stackId
|
|
5535
6207
|
};
|
|
5536
6208
|
} else {
|
|
5537
|
-
await
|
|
6209
|
+
await ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg(`${deployName}: deploying...`));
|
|
5538
6210
|
}
|
|
5539
6211
|
const bodyParameter = await makeBodyParameter(
|
|
5540
6212
|
stackArtifact,
|
|
@@ -5547,17 +6219,17 @@ async function deployStack(options, { ioHost, action }) {
|
|
|
5547
6219
|
try {
|
|
5548
6220
|
bootstrapStackName = (await options.envResources.lookupToolkit()).stackName;
|
|
5549
6221
|
} catch (e) {
|
|
5550
|
-
await
|
|
6222
|
+
await ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg(`Could not determine the bootstrap stack name: ${e}`));
|
|
5551
6223
|
}
|
|
5552
6224
|
await publishAssets(legacyAssets.toManifest(stackArtifact.assembly.directory), options.sdkProvider, stackEnv, {
|
|
5553
6225
|
parallel: options.assetParallelism,
|
|
5554
|
-
allowCrossAccount: await determineAllowCrossAccountAssetPublishing(options.sdk,
|
|
5555
|
-
},
|
|
6226
|
+
allowCrossAccount: await determineAllowCrossAccountAssetPublishing(options.sdk, ioHelper, bootstrapStackName)
|
|
6227
|
+
}, ioHelper);
|
|
5556
6228
|
if (hotswapMode !== "full-deployment" /* FULL_DEPLOYMENT */) {
|
|
5557
6229
|
try {
|
|
5558
6230
|
const hotswapDeploymentResult = await tryHotswapDeployment(
|
|
5559
6231
|
options.sdkProvider,
|
|
5560
|
-
|
|
6232
|
+
ioHelper,
|
|
5561
6233
|
stackParams.values,
|
|
5562
6234
|
cloudFormationStack,
|
|
5563
6235
|
stackArtifact,
|
|
@@ -5567,7 +6239,7 @@ async function deployStack(options, { ioHost, action }) {
|
|
|
5567
6239
|
if (hotswapDeploymentResult) {
|
|
5568
6240
|
return hotswapDeploymentResult;
|
|
5569
6241
|
}
|
|
5570
|
-
await
|
|
6242
|
+
await ioHelper.notify(IO.DEFAULT_TOOLKIT_INFO.msg((0, import_util25.format)(
|
|
5571
6243
|
"Could not perform a hotswap deployment, as the stack %s contains non-Asset changes",
|
|
5572
6244
|
stackArtifact.displayName
|
|
5573
6245
|
)));
|
|
@@ -5575,13 +6247,13 @@ async function deployStack(options, { ioHost, action }) {
|
|
|
5575
6247
|
if (!(e instanceof CfnEvaluationException)) {
|
|
5576
6248
|
throw e;
|
|
5577
6249
|
}
|
|
5578
|
-
await
|
|
6250
|
+
await ioHelper.notify(IO.DEFAULT_TOOLKIT_INFO.msg((0, import_util25.format)(
|
|
5579
6251
|
"Could not perform a hotswap deployment, because the CloudFormation template could not be resolved: %s",
|
|
5580
6252
|
formatErrorMessage(e)
|
|
5581
6253
|
)));
|
|
5582
6254
|
}
|
|
5583
6255
|
if (hotswapMode === "fall-back" /* FALL_BACK */) {
|
|
5584
|
-
await
|
|
6256
|
+
await ioHelper.notify(IO.DEFAULT_TOOLKIT_INFO.msg("Falling back to doing a full deployment"));
|
|
5585
6257
|
options.sdk.appendCustomUserAgent("cdk-hotswap/fallback");
|
|
5586
6258
|
} else {
|
|
5587
6259
|
return {
|
|
@@ -5598,25 +6270,23 @@ async function deployStack(options, { ioHost, action }) {
|
|
|
5598
6270
|
stackArtifact,
|
|
5599
6271
|
stackParams,
|
|
5600
6272
|
bodyParameter,
|
|
5601
|
-
|
|
5602
|
-
action
|
|
6273
|
+
ioHelper
|
|
5603
6274
|
);
|
|
5604
6275
|
return fullDeployment.performDeployment();
|
|
5605
6276
|
}
|
|
5606
6277
|
var FullCloudFormationDeployment = class {
|
|
5607
|
-
constructor(options, cloudFormationStack, stackArtifact, stackParams, bodyParameter,
|
|
6278
|
+
constructor(options, cloudFormationStack, stackArtifact, stackParams, bodyParameter, ioHelper) {
|
|
5608
6279
|
this.options = options;
|
|
5609
6280
|
this.cloudFormationStack = cloudFormationStack;
|
|
5610
6281
|
this.stackArtifact = stackArtifact;
|
|
5611
6282
|
this.stackParams = stackParams;
|
|
5612
6283
|
this.bodyParameter = bodyParameter;
|
|
5613
|
-
this.
|
|
5614
|
-
this.action = action;
|
|
6284
|
+
this.ioHelper = ioHelper;
|
|
5615
6285
|
this.cfn = options.sdk.cloudFormation();
|
|
5616
6286
|
this.stackName = options.deployName ?? stackArtifact.stackName;
|
|
5617
6287
|
this.update = cloudFormationStack.exists && cloudFormationStack.stackStatus.name !== "REVIEW_IN_PROGRESS";
|
|
5618
6288
|
this.verb = this.update ? "update" : "create";
|
|
5619
|
-
this.uuid =
|
|
6289
|
+
this.uuid = uuid3.v4();
|
|
5620
6290
|
}
|
|
5621
6291
|
async performDeployment() {
|
|
5622
6292
|
const deploymentMethod = this.options.deploymentMethod ?? {
|
|
@@ -5639,17 +6309,16 @@ var FullCloudFormationDeployment = class {
|
|
|
5639
6309
|
const changeSetDescription = await this.createChangeSet(changeSetName, execute, importExistingResources);
|
|
5640
6310
|
await this.updateTerminationProtection();
|
|
5641
6311
|
if (changeSetHasNoChanges(changeSetDescription)) {
|
|
5642
|
-
await this.
|
|
6312
|
+
await this.ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg((0, import_util25.format)("No changes are to be performed on %s.", this.stackName)));
|
|
5643
6313
|
if (execute) {
|
|
5644
|
-
await this.
|
|
6314
|
+
await this.ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg((0, import_util25.format)("Deleting empty change set %s", changeSetDescription.ChangeSetId)));
|
|
5645
6315
|
await this.cfn.deleteChangeSet({
|
|
5646
6316
|
StackName: this.stackName,
|
|
5647
6317
|
ChangeSetName: changeSetName
|
|
5648
6318
|
});
|
|
5649
6319
|
}
|
|
5650
6320
|
if (this.options.force) {
|
|
5651
|
-
await this.
|
|
5652
|
-
this.action,
|
|
6321
|
+
await this.ioHelper.notify(IO.DEFAULT_TOOLKIT_WARN.msg(
|
|
5653
6322
|
[
|
|
5654
6323
|
"You used the --force flag, but CloudFormation reported that the deployment would not make any changes.",
|
|
5655
6324
|
"According to CloudFormation, all resources are already up-to-date with the state in your CDK app.",
|
|
@@ -5667,7 +6336,7 @@ var FullCloudFormationDeployment = class {
|
|
|
5667
6336
|
};
|
|
5668
6337
|
}
|
|
5669
6338
|
if (!execute) {
|
|
5670
|
-
await this.
|
|
6339
|
+
await this.ioHelper.notify(IO.DEFAULT_TOOLKIT_INFO.msg((0, import_util25.format)(
|
|
5671
6340
|
"Changeset %s created and waiting in review for manual execution (--no-execute)",
|
|
5672
6341
|
changeSetDescription.ChangeSetId
|
|
5673
6342
|
)));
|
|
@@ -5694,8 +6363,8 @@ var FullCloudFormationDeployment = class {
|
|
|
5694
6363
|
}
|
|
5695
6364
|
async createChangeSet(changeSetName, willExecute, importExistingResources) {
|
|
5696
6365
|
await this.cleanupOldChangeset(changeSetName);
|
|
5697
|
-
await this.
|
|
5698
|
-
await this.
|
|
6366
|
+
await this.ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg(`Attempting to create ChangeSet with name ${changeSetName} to ${this.verb} stack ${this.stackName}`));
|
|
6367
|
+
await this.ioHelper.notify(IO.DEFAULT_TOOLKIT_INFO.msg((0, import_util25.format)("%s: creating CloudFormation changeset...", chalk9.bold(this.stackName))));
|
|
5699
6368
|
const changeSet = await this.cfn.createChangeSet({
|
|
5700
6369
|
StackName: this.stackName,
|
|
5701
6370
|
ChangeSetName: changeSetName,
|
|
@@ -5706,21 +6375,20 @@ var FullCloudFormationDeployment = class {
|
|
|
5706
6375
|
ImportExistingResources: importExistingResources,
|
|
5707
6376
|
...this.commonPrepareOptions()
|
|
5708
6377
|
});
|
|
5709
|
-
await this.
|
|
5710
|
-
return waitForChangeSet(this.cfn,
|
|
6378
|
+
await this.ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg((0, import_util25.format)("Initiated creation of changeset: %s; waiting for it to finish creating...", changeSet.Id)));
|
|
6379
|
+
return waitForChangeSet(this.cfn, this.ioHelper, this.stackName, changeSetName, {
|
|
5711
6380
|
fetchAll: willExecute
|
|
5712
6381
|
});
|
|
5713
6382
|
}
|
|
5714
6383
|
async executeChangeSet(changeSet) {
|
|
5715
|
-
await this.
|
|
6384
|
+
await this.ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg((0, import_util25.format)("Initiating execution of changeset %s on stack %s", changeSet.ChangeSetId, this.stackName)));
|
|
5716
6385
|
await this.cfn.executeChangeSet({
|
|
5717
6386
|
StackName: this.stackName,
|
|
5718
6387
|
ChangeSetName: changeSet.ChangeSetName,
|
|
5719
6388
|
ClientRequestToken: `exec${this.uuid}`,
|
|
5720
6389
|
...this.commonExecuteOptions()
|
|
5721
6390
|
});
|
|
5722
|
-
await this.
|
|
5723
|
-
this.action,
|
|
6391
|
+
await this.ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg(
|
|
5724
6392
|
(0, import_util25.format)(
|
|
5725
6393
|
"Execution of changeset %s on stack %s has started; waiting for the update to complete...",
|
|
5726
6394
|
changeSet.ChangeSetId,
|
|
@@ -5732,7 +6400,7 @@ var FullCloudFormationDeployment = class {
|
|
|
5732
6400
|
}
|
|
5733
6401
|
async cleanupOldChangeset(changeSetName) {
|
|
5734
6402
|
if (this.cloudFormationStack.exists) {
|
|
5735
|
-
await this.
|
|
6403
|
+
await this.ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg(`Removing existing change set with name ${changeSetName} if it exists`));
|
|
5736
6404
|
await this.cfn.deleteChangeSet({
|
|
5737
6405
|
StackName: this.stackName,
|
|
5738
6406
|
ChangeSetName: changeSetName
|
|
@@ -5742,8 +6410,7 @@ var FullCloudFormationDeployment = class {
|
|
|
5742
6410
|
async updateTerminationProtection() {
|
|
5743
6411
|
const terminationProtection = this.stackArtifact.terminationProtection ?? false;
|
|
5744
6412
|
if (!!this.cloudFormationStack.terminationProtection !== terminationProtection) {
|
|
5745
|
-
await this.
|
|
5746
|
-
this.action,
|
|
6413
|
+
await this.ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg(
|
|
5747
6414
|
(0, import_util25.format)(
|
|
5748
6415
|
"Updating termination protection from %s to %s for stack %s",
|
|
5749
6416
|
this.cloudFormationStack.terminationProtection,
|
|
@@ -5755,11 +6422,11 @@ var FullCloudFormationDeployment = class {
|
|
|
5755
6422
|
StackName: this.stackName,
|
|
5756
6423
|
EnableTerminationProtection: terminationProtection
|
|
5757
6424
|
});
|
|
5758
|
-
await this.
|
|
6425
|
+
await this.ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg((0, import_util25.format)("Termination protection updated to %s for stack %s", terminationProtection, this.stackName)));
|
|
5759
6426
|
}
|
|
5760
6427
|
}
|
|
5761
6428
|
async directDeployment() {
|
|
5762
|
-
await this.
|
|
6429
|
+
await this.ioHelper.notify(IO.DEFAULT_TOOLKIT_INFO.msg((0, import_util25.format)("%s: %s stack...", chalk9.bold(this.stackName), this.update ? "updating" : "creating")));
|
|
5763
6430
|
const startTime = /* @__PURE__ */ new Date();
|
|
5764
6431
|
if (this.update) {
|
|
5765
6432
|
await this.updateTerminationProtection();
|
|
@@ -5772,7 +6439,7 @@ var FullCloudFormationDeployment = class {
|
|
|
5772
6439
|
});
|
|
5773
6440
|
} catch (err) {
|
|
5774
6441
|
if (err.message === "No updates are to be performed.") {
|
|
5775
|
-
await this.
|
|
6442
|
+
await this.ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg((0, import_util25.format)("No updates are to be performed for stack %s", this.stackName)));
|
|
5776
6443
|
return {
|
|
5777
6444
|
type: "did-deploy-stack",
|
|
5778
6445
|
noOp: true,
|
|
@@ -5801,14 +6468,13 @@ var FullCloudFormationDeployment = class {
|
|
|
5801
6468
|
stack: this.stackArtifact,
|
|
5802
6469
|
stackName: this.stackName,
|
|
5803
6470
|
resourcesTotal: expectedChanges,
|
|
5804
|
-
|
|
5805
|
-
action: this.action,
|
|
6471
|
+
ioHelper: this.ioHelper,
|
|
5806
6472
|
changeSetCreationTime: startTime
|
|
5807
6473
|
});
|
|
5808
6474
|
await monitor.start();
|
|
5809
6475
|
let finalState = this.cloudFormationStack;
|
|
5810
6476
|
try {
|
|
5811
|
-
const successStack = await waitForStackDeploy(this.cfn,
|
|
6477
|
+
const successStack = await waitForStackDeploy(this.cfn, this.ioHelper, this.stackName);
|
|
5812
6478
|
if (!successStack) {
|
|
5813
6479
|
throw new ToolkitError("Stack deploy failed (the stack disappeared while we were deploying it)");
|
|
5814
6480
|
}
|
|
@@ -5818,7 +6484,7 @@ var FullCloudFormationDeployment = class {
|
|
|
5818
6484
|
} finally {
|
|
5819
6485
|
await monitor.stop();
|
|
5820
6486
|
}
|
|
5821
|
-
|
|
6487
|
+
await this.ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg((0, import_util25.format)("Stack %s has completed updating", this.stackName)));
|
|
5822
6488
|
return {
|
|
5823
6489
|
type: "did-deploy-stack",
|
|
5824
6490
|
noOp: false,
|
|
@@ -5854,7 +6520,7 @@ var FullCloudFormationDeployment = class {
|
|
|
5854
6520
|
};
|
|
5855
6521
|
}
|
|
5856
6522
|
};
|
|
5857
|
-
async function destroyStack(options,
|
|
6523
|
+
async function destroyStack(options, ioHelper) {
|
|
5858
6524
|
const deployName = options.deployName || options.stack.stackName;
|
|
5859
6525
|
const cfn = options.sdk.cloudFormation();
|
|
5860
6526
|
const currentStack = await CloudFormationStack.lookup(cfn, deployName);
|
|
@@ -5865,13 +6531,12 @@ async function destroyStack(options, { ioHost, action }) {
|
|
|
5865
6531
|
cfn,
|
|
5866
6532
|
stack: options.stack,
|
|
5867
6533
|
stackName: deployName,
|
|
5868
|
-
|
|
5869
|
-
action
|
|
6534
|
+
ioHelper
|
|
5870
6535
|
});
|
|
5871
6536
|
await monitor.start();
|
|
5872
6537
|
try {
|
|
5873
6538
|
await cfn.deleteStack({ StackName: deployName, RoleARN: options.roleArn });
|
|
5874
|
-
const destroyedStack = await waitForStackDelete(cfn,
|
|
6539
|
+
const destroyedStack = await waitForStackDelete(cfn, ioHelper, deployName);
|
|
5875
6540
|
if (destroyedStack && destroyedStack.stackStatus.name !== "DELETE_COMPLETE") {
|
|
5876
6541
|
throw new ToolkitError(`Failed to destroy ${deployName}: ${destroyedStack.stackStatus}`);
|
|
5877
6542
|
}
|
|
@@ -5883,47 +6548,47 @@ async function destroyStack(options, { ioHost, action }) {
|
|
|
5883
6548
|
}
|
|
5884
6549
|
}
|
|
5885
6550
|
}
|
|
5886
|
-
async function canSkipDeploy(deployStackOptions, cloudFormationStack, parameterChanges,
|
|
6551
|
+
async function canSkipDeploy(deployStackOptions, cloudFormationStack, parameterChanges, ioHelper) {
|
|
5887
6552
|
const deployName = deployStackOptions.deployName || deployStackOptions.stack.stackName;
|
|
5888
|
-
await
|
|
6553
|
+
await ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg(`${deployName}: checking if we can skip deploy`));
|
|
5889
6554
|
if (deployStackOptions.force) {
|
|
5890
|
-
await
|
|
6555
|
+
await ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg(`${deployName}: forced deployment`));
|
|
5891
6556
|
return false;
|
|
5892
6557
|
}
|
|
5893
6558
|
if (deployStackOptions.deploymentMethod?.method === "change-set" && deployStackOptions.deploymentMethod.execute === false) {
|
|
5894
|
-
await
|
|
6559
|
+
await ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg(`${deployName}: --no-execute, always creating change set`));
|
|
5895
6560
|
return false;
|
|
5896
6561
|
}
|
|
5897
6562
|
if (!cloudFormationStack.exists) {
|
|
5898
|
-
await
|
|
6563
|
+
await ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg(`${deployName}: no existing stack`));
|
|
5899
6564
|
return false;
|
|
5900
6565
|
}
|
|
5901
6566
|
if (JSON.stringify(deployStackOptions.stack.template) !== JSON.stringify(await cloudFormationStack.template())) {
|
|
5902
|
-
await
|
|
6567
|
+
await ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg(`${deployName}: template has changed`));
|
|
5903
6568
|
return false;
|
|
5904
6569
|
}
|
|
5905
6570
|
if (!compareTags(cloudFormationStack.tags, deployStackOptions.tags ?? [])) {
|
|
5906
|
-
await
|
|
6571
|
+
await ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg(`${deployName}: tags have changed`));
|
|
5907
6572
|
return false;
|
|
5908
6573
|
}
|
|
5909
6574
|
if (!arrayEquals(cloudFormationStack.notificationArns, deployStackOptions.notificationArns ?? [])) {
|
|
5910
|
-
await
|
|
6575
|
+
await ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg(`${deployName}: notification arns have changed`));
|
|
5911
6576
|
return false;
|
|
5912
6577
|
}
|
|
5913
6578
|
if (!!deployStackOptions.stack.terminationProtection !== !!cloudFormationStack.terminationProtection) {
|
|
5914
|
-
await
|
|
6579
|
+
await ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg(`${deployName}: termination protection has been updated`));
|
|
5915
6580
|
return false;
|
|
5916
6581
|
}
|
|
5917
6582
|
if (parameterChanges) {
|
|
5918
6583
|
if (parameterChanges === "ssm") {
|
|
5919
|
-
await
|
|
6584
|
+
await ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg(`${deployName}: some parameters come from SSM so we have to assume they may have changed`));
|
|
5920
6585
|
} else {
|
|
5921
|
-
await
|
|
6586
|
+
await ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg(`${deployName}: parameters have changed`));
|
|
5922
6587
|
}
|
|
5923
6588
|
return false;
|
|
5924
6589
|
}
|
|
5925
6590
|
if (cloudFormationStack.stackStatus.isFailure) {
|
|
5926
|
-
await
|
|
6591
|
+
await ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg(`${deployName}: stack is in a failure state`));
|
|
5927
6592
|
return false;
|
|
5928
6593
|
}
|
|
5929
6594
|
return true;
|
|
@@ -6015,7 +6680,7 @@ function loadTree(assembly) {
|
|
|
6015
6680
|
const fileName = assembly.tree()?.file;
|
|
6016
6681
|
return fileName ? fs10.readJSONSync(path9.join(outdir, fileName)).tree : {};
|
|
6017
6682
|
} catch (e) {
|
|
6018
|
-
|
|
6683
|
+
trace2(`Failed to get tree.json file: ${e}. Proceeding with empty tree.`);
|
|
6019
6684
|
return void 0;
|
|
6020
6685
|
}
|
|
6021
6686
|
}
|
|
@@ -6023,25 +6688,28 @@ function loadTreeFromDir(outdir) {
|
|
|
6023
6688
|
try {
|
|
6024
6689
|
return fs10.readJSONSync(path9.join(outdir, "tree.json")).tree;
|
|
6025
6690
|
} catch (e) {
|
|
6026
|
-
|
|
6691
|
+
trace2(`Failed to get tree.json file: ${e}. Proceeding with empty tree.`);
|
|
6027
6692
|
return void 0;
|
|
6028
6693
|
}
|
|
6029
6694
|
}
|
|
6030
6695
|
|
|
6031
6696
|
// ../../aws-cdk/lib/notices.ts
|
|
6032
6697
|
var CACHE_FILE_PATH = path10.join(cdkCacheDir(), "notices.json");
|
|
6033
|
-
var NoticesFilter = class
|
|
6034
|
-
|
|
6698
|
+
var NoticesFilter = class {
|
|
6699
|
+
constructor(ioMessages) {
|
|
6700
|
+
this.ioMessages = ioMessages;
|
|
6701
|
+
}
|
|
6702
|
+
filter(options) {
|
|
6035
6703
|
const components = [
|
|
6036
|
-
...
|
|
6037
|
-
...
|
|
6704
|
+
...this.constructTreeComponents(options.outDir),
|
|
6705
|
+
...this.otherComponents(options)
|
|
6038
6706
|
];
|
|
6039
|
-
return
|
|
6707
|
+
return this.findForNamedComponents(options.data, components);
|
|
6040
6708
|
}
|
|
6041
6709
|
/**
|
|
6042
6710
|
* From a set of input options, return the notices components we are searching for
|
|
6043
6711
|
*/
|
|
6044
|
-
|
|
6712
|
+
otherComponents(options) {
|
|
6045
6713
|
return [
|
|
6046
6714
|
// CLI
|
|
6047
6715
|
{
|
|
@@ -6059,7 +6727,7 @@ var NoticesFilter = class _NoticesFilter {
|
|
|
6059
6727
|
...options.bootstrappedEnvironments.flatMap((env) => {
|
|
6060
6728
|
const semverBootstrapVersion = semver4.coerce(env.bootstrapStackVersion);
|
|
6061
6729
|
if (!semverBootstrapVersion) {
|
|
6062
|
-
warning(`While filtering notices, could not coerce bootstrap version '${env.bootstrapStackVersion}' into semver`);
|
|
6730
|
+
this.ioMessages.warning(`While filtering notices, could not coerce bootstrap version '${env.bootstrapStackVersion}' into semver`);
|
|
6063
6731
|
return [];
|
|
6064
6732
|
}
|
|
6065
6733
|
return [{
|
|
@@ -6074,14 +6742,14 @@ var NoticesFilter = class _NoticesFilter {
|
|
|
6074
6742
|
/**
|
|
6075
6743
|
* Based on a set of component names, find all notices that match one of the given components
|
|
6076
6744
|
*/
|
|
6077
|
-
|
|
6745
|
+
findForNamedComponents(data, actualComponents) {
|
|
6078
6746
|
return data.flatMap((notice) => {
|
|
6079
6747
|
const ors = this.resolveAliases(normalizeComponents(notice.components));
|
|
6080
6748
|
for (const ands of ors) {
|
|
6081
|
-
const matched = ands.map((affected) => actualComponents.filter((actual) =>
|
|
6749
|
+
const matched = ands.map((affected) => actualComponents.filter((actual) => this.componentNameMatches(affected, actual) && semver4.satisfies(actual.version, affected.version, { includePrerelease: true })));
|
|
6082
6750
|
if (matched.every((xs) => xs.length > 0)) {
|
|
6083
6751
|
const ret = new FilteredNotice(notice);
|
|
6084
|
-
|
|
6752
|
+
this.addDynamicValues(matched.flatMap((x) => x), ret);
|
|
6085
6753
|
return [ret];
|
|
6086
6754
|
}
|
|
6087
6755
|
}
|
|
@@ -6094,7 +6762,7 @@ var NoticesFilter = class _NoticesFilter {
|
|
|
6094
6762
|
* The name matches if the name is exactly the same, or the name in the notice
|
|
6095
6763
|
* is a prefix of the node name when the query ends in '.'.
|
|
6096
6764
|
*/
|
|
6097
|
-
|
|
6765
|
+
componentNameMatches(pattern, actual) {
|
|
6098
6766
|
return pattern.name.endsWith(".") ? actual.name.startsWith(pattern.name) : pattern.name === actual.name;
|
|
6099
6767
|
}
|
|
6100
6768
|
/**
|
|
@@ -6103,7 +6771,7 @@ var NoticesFilter = class _NoticesFilter {
|
|
|
6103
6771
|
* If there are multiple components with the same dynamic name, they are joined
|
|
6104
6772
|
* by a comma.
|
|
6105
6773
|
*/
|
|
6106
|
-
|
|
6774
|
+
addDynamicValues(comps, notice) {
|
|
6107
6775
|
const dynamicValues = {};
|
|
6108
6776
|
for (const comp of comps) {
|
|
6109
6777
|
if (comp.dynamicName) {
|
|
@@ -6121,7 +6789,7 @@ var NoticesFilter = class _NoticesFilter {
|
|
|
6121
6789
|
* Because it's EITHER `aws-cdk-lib` or `@aws-cdk/core`, we need to add multiple
|
|
6122
6790
|
* arrays at the top level.
|
|
6123
6791
|
*/
|
|
6124
|
-
|
|
6792
|
+
resolveAliases(ors) {
|
|
6125
6793
|
return ors.flatMap((ands) => {
|
|
6126
6794
|
const hasFramework = ands.find((c) => c.name === "framework");
|
|
6127
6795
|
if (!hasFramework) {
|
|
@@ -6136,7 +6804,7 @@ var NoticesFilter = class _NoticesFilter {
|
|
|
6136
6804
|
/**
|
|
6137
6805
|
* Load the construct tree from the given directory and return its components
|
|
6138
6806
|
*/
|
|
6139
|
-
|
|
6807
|
+
constructTreeComponents(manifestDir) {
|
|
6140
6808
|
const tree = loadTreeFromDir(manifestDir);
|
|
6141
6809
|
if (!tree) {
|
|
6142
6810
|
return [];
|
|
@@ -6166,8 +6834,12 @@ var Notices = class _Notices {
|
|
|
6166
6834
|
this.acknowledgedIssueNumbers = new Set(this.context.get("acknowledged-issue-numbers") ?? []);
|
|
6167
6835
|
this.includeAcknowlegded = props.includeAcknowledged ?? false;
|
|
6168
6836
|
this.output = props.output ?? "cdk.out";
|
|
6169
|
-
this.shouldDisplay = props.shouldDisplay ?? true;
|
|
6170
6837
|
this.httpOptions = props.httpOptions ?? {};
|
|
6838
|
+
this.ioMessages = new IoDefaultMessages(asIoHelper(
|
|
6839
|
+
props.ioHost,
|
|
6840
|
+
"notices"
|
|
6841
|
+
/* forcing a CliAction to a ToolkitAction */
|
|
6842
|
+
));
|
|
6171
6843
|
}
|
|
6172
6844
|
/**
|
|
6173
6845
|
* Create an instance. Note that this replaces the singleton.
|
|
@@ -6203,54 +6875,54 @@ var Notices = class _Notices {
|
|
|
6203
6875
|
* If context is configured to not display notices, this will no-op.
|
|
6204
6876
|
*/
|
|
6205
6877
|
async refresh(options = {}) {
|
|
6206
|
-
if (!this.shouldDisplay) {
|
|
6207
|
-
return;
|
|
6208
|
-
}
|
|
6209
6878
|
try {
|
|
6210
|
-
const underlyingDataSource = options.dataSource ?? new WebsiteNoticeDataSource(this.httpOptions);
|
|
6211
|
-
const dataSource = new CachedDataSource(CACHE_FILE_PATH, underlyingDataSource, options.force ?? false);
|
|
6879
|
+
const underlyingDataSource = options.dataSource ?? new WebsiteNoticeDataSource(this.ioMessages, this.httpOptions);
|
|
6880
|
+
const dataSource = new CachedDataSource(this.ioMessages, CACHE_FILE_PATH, underlyingDataSource, options.force ?? false);
|
|
6212
6881
|
const notices = await dataSource.fetch();
|
|
6213
6882
|
this.data = new Set(this.includeAcknowlegded ? notices : notices.filter((n) => !this.acknowledgedIssueNumbers.has(n.issueNumber)));
|
|
6214
6883
|
} catch (e) {
|
|
6215
|
-
debug(`Could not refresh notices: ${e}`);
|
|
6884
|
+
this.ioMessages.debug(`Could not refresh notices: ${e}`);
|
|
6216
6885
|
}
|
|
6217
6886
|
}
|
|
6218
6887
|
/**
|
|
6219
6888
|
* Display the relevant notices (unless context dictates we shouldn't).
|
|
6220
6889
|
*/
|
|
6221
6890
|
display(options = {}) {
|
|
6222
|
-
|
|
6223
|
-
return;
|
|
6224
|
-
}
|
|
6225
|
-
const filteredNotices = NoticesFilter.filter({
|
|
6891
|
+
const filteredNotices = new NoticesFilter(this.ioMessages).filter({
|
|
6226
6892
|
data: Array.from(this.data),
|
|
6227
6893
|
cliVersion: versionNumber(),
|
|
6228
6894
|
outDir: this.output,
|
|
6229
6895
|
bootstrappedEnvironments: Array.from(this.bootstrappedEnvironments.values())
|
|
6230
6896
|
});
|
|
6231
6897
|
if (filteredNotices.length > 0) {
|
|
6232
|
-
|
|
6233
|
-
|
|
6234
|
-
|
|
6898
|
+
void this.ioMessages.notify(IO.CDK_TOOLKIT_I0100.msg([
|
|
6899
|
+
"",
|
|
6900
|
+
"NOTICES (What's this? https://github.com/aws/aws-cdk/wiki/CLI-Notices)",
|
|
6901
|
+
""
|
|
6902
|
+
].join("\n")));
|
|
6235
6903
|
for (const filtered of filteredNotices) {
|
|
6236
|
-
const formatted = filtered.format();
|
|
6904
|
+
const formatted = filtered.format() + "\n";
|
|
6237
6905
|
switch (filtered.notice.severity) {
|
|
6238
6906
|
case "warning":
|
|
6239
|
-
|
|
6907
|
+
void this.ioMessages.notify(IO.CDK_TOOLKIT_W0101.msg(formatted));
|
|
6240
6908
|
break;
|
|
6241
6909
|
case "error":
|
|
6242
|
-
|
|
6910
|
+
void this.ioMessages.notify(IO.CDK_TOOLKIT_E0101.msg(formatted));
|
|
6243
6911
|
break;
|
|
6244
6912
|
default:
|
|
6245
|
-
|
|
6913
|
+
void this.ioMessages.notify(IO.CDK_TOOLKIT_I0101.msg(formatted));
|
|
6914
|
+
break;
|
|
6246
6915
|
}
|
|
6247
|
-
info("");
|
|
6248
6916
|
}
|
|
6249
|
-
|
|
6917
|
+
void this.ioMessages.notify(IO.CDK_TOOLKIT_I0100.msg(
|
|
6918
|
+
`If you don\u2019t want to see a notice anymore, use "cdk acknowledge <id>". For example, "cdk acknowledge ${filteredNotices[0].notice.issueNumber}".`
|
|
6919
|
+
));
|
|
6250
6920
|
}
|
|
6251
6921
|
if (options.showTotal ?? false) {
|
|
6252
|
-
|
|
6253
|
-
|
|
6922
|
+
void this.ioMessages.notify(IO.CDK_TOOLKIT_I0100.msg(
|
|
6923
|
+
`
|
|
6924
|
+
There are ${filteredNotices.length} unacknowledged notice(s).`
|
|
6925
|
+
));
|
|
6254
6926
|
}
|
|
6255
6927
|
}
|
|
6256
6928
|
};
|
|
@@ -6291,7 +6963,8 @@ var FilteredNotice = class {
|
|
|
6291
6963
|
}
|
|
6292
6964
|
};
|
|
6293
6965
|
var WebsiteNoticeDataSource = class {
|
|
6294
|
-
constructor(options = {}) {
|
|
6966
|
+
constructor(ioMessages, options = {}) {
|
|
6967
|
+
this.ioMessages = ioMessages;
|
|
6295
6968
|
this.options = options;
|
|
6296
6969
|
}
|
|
6297
6970
|
fetch() {
|
|
@@ -6324,7 +6997,7 @@ var WebsiteNoticeDataSource = class {
|
|
|
6324
6997
|
if (!data) {
|
|
6325
6998
|
throw new ToolkitError("'notices' key is missing");
|
|
6326
6999
|
}
|
|
6327
|
-
debug("Notices refreshed");
|
|
7000
|
+
this.ioMessages.debug("Notices refreshed");
|
|
6328
7001
|
resolve3(data ?? []);
|
|
6329
7002
|
} catch (e) {
|
|
6330
7003
|
reject(new ToolkitError(`Failed to parse notices: ${formatErrorMessage(e)}`));
|
|
@@ -6348,7 +7021,8 @@ var WebsiteNoticeDataSource = class {
|
|
|
6348
7021
|
var TIME_TO_LIVE_SUCCESS = 60 * 60 * 1e3;
|
|
6349
7022
|
var TIME_TO_LIVE_ERROR = 1 * 60 * 1e3;
|
|
6350
7023
|
var CachedDataSource = class {
|
|
6351
|
-
constructor(fileName, dataSource, skipCache) {
|
|
7024
|
+
constructor(ioMessages, fileName, dataSource, skipCache) {
|
|
7025
|
+
this.ioMessages = ioMessages;
|
|
6352
7026
|
this.fileName = fileName;
|
|
6353
7027
|
this.dataSource = dataSource;
|
|
6354
7028
|
this.skipCache = skipCache;
|
|
@@ -6362,7 +7036,7 @@ var CachedDataSource = class {
|
|
|
6362
7036
|
await this.save(freshData);
|
|
6363
7037
|
return freshData.notices;
|
|
6364
7038
|
} else {
|
|
6365
|
-
debug(`Reading cached notices from ${this.fileName}`);
|
|
7039
|
+
this.ioMessages.debug(`Reading cached notices from ${this.fileName}`);
|
|
6366
7040
|
return data;
|
|
6367
7041
|
}
|
|
6368
7042
|
}
|
|
@@ -6373,7 +7047,7 @@ var CachedDataSource = class {
|
|
|
6373
7047
|
notices: await this.dataSource.fetch()
|
|
6374
7048
|
};
|
|
6375
7049
|
} catch (e) {
|
|
6376
|
-
debug(`Could not refresh notices: ${e}`);
|
|
7050
|
+
this.ioMessages.debug(`Could not refresh notices: ${e}`);
|
|
6377
7051
|
return {
|
|
6378
7052
|
expiration: Date.now() + TIME_TO_LIVE_ERROR,
|
|
6379
7053
|
notices: []
|
|
@@ -6388,7 +7062,7 @@ var CachedDataSource = class {
|
|
|
6388
7062
|
try {
|
|
6389
7063
|
return fs11.existsSync(this.fileName) ? await fs11.readJSON(this.fileName) : defaultValue;
|
|
6390
7064
|
} catch (e) {
|
|
6391
|
-
debug(`Failed to load notices from cache: ${e}`);
|
|
7065
|
+
this.ioMessages.debug(`Failed to load notices from cache: ${e}`);
|
|
6392
7066
|
return defaultValue;
|
|
6393
7067
|
}
|
|
6394
7068
|
}
|
|
@@ -6396,7 +7070,7 @@ var CachedDataSource = class {
|
|
|
6396
7070
|
try {
|
|
6397
7071
|
await fs11.writeJSON(this.fileName, cached2);
|
|
6398
7072
|
} catch (e) {
|
|
6399
|
-
debug(`Failed to store notices in the cache: ${e}`);
|
|
7073
|
+
this.ioMessages.debug(`Failed to store notices in the cache: ${e}`);
|
|
6400
7074
|
}
|
|
6401
7075
|
}
|
|
6402
7076
|
};
|
|
@@ -6420,14 +7094,13 @@ var ToolkitInfo = class _ToolkitInfo {
|
|
|
6420
7094
|
static determineName(overrideName) {
|
|
6421
7095
|
return overrideName ?? DEFAULT_TOOLKIT_STACK_NAME;
|
|
6422
7096
|
}
|
|
6423
|
-
static async lookup(environment, sdk,
|
|
7097
|
+
static async lookup(environment, sdk, ioHelper, stackName) {
|
|
6424
7098
|
const cfn = sdk.cloudFormation();
|
|
6425
7099
|
stackName = _ToolkitInfo.determineName(stackName);
|
|
6426
7100
|
try {
|
|
6427
|
-
const stack = await stabilizeStack(cfn,
|
|
7101
|
+
const stack = await stabilizeStack(cfn, ioHelper, stackName);
|
|
6428
7102
|
if (!stack) {
|
|
6429
|
-
await
|
|
6430
|
-
action,
|
|
7103
|
+
await ioHelper.notify(debug3(
|
|
6431
7104
|
(0, import_util30.format)(
|
|
6432
7105
|
"The environment %s doesn't have the CDK toolkit stack (%s) installed. Use %s to setup your environment for use with the toolkit.",
|
|
6433
7106
|
environment.name,
|
|
@@ -6438,8 +7111,7 @@ var ToolkitInfo = class _ToolkitInfo {
|
|
|
6438
7111
|
return _ToolkitInfo.bootstrapStackNotFoundInfo(stackName);
|
|
6439
7112
|
}
|
|
6440
7113
|
if (stack.stackStatus.isCreationFailure) {
|
|
6441
|
-
await
|
|
6442
|
-
action,
|
|
7114
|
+
await ioHelper.notify(debug3(
|
|
6443
7115
|
(0, import_util30.format)(
|
|
6444
7116
|
"The environment %s has a CDK toolkit stack (%s) that failed to create. Use %s to try provisioning it again.",
|
|
6445
7117
|
environment.name,
|
|
@@ -6551,21 +7223,21 @@ var EnvironmentResourcesRegistry = class {
|
|
|
6551
7223
|
this.toolkitStackName = toolkitStackName;
|
|
6552
7224
|
this.cache = /* @__PURE__ */ new Map();
|
|
6553
7225
|
}
|
|
6554
|
-
for(resolvedEnvironment, sdk,
|
|
7226
|
+
for(resolvedEnvironment, sdk, ioHelper) {
|
|
6555
7227
|
const key = `${resolvedEnvironment.account}:${resolvedEnvironment.region}`;
|
|
6556
7228
|
let envCache = this.cache.get(key);
|
|
6557
7229
|
if (!envCache) {
|
|
6558
7230
|
envCache = emptyCache();
|
|
6559
7231
|
this.cache.set(key, envCache);
|
|
6560
7232
|
}
|
|
6561
|
-
return new EnvironmentResources(resolvedEnvironment, sdk,
|
|
7233
|
+
return new EnvironmentResources(resolvedEnvironment, sdk, ioHelper, envCache, this.toolkitStackName);
|
|
6562
7234
|
}
|
|
6563
7235
|
};
|
|
6564
7236
|
var EnvironmentResources = class {
|
|
6565
|
-
constructor(environment, sdk,
|
|
7237
|
+
constructor(environment, sdk, ioHelper, cache, toolkitStackName) {
|
|
6566
7238
|
this.environment = environment;
|
|
6567
7239
|
this.sdk = sdk;
|
|
6568
|
-
this.
|
|
7240
|
+
this.ioHelper = ioHelper;
|
|
6569
7241
|
this.cache = cache;
|
|
6570
7242
|
this.toolkitStackName = toolkitStackName;
|
|
6571
7243
|
}
|
|
@@ -6574,7 +7246,7 @@ var EnvironmentResources = class {
|
|
|
6574
7246
|
*/
|
|
6575
7247
|
async lookupToolkit() {
|
|
6576
7248
|
if (!this.cache.toolkitInfo) {
|
|
6577
|
-
this.cache.toolkitInfo = await ToolkitInfo.lookup(this.environment, this.sdk, this.
|
|
7249
|
+
this.cache.toolkitInfo = await ToolkitInfo.lookup(this.environment, this.sdk, this.ioHelper, this.toolkitStackName);
|
|
6578
7250
|
}
|
|
6579
7251
|
return this.cache.toolkitInfo;
|
|
6580
7252
|
}
|
|
@@ -6602,8 +7274,7 @@ var EnvironmentResources = class {
|
|
|
6602
7274
|
}
|
|
6603
7275
|
const bootstrapStack2 = await this.lookupToolkit();
|
|
6604
7276
|
if (bootstrapStack2.found && bootstrapStack2.version < BOOTSTRAP_TEMPLATE_VERSION_INTRODUCING_GETPARAMETER) {
|
|
6605
|
-
await this.
|
|
6606
|
-
this.msg.action,
|
|
7277
|
+
await this.ioHelper.notify(warn2(
|
|
6607
7278
|
`Could not read SSM parameter ${ssmParameterName}: ${formatErrorMessage(e)}, falling back to version from ${bootstrapStack2}`
|
|
6608
7279
|
));
|
|
6609
7280
|
doValidate(bootstrapStack2.version, this.environment);
|
|
@@ -6638,10 +7309,10 @@ var EnvironmentResources = class {
|
|
|
6638
7309
|
}
|
|
6639
7310
|
const ssm = this.sdk.ssm();
|
|
6640
7311
|
try {
|
|
6641
|
-
const
|
|
6642
|
-
const asNumber = parseInt(`${
|
|
7312
|
+
const result2 = await ssm.getParameter({ Name: parameterName });
|
|
7313
|
+
const asNumber = parseInt(`${result2.Parameter?.Value}`, 10);
|
|
6643
7314
|
if (isNaN(asNumber)) {
|
|
6644
|
-
throw new ToolkitError(`SSM parameter ${parameterName} not a number: ${
|
|
7315
|
+
throw new ToolkitError(`SSM parameter ${parameterName} not a number: ${result2.Parameter?.Value}`);
|
|
6645
7316
|
}
|
|
6646
7317
|
this.cache.ssmParameters.set(parameterName, asNumber);
|
|
6647
7318
|
return asNumber;
|
|
@@ -6660,7 +7331,7 @@ var EnvironmentResources = class {
|
|
|
6660
7331
|
}
|
|
6661
7332
|
const ecr = this.sdk.ecr();
|
|
6662
7333
|
try {
|
|
6663
|
-
await this.
|
|
7334
|
+
await this.ioHelper.notify(debug3(`${repositoryName}: checking if ECR repository already exists`));
|
|
6664
7335
|
const describeResponse = await ecr.describeRepositories({
|
|
6665
7336
|
repositoryNames: [repositoryName]
|
|
6666
7337
|
});
|
|
@@ -6673,7 +7344,7 @@ var EnvironmentResources = class {
|
|
|
6673
7344
|
throw e;
|
|
6674
7345
|
}
|
|
6675
7346
|
}
|
|
6676
|
-
await this.
|
|
7347
|
+
await this.ioHelper.notify(debug3(`${repositoryName}: creating ECR repository`));
|
|
6677
7348
|
const assetTag = { Key: "awscdk:asset", Value: "true" };
|
|
6678
7349
|
const response = await ecr.createRepository({
|
|
6679
7350
|
repositoryName,
|
|
@@ -6683,7 +7354,7 @@ var EnvironmentResources = class {
|
|
|
6683
7354
|
if (!repositoryUri) {
|
|
6684
7355
|
throw new ToolkitError(`CreateRepository did not return a repository URI for ${repositoryUri}`);
|
|
6685
7356
|
}
|
|
6686
|
-
await this.
|
|
7357
|
+
await this.ioHelper.notify(debug3(`${repositoryName}: enable image scanning`));
|
|
6687
7358
|
await ecr.putImageScanningConfiguration({
|
|
6688
7359
|
repositoryName,
|
|
6689
7360
|
imageScanningConfiguration: { scanOnPush: true }
|
|
@@ -6692,8 +7363,8 @@ var EnvironmentResources = class {
|
|
|
6692
7363
|
}
|
|
6693
7364
|
};
|
|
6694
7365
|
var NoBootstrapStackEnvironmentResources = class extends EnvironmentResources {
|
|
6695
|
-
constructor(environment, sdk,
|
|
6696
|
-
super(environment, sdk,
|
|
7366
|
+
constructor(environment, sdk, ioHelper) {
|
|
7367
|
+
super(environment, sdk, ioHelper, emptyCache());
|
|
6697
7368
|
}
|
|
6698
7369
|
/**
|
|
6699
7370
|
* Look up the toolkit for a given environment, using a given SDK
|
|
@@ -6726,12 +7397,11 @@ async function replaceEnvPlaceholders(object, env, sdkProvider) {
|
|
|
6726
7397
|
|
|
6727
7398
|
// ../../aws-cdk/lib/api/environment/environment-access.ts
|
|
6728
7399
|
var EnvironmentAccess = class {
|
|
6729
|
-
constructor(sdkProvider, toolkitStackName,
|
|
7400
|
+
constructor(sdkProvider, toolkitStackName, ioHelper) {
|
|
6730
7401
|
this.sdkProvider = sdkProvider;
|
|
6731
7402
|
this.sdkCache = /* @__PURE__ */ new Map();
|
|
6732
7403
|
this.environmentResources = new EnvironmentResourcesRegistry(toolkitStackName);
|
|
6733
|
-
this.
|
|
6734
|
-
this.action = action;
|
|
7404
|
+
this.ioHelper = ioHelper;
|
|
6735
7405
|
}
|
|
6736
7406
|
/**
|
|
6737
7407
|
* Resolves the environment for a stack.
|
|
@@ -6810,7 +7480,7 @@ var EnvironmentAccess = class {
|
|
|
6810
7480
|
}
|
|
6811
7481
|
if (lookupEnv.isFallbackCredentials) {
|
|
6812
7482
|
const arn = await lookupEnv.replacePlaceholders(stack.lookupRole?.arn);
|
|
6813
|
-
await this.
|
|
7483
|
+
await this.ioHelper.notify(warn2(`Lookup role ${arn} was not assumed. Proceeding with default credentials.`));
|
|
6814
7484
|
}
|
|
6815
7485
|
return lookupEnv;
|
|
6816
7486
|
}
|
|
@@ -6832,7 +7502,7 @@ var EnvironmentAccess = class {
|
|
|
6832
7502
|
try {
|
|
6833
7503
|
return await this.accessStackForLookup(stack);
|
|
6834
7504
|
} catch (e) {
|
|
6835
|
-
await this.
|
|
7505
|
+
await this.ioHelper.notify(warn2(`${formatErrorMessage(e)}`));
|
|
6836
7506
|
}
|
|
6837
7507
|
return this.accessStackForStackOperations(stack, 0 /* ForReading */);
|
|
6838
7508
|
}
|
|
@@ -6873,7 +7543,7 @@ var EnvironmentAccess = class {
|
|
|
6873
7543
|
return {
|
|
6874
7544
|
sdk: stackSdk.sdk,
|
|
6875
7545
|
resolvedEnvironment,
|
|
6876
|
-
resources: this.environmentResources.for(resolvedEnvironment, stackSdk.sdk,
|
|
7546
|
+
resources: this.environmentResources.for(resolvedEnvironment, stackSdk.sdk, this.ioHelper),
|
|
6877
7547
|
// If we asked for a role, did not successfully assume it, and yet got here without an exception: that
|
|
6878
7548
|
// means we must have fallback credentials.
|
|
6879
7549
|
isFallbackCredentials: !stackSdk.didAssumeRole && !!assumeRoleArn,
|
|
@@ -6914,12 +7584,11 @@ var Deployments = class {
|
|
|
6914
7584
|
this.publisherCache = /* @__PURE__ */ new Map();
|
|
6915
7585
|
this.assetSdkProvider = props.sdkProvider;
|
|
6916
7586
|
this.deployStackSdkProvider = props.sdkProvider;
|
|
6917
|
-
this.
|
|
6918
|
-
this.action = props.action;
|
|
7587
|
+
this.ioHelper = props.ioHelper;
|
|
6919
7588
|
this.envs = new EnvironmentAccess(
|
|
6920
7589
|
props.sdkProvider,
|
|
6921
7590
|
props.toolkitStackName ?? DEFAULT_TOOLKIT_STACK_NAME,
|
|
6922
|
-
|
|
7591
|
+
this.ioHelper
|
|
6923
7592
|
);
|
|
6924
7593
|
}
|
|
6925
7594
|
/**
|
|
@@ -6933,12 +7602,12 @@ var Deployments = class {
|
|
|
6933
7602
|
return loadCurrentTemplateWithNestedStacks(rootStackArtifact, env.sdk, retrieveProcessedTemplate);
|
|
6934
7603
|
}
|
|
6935
7604
|
async readCurrentTemplate(stackArtifact) {
|
|
6936
|
-
await this.
|
|
7605
|
+
await this.ioHelper.notify(debug3(`Reading existing template for stack ${stackArtifact.displayName}.`));
|
|
6937
7606
|
const env = await this.envs.accessStackForLookupBestEffort(stackArtifact);
|
|
6938
7607
|
return loadCurrentTemplate(stackArtifact, env.sdk);
|
|
6939
7608
|
}
|
|
6940
7609
|
async resourceIdentifierSummaries(stackArtifact) {
|
|
6941
|
-
await this.
|
|
7610
|
+
await this.ioHelper.notify(debug3(`Retrieving template summary for stack ${stackArtifact.displayName}.`));
|
|
6942
7611
|
const env = await this.envs.accessStackForReadOnlyStackOperations(stackArtifact);
|
|
6943
7612
|
const cfn = env.sdk.cloudFormation();
|
|
6944
7613
|
await uploadStackTemplateAssets(stackArtifact, this);
|
|
@@ -6960,7 +7629,7 @@ var Deployments = class {
|
|
|
6960
7629
|
}
|
|
6961
7630
|
const response = await cfn.getTemplateSummary(cfnParam);
|
|
6962
7631
|
if (!response.ResourceIdentifierSummaries) {
|
|
6963
|
-
await this.
|
|
7632
|
+
await this.ioHelper.notify(debug3('GetTemplateSummary API call did not return "ResourceIdentifierSummaries"'));
|
|
6964
7633
|
}
|
|
6965
7634
|
return response.ResourceIdentifierSummaries ?? [];
|
|
6966
7635
|
}
|
|
@@ -7008,7 +7677,7 @@ var Deployments = class {
|
|
|
7008
7677
|
resourcesToImport: options.resourcesToImport,
|
|
7009
7678
|
overrideTemplate: options.overrideTemplate,
|
|
7010
7679
|
assetParallelism: options.assetParallelism
|
|
7011
|
-
},
|
|
7680
|
+
}, this.ioHelper);
|
|
7012
7681
|
}
|
|
7013
7682
|
async rollbackStack(options) {
|
|
7014
7683
|
let resourcesToSkip = options.orphanLogicalIds ?? [];
|
|
@@ -7032,10 +7701,10 @@ var Deployments = class {
|
|
|
7032
7701
|
const executionRoleArn = await env.replacePlaceholders(options.roleArn ?? options.stack.cloudFormationExecutionRoleArn);
|
|
7033
7702
|
switch (cloudFormationStack.stackStatus.rollbackChoice) {
|
|
7034
7703
|
case 3 /* NONE */:
|
|
7035
|
-
await this.
|
|
7704
|
+
await this.ioHelper.notify(warn2(`Stack ${deployName} does not need a rollback: ${cloudFormationStack.stackStatus}`));
|
|
7036
7705
|
return { notInRollbackableState: true };
|
|
7037
7706
|
case 0 /* START_ROLLBACK */:
|
|
7038
|
-
await this.
|
|
7707
|
+
await this.ioHelper.notify(debug3(`Initiating rollback of stack ${deployName}`));
|
|
7039
7708
|
await cfn.rollbackStack({
|
|
7040
7709
|
StackName: deployName,
|
|
7041
7710
|
RoleARN: executionRoleArn,
|
|
@@ -7054,7 +7723,7 @@ var Deployments = class {
|
|
|
7054
7723
|
resourcesToSkip = poller.resourceErrors.filter((r) => !r.isStackEvent && r.parentStackLogicalIds.length === 0).map((r) => r.event.LogicalResourceId ?? "");
|
|
7055
7724
|
}
|
|
7056
7725
|
const skipDescription = resourcesToSkip.length > 0 ? ` (orphaning: ${resourcesToSkip.join(", ")})` : "";
|
|
7057
|
-
await this.
|
|
7726
|
+
await this.ioHelper.notify(warn2(`Continuing rollback of stack ${deployName}${skipDescription}`));
|
|
7058
7727
|
await cfn.continueUpdateRollback({
|
|
7059
7728
|
StackName: deployName,
|
|
7060
7729
|
ClientRequestToken: (0, import_crypto.randomUUID)(),
|
|
@@ -7063,8 +7732,7 @@ var Deployments = class {
|
|
|
7063
7732
|
});
|
|
7064
7733
|
break;
|
|
7065
7734
|
case 2 /* ROLLBACK_FAILED */:
|
|
7066
|
-
await this.
|
|
7067
|
-
this.action,
|
|
7735
|
+
await this.ioHelper.notify(warn2(
|
|
7068
7736
|
`Stack ${deployName} failed creation and rollback. This state cannot be rolled back. You can recreate this stack by running 'cdk deploy'.`
|
|
7069
7737
|
));
|
|
7070
7738
|
return { notInRollbackableState: true };
|
|
@@ -7075,14 +7743,13 @@ var Deployments = class {
|
|
|
7075
7743
|
cfn,
|
|
7076
7744
|
stack: options.stack,
|
|
7077
7745
|
stackName: deployName,
|
|
7078
|
-
|
|
7079
|
-
action: this.action
|
|
7746
|
+
ioHelper: this.ioHelper
|
|
7080
7747
|
});
|
|
7081
7748
|
await monitor.start();
|
|
7082
7749
|
let stackErrorMessage = void 0;
|
|
7083
7750
|
let finalStackState = cloudFormationStack;
|
|
7084
7751
|
try {
|
|
7085
|
-
const successStack = await stabilizeStack(cfn,
|
|
7752
|
+
const successStack = await stabilizeStack(cfn, this.ioHelper, deployName);
|
|
7086
7753
|
if (!successStack) {
|
|
7087
7754
|
throw new ToolkitError("Stack deploy failed (the stack disappeared while we were rolling it back)");
|
|
7088
7755
|
}
|
|
@@ -7118,7 +7785,7 @@ var Deployments = class {
|
|
|
7118
7785
|
roleArn: executionRoleArn,
|
|
7119
7786
|
stack: options.stack,
|
|
7120
7787
|
deployName: options.deployName
|
|
7121
|
-
},
|
|
7788
|
+
}, this.ioHelper);
|
|
7122
7789
|
}
|
|
7123
7790
|
async stackExists(options) {
|
|
7124
7791
|
let env;
|
|
@@ -7161,7 +7828,10 @@ var Deployments = class {
|
|
|
7161
7828
|
async publishSingleAsset(assetManifest, asset, options) {
|
|
7162
7829
|
const stackEnv = await this.envs.resolveStackEnvironment(options.stack);
|
|
7163
7830
|
const publisher = this.cachedPublisher(assetManifest, stackEnv, options.stackName);
|
|
7164
|
-
await publisher.publishEntry(asset, {
|
|
7831
|
+
await publisher.publishEntry(asset, {
|
|
7832
|
+
allowCrossAccount: await this.allowCrossAccountAssetPublishingForEnv(options.stack),
|
|
7833
|
+
force: options.forcePublish
|
|
7834
|
+
});
|
|
7165
7835
|
if (publisher.hasFailures) {
|
|
7166
7836
|
throw new ToolkitError(`Failed to publish asset ${asset.displayName(true)}`);
|
|
7167
7837
|
}
|
|
@@ -7169,10 +7839,7 @@ var Deployments = class {
|
|
|
7169
7839
|
async allowCrossAccountAssetPublishingForEnv(stack) {
|
|
7170
7840
|
if (this._allowCrossAccountAssetPublishing === void 0) {
|
|
7171
7841
|
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);
|
|
7842
|
+
this._allowCrossAccountAssetPublishing = await determineAllowCrossAccountAssetPublishing(env.sdk, this.ioHelper, this.props.toolkitStackName);
|
|
7176
7843
|
}
|
|
7177
7844
|
return this._allowCrossAccountAssetPublishing;
|
|
7178
7845
|
}
|
|
@@ -7206,15 +7873,15 @@ var Deployments = class {
|
|
|
7206
7873
|
// The AssetPublishing class takes care of role assuming etc, so it's okay to
|
|
7207
7874
|
// give it a direct `SdkProvider`.
|
|
7208
7875
|
aws: new PublishingAws(this.assetSdkProvider, env),
|
|
7209
|
-
progressListener: new ParallelSafeAssetProgress(prefix,
|
|
7876
|
+
progressListener: new ParallelSafeAssetProgress(prefix, this.ioHelper)
|
|
7210
7877
|
});
|
|
7211
7878
|
this.publisherCache.set(assetManifest, publisher);
|
|
7212
7879
|
return publisher;
|
|
7213
7880
|
}
|
|
7214
7881
|
};
|
|
7215
7882
|
var ParallelSafeAssetProgress = class extends BasePublishProgressListener {
|
|
7216
|
-
constructor(prefix,
|
|
7217
|
-
super(
|
|
7883
|
+
constructor(prefix, ioHelper) {
|
|
7884
|
+
super(ioHelper);
|
|
7218
7885
|
this.prefix = prefix;
|
|
7219
7886
|
}
|
|
7220
7887
|
getMessage(type, event) {
|
|
@@ -7247,8 +7914,7 @@ var ResourceImporter = class {
|
|
|
7247
7914
|
constructor(stack, props) {
|
|
7248
7915
|
this.stack = stack;
|
|
7249
7916
|
this.cfn = props.deployments;
|
|
7250
|
-
this.
|
|
7251
|
-
this.action = props.action;
|
|
7917
|
+
this.ioHelper = props.ioHelper;
|
|
7252
7918
|
}
|
|
7253
7919
|
/**
|
|
7254
7920
|
* Ask the user for resources to import
|
|
@@ -7276,17 +7942,17 @@ var ResourceImporter = class {
|
|
|
7276
7942
|
const descr = this.describeResource(resource.logicalId);
|
|
7277
7943
|
const idProps = contents[resource.logicalId];
|
|
7278
7944
|
if (idProps) {
|
|
7279
|
-
await this.
|
|
7945
|
+
await this.ioHelper.notify(info3((0, import_util34.format)("%s: importing using %s", chalk13.blue(descr), chalk13.blue(fmtdict(idProps)))));
|
|
7280
7946
|
ret.importResources.push(resource);
|
|
7281
7947
|
ret.resourceMap[resource.logicalId] = idProps;
|
|
7282
7948
|
delete contents[resource.logicalId];
|
|
7283
7949
|
} else {
|
|
7284
|
-
await this.
|
|
7950
|
+
await this.ioHelper.notify(info3((0, import_util34.format)("%s: skipping", chalk13.blue(descr))));
|
|
7285
7951
|
}
|
|
7286
7952
|
}
|
|
7287
7953
|
const unknown = Object.keys(contents);
|
|
7288
7954
|
if (unknown.length > 0) {
|
|
7289
|
-
await this.
|
|
7955
|
+
await this.ioHelper.notify(warn2(`Unrecognized resource identifiers in mapping file: ${unknown.join(", ")}`));
|
|
7290
7956
|
}
|
|
7291
7957
|
return ret;
|
|
7292
7958
|
}
|
|
@@ -7316,18 +7982,18 @@ var ResourceImporter = class {
|
|
|
7316
7982
|
}
|
|
7317
7983
|
async importResources(overrideTemplate, resourcesToImport, options) {
|
|
7318
7984
|
try {
|
|
7319
|
-
const
|
|
7985
|
+
const result2 = await this.cfn.deployStack({
|
|
7320
7986
|
stack: this.stack,
|
|
7321
7987
|
deployName: this.stack.stackName,
|
|
7322
7988
|
...options,
|
|
7323
7989
|
overrideTemplate,
|
|
7324
7990
|
resourcesToImport
|
|
7325
7991
|
});
|
|
7326
|
-
assertIsSuccessfulDeployStackResult(
|
|
7327
|
-
const
|
|
7328
|
-
await this.
|
|
7992
|
+
assertIsSuccessfulDeployStackResult(result2);
|
|
7993
|
+
const message2 = result2.noOp ? " \u2705 %s (no changes)" : " \u2705 %s";
|
|
7994
|
+
await this.ioHelper.notify(info3("\n" + chalk13.green((0, import_util34.format)(message2, this.stack.displayName))));
|
|
7329
7995
|
} catch (e) {
|
|
7330
|
-
await this.
|
|
7996
|
+
await this.ioHelper.notify(error3((0, import_util34.format)("\n \u274C %s failed: %s", chalk13.bold(this.stack.displayName), e), "CDK_TOOLKIT_E3900"));
|
|
7331
7997
|
throw e;
|
|
7332
7998
|
}
|
|
7333
7999
|
}
|
|
@@ -7346,7 +8012,7 @@ var ResourceImporter = class {
|
|
|
7346
8012
|
if (nonAdditions.length) {
|
|
7347
8013
|
const offendingResources = nonAdditions.map(([logId, _]) => this.describeResource(logId));
|
|
7348
8014
|
if (allowNonAdditions) {
|
|
7349
|
-
await this.
|
|
8015
|
+
await this.ioHelper.notify(warn2(`Ignoring updated/deleted resources (--force): ${offendingResources.join(", ")}`));
|
|
7350
8016
|
} else {
|
|
7351
8017
|
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
8018
|
}
|
|
@@ -7419,7 +8085,7 @@ var ResourceImporter = class {
|
|
|
7419
8085
|
const resourceName = this.describeResource(chg.logicalId);
|
|
7420
8086
|
const resourceType = chg.resourceDiff.newResourceType;
|
|
7421
8087
|
if (resourceType === void 0 || !(resourceType in resourceIdentifiers)) {
|
|
7422
|
-
await this.
|
|
8088
|
+
await this.ioHelper.notify(warn2(`${resourceName}: unsupported resource type ${resourceType}, skipping import.`));
|
|
7423
8089
|
return void 0;
|
|
7424
8090
|
}
|
|
7425
8091
|
const idPropSets = resourceIdentifiers[resourceType];
|
|
@@ -7436,7 +8102,7 @@ var ResourceImporter = class {
|
|
|
7436
8102
|
}
|
|
7437
8103
|
}
|
|
7438
8104
|
if (satisfiedPropSets.length > 0) {
|
|
7439
|
-
await this.
|
|
8105
|
+
await this.ioHelper.notify(info3(chalk13.grey(`Skipping import of ${resourceName}`)));
|
|
7440
8106
|
return void 0;
|
|
7441
8107
|
}
|
|
7442
8108
|
const prefix = `${chalk13.blue(resourceName)} (${resourceType})`;
|
|
@@ -7449,7 +8115,7 @@ var ResourceImporter = class {
|
|
|
7449
8115
|
promptPattern = `${prefix}: enter %`;
|
|
7450
8116
|
}
|
|
7451
8117
|
if (preamble) {
|
|
7452
|
-
await this.
|
|
8118
|
+
await this.ioHelper.notify(info3(preamble));
|
|
7453
8119
|
}
|
|
7454
8120
|
for (const idProps of idPropSets) {
|
|
7455
8121
|
const input = {};
|
|
@@ -7473,7 +8139,7 @@ var ResourceImporter = class {
|
|
|
7473
8139
|
return input;
|
|
7474
8140
|
}
|
|
7475
8141
|
}
|
|
7476
|
-
await this.
|
|
8142
|
+
await this.ioHelper.notify(info3(chalk13.grey(`Skipping import of ${resourceName}`)));
|
|
7477
8143
|
return void 0;
|
|
7478
8144
|
}
|
|
7479
8145
|
/**
|
|
@@ -7528,8 +8194,7 @@ var fs13 = __toESM(require("fs-extra"));
|
|
|
7528
8194
|
var ResourceMigrator = class {
|
|
7529
8195
|
constructor(props) {
|
|
7530
8196
|
this.props = props;
|
|
7531
|
-
this.
|
|
7532
|
-
this.action = props.action;
|
|
8197
|
+
this.ioHelper = props.ioHelper;
|
|
7533
8198
|
}
|
|
7534
8199
|
/**
|
|
7535
8200
|
* Checks to see if a migrate.json file exists. If it does and the source is either `filepath` or
|
|
@@ -7541,16 +8206,15 @@ var ResourceMigrator = class {
|
|
|
7541
8206
|
const stack = stacks.stackArtifacts[0];
|
|
7542
8207
|
const migrateDeployment = new ResourceImporter(stack, {
|
|
7543
8208
|
deployments: this.props.deployments,
|
|
7544
|
-
|
|
7545
|
-
action: this.action
|
|
8209
|
+
ioHelper: this.ioHelper
|
|
7546
8210
|
});
|
|
7547
8211
|
const resourcesToImport = await this.tryGetResources(await migrateDeployment.resolveEnvironment());
|
|
7548
8212
|
if (resourcesToImport) {
|
|
7549
|
-
await this.
|
|
7550
|
-
await this.
|
|
8213
|
+
await this.ioHelper.notify(info3(`${chalk14.bold(stack.displayName)}: creating stack for resource migration...`));
|
|
8214
|
+
await this.ioHelper.notify(info3(`${chalk14.bold(stack.displayName)}: importing resources into stack...`));
|
|
7551
8215
|
await this.performResourceMigration(migrateDeployment, resourcesToImport, options);
|
|
7552
8216
|
fs13.rmSync("migrate.json");
|
|
7553
|
-
await this.
|
|
8217
|
+
await this.ioHelper.notify(info3(`${chalk14.bold(stack.displayName)}: applying CDKMetadata and Outputs to stack (if applicable)...`));
|
|
7554
8218
|
}
|
|
7555
8219
|
}
|
|
7556
8220
|
/**
|
|
@@ -7566,7 +8230,7 @@ var ResourceMigrator = class {
|
|
|
7566
8230
|
rollback: options.rollback
|
|
7567
8231
|
});
|
|
7568
8232
|
elapsedDeployTime = (/* @__PURE__ */ new Date()).getTime() - startDeployTime;
|
|
7569
|
-
await this.
|
|
8233
|
+
await this.ioHelper.notify(info3(`'
|
|
7570
8234
|
\u2728 Resource migration time: ${formatTime(elapsedDeployTime)}s
|
|
7571
8235
|
'`, "CDK_TOOLKIT_I5002", {
|
|
7572
8236
|
duration: elapsedDeployTime
|
|
@@ -7588,24 +8252,37 @@ var ResourceMigrator = class {
|
|
|
7588
8252
|
};
|
|
7589
8253
|
|
|
7590
8254
|
// ../../aws-cdk/lib/api/logs/logs-monitor.ts
|
|
7591
|
-
var
|
|
8255
|
+
var util8 = __toESM(require("util"));
|
|
7592
8256
|
var chalk15 = __toESM(require("chalk"));
|
|
7593
|
-
var
|
|
8257
|
+
var uuid4 = __toESM(require("uuid"));
|
|
7594
8258
|
var CloudWatchLogEventMonitor = class {
|
|
7595
|
-
constructor(
|
|
8259
|
+
constructor(props) {
|
|
7596
8260
|
/**
|
|
7597
8261
|
* Map of environment (account:region) to LogGroupsAccessSettings
|
|
7598
8262
|
*/
|
|
7599
8263
|
this.envsLogGroupsAccessSettings = /* @__PURE__ */ new Map();
|
|
7600
|
-
|
|
7601
|
-
|
|
8264
|
+
/**
|
|
8265
|
+
* After reading events from all CloudWatch log groups
|
|
8266
|
+
* how long should we wait to read more events.
|
|
8267
|
+
*
|
|
8268
|
+
* If there is some error with reading events (i.e. Throttle)
|
|
8269
|
+
* then this is also how long we wait until we try again
|
|
8270
|
+
*/
|
|
8271
|
+
this.pollingInterval = 2e3;
|
|
8272
|
+
this.startTime = props.startTime?.getTime() ?? Date.now();
|
|
8273
|
+
this.ioHelper = props.ioHelper;
|
|
7602
8274
|
}
|
|
7603
8275
|
/**
|
|
7604
8276
|
* resume reading/printing events
|
|
7605
8277
|
*/
|
|
7606
|
-
activate() {
|
|
7607
|
-
this.
|
|
7608
|
-
this.
|
|
8278
|
+
async activate() {
|
|
8279
|
+
this.monitorId = uuid4.v4();
|
|
8280
|
+
await this.ioHelper.notify(IO.CDK_TOOLKIT_I5032.msg("Start monitoring log groups", {
|
|
8281
|
+
monitor: this.monitorId,
|
|
8282
|
+
logGroupNames: this.logGroupNames()
|
|
8283
|
+
}));
|
|
8284
|
+
await this.tick();
|
|
8285
|
+
this.scheduleNextTick();
|
|
7609
8286
|
}
|
|
7610
8287
|
/**
|
|
7611
8288
|
* deactivates the monitor so no new events are read
|
|
@@ -7616,9 +8293,14 @@ var CloudWatchLogEventMonitor = class {
|
|
|
7616
8293
|
* Also resets the start time to be when the new deployment was triggered
|
|
7617
8294
|
* and clears the list of tracked log groups
|
|
7618
8295
|
*/
|
|
7619
|
-
deactivate() {
|
|
7620
|
-
|
|
8296
|
+
async deactivate() {
|
|
8297
|
+
const oldMonitorId = this.monitorId;
|
|
8298
|
+
this.monitorId = void 0;
|
|
7621
8299
|
this.startTime = Date.now();
|
|
8300
|
+
await this.ioHelper.notify(IO.CDK_TOOLKIT_I5034.msg("Stopped monitoring log groups", {
|
|
8301
|
+
monitor: oldMonitorId,
|
|
8302
|
+
logGroupNames: this.logGroupNames()
|
|
8303
|
+
}));
|
|
7622
8304
|
this.envsLogGroupsAccessSettings.clear();
|
|
7623
8305
|
}
|
|
7624
8306
|
/**
|
|
@@ -7645,22 +8327,31 @@ var CloudWatchLogEventMonitor = class {
|
|
|
7645
8327
|
}
|
|
7646
8328
|
});
|
|
7647
8329
|
}
|
|
7648
|
-
|
|
7649
|
-
|
|
8330
|
+
logGroupNames() {
|
|
8331
|
+
return Array.from(this.envsLogGroupsAccessSettings.values()).flatMap((settings) => Object.keys(settings.logGroupsStartTimes));
|
|
8332
|
+
}
|
|
8333
|
+
scheduleNextTick() {
|
|
8334
|
+
if (!this.monitorId) {
|
|
8335
|
+
return;
|
|
8336
|
+
}
|
|
8337
|
+
setTimeout(() => void this.tick(), this.pollingInterval);
|
|
7650
8338
|
}
|
|
7651
8339
|
async tick() {
|
|
7652
|
-
if (!this.
|
|
8340
|
+
if (!this.monitorId) {
|
|
7653
8341
|
return;
|
|
7654
8342
|
}
|
|
7655
8343
|
try {
|
|
7656
8344
|
const events = flatten(await this.readNewEvents());
|
|
7657
|
-
|
|
7658
|
-
this.print(event);
|
|
7659
|
-
}
|
|
8345
|
+
for (const event of events) {
|
|
8346
|
+
await this.print(event);
|
|
8347
|
+
}
|
|
8348
|
+
if (!this.monitorId) {
|
|
8349
|
+
return;
|
|
8350
|
+
}
|
|
7660
8351
|
} catch (e) {
|
|
7661
|
-
|
|
8352
|
+
await this.ioHelper.notify(IO.CDK_TOOLKIT_E5035.msg("Error occurred while monitoring logs: %s", { error: e }));
|
|
7662
8353
|
}
|
|
7663
|
-
this.scheduleNextTick(
|
|
8354
|
+
this.scheduleNextTick();
|
|
7664
8355
|
}
|
|
7665
8356
|
/**
|
|
7666
8357
|
* Reads all new log events from a set of CloudWatch Log Groups
|
|
@@ -7678,15 +8369,16 @@ var CloudWatchLogEventMonitor = class {
|
|
|
7678
8369
|
/**
|
|
7679
8370
|
* Print out a cloudwatch event
|
|
7680
8371
|
*/
|
|
7681
|
-
print(event) {
|
|
7682
|
-
|
|
7683
|
-
|
|
8372
|
+
async print(event) {
|
|
8373
|
+
await this.ioHelper.notify(IO.CDK_TOOLKIT_I5033.msg(
|
|
8374
|
+
util8.format(
|
|
7684
8375
|
"[%s] %s %s",
|
|
7685
8376
|
chalk15.blue(event.logGroupName),
|
|
7686
8377
|
chalk15.yellow(event.timestamp.toLocaleTimeString()),
|
|
7687
8378
|
event.message.trim()
|
|
7688
|
-
)
|
|
7689
|
-
|
|
8379
|
+
),
|
|
8380
|
+
event
|
|
8381
|
+
));
|
|
7690
8382
|
}
|
|
7691
8383
|
/**
|
|
7692
8384
|
* Reads all new log events from a CloudWatch Log Group
|
|
@@ -7736,19 +8428,18 @@ var CloudWatchLogEventMonitor = class {
|
|
|
7736
8428
|
|
|
7737
8429
|
// ../../aws-cdk/lib/api/logs/find-cloudwatch-logs.ts
|
|
7738
8430
|
var IGNORE_LOGS_RESOURCE_TYPES = ["AWS::EC2::FlowLog", "AWS::CloudTrail::Trail", "AWS::CodeBuild::Project"];
|
|
7739
|
-
async function findCloudWatchLogGroups(sdkProvider,
|
|
8431
|
+
async function findCloudWatchLogGroups(sdkProvider, ioHelper, stackArtifact) {
|
|
7740
8432
|
let sdk;
|
|
7741
8433
|
const resolvedEnv = await sdkProvider.resolveEnvironment(stackArtifact.environment);
|
|
7742
8434
|
try {
|
|
7743
|
-
sdk = (await new EnvironmentAccess(sdkProvider, DEFAULT_TOOLKIT_STACK_NAME,
|
|
8435
|
+
sdk = (await new EnvironmentAccess(sdkProvider, DEFAULT_TOOLKIT_STACK_NAME, ioHelper).accessStackForLookup(stackArtifact)).sdk;
|
|
7744
8436
|
} catch (e) {
|
|
7745
|
-
|
|
8437
|
+
await ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg(`Failed to access SDK environment: ${formatErrorMessage(e)}`));
|
|
7746
8438
|
sdk = (await sdkProvider.forEnvironment(resolvedEnv, 0 /* ForReading */)).sdk;
|
|
7747
8439
|
}
|
|
7748
8440
|
const listStackResources = new LazyListStackResources(sdk, stackArtifact.stackName);
|
|
7749
8441
|
const evaluateCfnTemplate = new EvaluateCloudFormationTemplate({
|
|
7750
|
-
|
|
7751
|
-
template: stackArtifact.template,
|
|
8442
|
+
stackArtifact,
|
|
7752
8443
|
parameters: {},
|
|
7753
8444
|
account: resolvedEnv.account,
|
|
7754
8445
|
region: resolvedEnv.region,
|
|
@@ -7810,12 +8501,11 @@ function findAllLogGroupNames(stackResources, evaluateCfnTemplate) {
|
|
|
7810
8501
|
|
|
7811
8502
|
// ../../aws-cdk/lib/api/work-graph/work-graph.ts
|
|
7812
8503
|
var WorkGraph = class {
|
|
7813
|
-
constructor(nodes,
|
|
8504
|
+
constructor(nodes, ioHelper) {
|
|
7814
8505
|
this.readyPool = [];
|
|
7815
8506
|
this.lazyDependencies = /* @__PURE__ */ new Map();
|
|
7816
8507
|
this.nodes = { ...nodes };
|
|
7817
|
-
this.
|
|
7818
|
-
this.action = props.action;
|
|
8508
|
+
this.ioHelper = ioHelper;
|
|
7819
8509
|
}
|
|
7820
8510
|
addNodes(...nodes) {
|
|
7821
8511
|
for (const node of nodes) {
|
|
@@ -7972,8 +8662,8 @@ var WorkGraph = class {
|
|
|
7972
8662
|
deployed(node) {
|
|
7973
8663
|
node.deploymentState = "completed" /* COMPLETED */;
|
|
7974
8664
|
}
|
|
7975
|
-
failed(node,
|
|
7976
|
-
this.error =
|
|
8665
|
+
failed(node, error4) {
|
|
8666
|
+
this.error = error4;
|
|
7977
8667
|
node.deploymentState = "failed" /* FAILED */;
|
|
7978
8668
|
this.skipRest();
|
|
7979
8669
|
this.readyPool.splice(0);
|
|
@@ -8018,7 +8708,7 @@ var WorkGraph = class {
|
|
|
8018
8708
|
* Do this in parallel, because there may be a lot of assets in an application (seen in practice: >100 assets)
|
|
8019
8709
|
*/
|
|
8020
8710
|
async removeUnnecessaryAssets(isUnnecessary) {
|
|
8021
|
-
await this.
|
|
8711
|
+
await this.ioHelper.notify(debug3("Checking for previously published assets"));
|
|
8022
8712
|
const publishes = this.nodesOfType("asset-publish");
|
|
8023
8713
|
const classifiedNodes = await parallelPromises(
|
|
8024
8714
|
8,
|
|
@@ -8028,7 +8718,7 @@ var WorkGraph = class {
|
|
|
8028
8718
|
for (const assetNode of alreadyPublished) {
|
|
8029
8719
|
this.removeNode(assetNode);
|
|
8030
8720
|
}
|
|
8031
|
-
await this.
|
|
8721
|
+
await this.ioHelper.notify(debug3(`${publishes.length} total assets, ${publishes.length - alreadyPublished.length} still need to be published`));
|
|
8032
8722
|
const unusedBuilds = this.nodesOfType("asset-build").filter((build) => this.dependees(build).length === 0);
|
|
8033
8723
|
for (const unusedBuild of unusedBuilds) {
|
|
8034
8724
|
this.removeNode(unusedBuild);
|
|
@@ -8046,7 +8736,7 @@ var WorkGraph = class {
|
|
|
8046
8736
|
this.readyPool.sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));
|
|
8047
8737
|
if (this.readyPool.length === 0 && activeCount === 0 && pendingCount > 0) {
|
|
8048
8738
|
const cycle = this.findCycle() ?? ["No cycle found!"];
|
|
8049
|
-
await this.
|
|
8739
|
+
await this.ioHelper.notify(trace3(`Cycle ${cycle.join(" -> ")} in graph ${this}`));
|
|
8050
8740
|
throw new ToolkitError(`Unable to make progress anymore, dependency cycle between remaining artifacts: ${cycle.join(" -> ")} (run with -vv for full graph)`);
|
|
8051
8741
|
}
|
|
8052
8742
|
}
|
|
@@ -8139,12 +8829,11 @@ function simplifyId(id) {
|
|
|
8139
8829
|
var cxapi3 = __toESM(require("@aws-cdk/cx-api"));
|
|
8140
8830
|
var import_cdk_assets4 = require("cdk-assets");
|
|
8141
8831
|
var WorkGraphBuilder = class _WorkGraphBuilder {
|
|
8142
|
-
constructor(
|
|
8832
|
+
constructor(ioHelper, prebuildAssets, idPrefix = "") {
|
|
8143
8833
|
this.prebuildAssets = prebuildAssets;
|
|
8144
8834
|
this.idPrefix = idPrefix;
|
|
8145
|
-
this.graph = new WorkGraph({},
|
|
8146
|
-
this.
|
|
8147
|
-
this.action = action;
|
|
8835
|
+
this.graph = new WorkGraph({}, ioHelper);
|
|
8836
|
+
this.ioHelper = ioHelper;
|
|
8148
8837
|
}
|
|
8149
8838
|
static {
|
|
8150
8839
|
/**
|
|
@@ -8238,7 +8927,7 @@ var WorkGraphBuilder = class _WorkGraphBuilder {
|
|
|
8238
8927
|
} else if (cxapi3.NestedCloudAssemblyArtifact.isNestedCloudAssemblyArtifact(artifact)) {
|
|
8239
8928
|
const assembly = new cxapi3.CloudAssembly(artifact.fullPath, { topoSort: false });
|
|
8240
8929
|
const nestedGraph = new _WorkGraphBuilder(
|
|
8241
|
-
|
|
8930
|
+
this.ioHelper,
|
|
8242
8931
|
this.prebuildAssets,
|
|
8243
8932
|
`${this.idPrefix}${artifact.id}.`
|
|
8244
8933
|
).build(assembly.artifacts);
|
|
@@ -8295,24 +8984,24 @@ var path12 = __toESM(require("path"));
|
|
|
8295
8984
|
// ../../aws-cdk/lib/api/bootstrap/deploy-bootstrap.ts
|
|
8296
8985
|
var os4 = __toESM(require("os"));
|
|
8297
8986
|
var path11 = __toESM(require("path"));
|
|
8298
|
-
var
|
|
8987
|
+
var import_cloud_assembly_schema3 = require("@aws-cdk/cloud-assembly-schema");
|
|
8299
8988
|
var import_cx_api6 = require("@aws-cdk/cx-api");
|
|
8300
8989
|
var fs14 = __toESM(require("fs-extra"));
|
|
8301
8990
|
var BootstrapStack = class _BootstrapStack {
|
|
8302
|
-
constructor(sdkProvider, sdk, resolvedEnvironment, toolkitStackName, currentToolkitInfo,
|
|
8991
|
+
constructor(sdkProvider, sdk, resolvedEnvironment, toolkitStackName, currentToolkitInfo, ioHelper) {
|
|
8303
8992
|
this.sdkProvider = sdkProvider;
|
|
8304
8993
|
this.sdk = sdk;
|
|
8305
8994
|
this.resolvedEnvironment = resolvedEnvironment;
|
|
8306
8995
|
this.toolkitStackName = toolkitStackName;
|
|
8307
8996
|
this.currentToolkitInfo = currentToolkitInfo;
|
|
8308
|
-
this.
|
|
8997
|
+
this.ioHelper = ioHelper;
|
|
8309
8998
|
}
|
|
8310
|
-
static async lookup(sdkProvider, environment, toolkitStackName,
|
|
8999
|
+
static async lookup(sdkProvider, environment, toolkitStackName, ioHelper) {
|
|
8311
9000
|
toolkitStackName = toolkitStackName ?? DEFAULT_TOOLKIT_STACK_NAME;
|
|
8312
9001
|
const resolvedEnvironment = await sdkProvider.resolveEnvironment(environment);
|
|
8313
9002
|
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,
|
|
9003
|
+
const currentToolkitInfo = await ToolkitInfo.lookup(resolvedEnvironment, sdk, ioHelper, toolkitStackName);
|
|
9004
|
+
return new _BootstrapStack(sdkProvider, sdk, resolvedEnvironment, toolkitStackName, currentToolkitInfo, ioHelper);
|
|
8316
9005
|
}
|
|
8317
9006
|
get parameters() {
|
|
8318
9007
|
return this.currentToolkitInfo.found ? this.currentToolkitInfo.bootstrapStack.parameters : {};
|
|
@@ -8337,8 +9026,7 @@ var BootstrapStack = class _BootstrapStack {
|
|
|
8337
9026
|
const currentVariant = this.currentToolkitInfo.variant;
|
|
8338
9027
|
const newVariant = bootstrapVariantFromTemplate(template);
|
|
8339
9028
|
if (currentVariant !== newVariant) {
|
|
8340
|
-
await this.
|
|
8341
|
-
this.msg.action,
|
|
9029
|
+
await this.ioHelper.notify(warn2(
|
|
8342
9030
|
`Bootstrap stack already exists, containing '${currentVariant}'. Not overwriting it with a template containing '${newVariant}' (use --force if you intend to overwrite)`
|
|
8343
9031
|
));
|
|
8344
9032
|
return abortResponse;
|
|
@@ -8346,13 +9034,11 @@ var BootstrapStack = class _BootstrapStack {
|
|
|
8346
9034
|
const newVersion = bootstrapVersionFromTemplate(template);
|
|
8347
9035
|
const currentVersion = this.currentToolkitInfo.version;
|
|
8348
9036
|
if (newVersion < currentVersion) {
|
|
8349
|
-
await this.
|
|
8350
|
-
this.msg.action,
|
|
9037
|
+
await this.ioHelper.notify(warn2(
|
|
8351
9038
|
`Bootstrap stack already at version ${currentVersion}. Not downgrading it to version ${newVersion} (use --force if you intend to downgrade)`
|
|
8352
9039
|
));
|
|
8353
9040
|
if (newVersion === 0) {
|
|
8354
|
-
await this.
|
|
8355
|
-
this.msg.action,
|
|
9041
|
+
await this.ioHelper.notify(warn2(
|
|
8356
9042
|
"(Did you set the '@aws-cdk/core:newStyleStackSynthesis' feature flag in cdk.json?)"
|
|
8357
9043
|
));
|
|
8358
9044
|
}
|
|
@@ -8366,7 +9052,7 @@ var BootstrapStack = class _BootstrapStack {
|
|
|
8366
9052
|
spaces: 2
|
|
8367
9053
|
});
|
|
8368
9054
|
builder.addArtifact(this.toolkitStackName, {
|
|
8369
|
-
type:
|
|
9055
|
+
type: import_cloud_assembly_schema3.ArtifactType.AWS_CLOUDFORMATION_STACK,
|
|
8370
9056
|
environment: import_cx_api6.EnvironmentUtils.format(this.resolvedEnvironment.account, this.resolvedEnvironment.region),
|
|
8371
9057
|
properties: {
|
|
8372
9058
|
templateFile,
|
|
@@ -8386,8 +9072,8 @@ var BootstrapStack = class _BootstrapStack {
|
|
|
8386
9072
|
parameters,
|
|
8387
9073
|
usePreviousParameters: options.usePreviousParameters ?? true,
|
|
8388
9074
|
// Obviously we can't need a bootstrap stack to deploy a bootstrap stack
|
|
8389
|
-
envResources: new NoBootstrapStackEnvironmentResources(this.resolvedEnvironment, this.sdk, this.
|
|
8390
|
-
}, this.
|
|
9075
|
+
envResources: new NoBootstrapStackEnvironmentResources(this.resolvedEnvironment, this.sdk, this.ioHelper)
|
|
9076
|
+
}, this.ioHelper);
|
|
8391
9077
|
assertIsSuccessfulDeployStackResult(ret);
|
|
8392
9078
|
return ret;
|
|
8393
9079
|
}
|
|
@@ -8492,9 +9178,9 @@ function legacyBootstrapTemplate(params) {
|
|
|
8492
9178
|
|
|
8493
9179
|
// ../../aws-cdk/lib/api/bootstrap/bootstrap-environment.ts
|
|
8494
9180
|
var Bootstrapper = class {
|
|
8495
|
-
constructor(source = { source: "default" },
|
|
9181
|
+
constructor(source = { source: "default" }, ioHelper) {
|
|
8496
9182
|
this.source = source;
|
|
8497
|
-
this.
|
|
9183
|
+
this.ioHelper = ioHelper;
|
|
8498
9184
|
}
|
|
8499
9185
|
bootstrapEnvironment(environment, sdkProvider, options = {}) {
|
|
8500
9186
|
switch (this.source.source) {
|
|
@@ -8530,7 +9216,7 @@ var Bootstrapper = class {
|
|
|
8530
9216
|
throw new ToolkitError("--qualifier can only be passed for the modern bootstrap experience.");
|
|
8531
9217
|
}
|
|
8532
9218
|
const toolkitStackName = options.toolkitStackName ?? DEFAULT_TOOLKIT_STACK_NAME;
|
|
8533
|
-
const current = await BootstrapStack.lookup(sdkProvider, environment, toolkitStackName, this.
|
|
9219
|
+
const current = await BootstrapStack.lookup(sdkProvider, environment, toolkitStackName, this.ioHelper);
|
|
8534
9220
|
return current.update(
|
|
8535
9221
|
await this.loadTemplate(params),
|
|
8536
9222
|
{},
|
|
@@ -8548,7 +9234,7 @@ var Bootstrapper = class {
|
|
|
8548
9234
|
const params = options.parameters ?? {};
|
|
8549
9235
|
const bootstrapTemplate = await this.loadTemplate();
|
|
8550
9236
|
const toolkitStackName = options.toolkitStackName ?? DEFAULT_TOOLKIT_STACK_NAME;
|
|
8551
|
-
const current = await BootstrapStack.lookup(sdkProvider, environment, toolkitStackName, this.
|
|
9237
|
+
const current = await BootstrapStack.lookup(sdkProvider, environment, toolkitStackName, this.ioHelper);
|
|
8552
9238
|
const partition = await current.partition();
|
|
8553
9239
|
if (params.createCustomerMasterKey !== void 0 && params.kmsKeyId) {
|
|
8554
9240
|
throw new ToolkitError(
|
|
@@ -8575,8 +9261,7 @@ var Bootstrapper = class {
|
|
|
8575
9261
|
const cloudFormationExecutionPolicies = params.cloudFormationExecutionPolicies ?? splitCfnArray(current.parameters.CloudFormationExecutionPolicies);
|
|
8576
9262
|
if (trustedAccounts.length === 0 && cloudFormationExecutionPolicies.length === 0) {
|
|
8577
9263
|
const implicitPolicy = `arn:${partition}:iam::aws:policy/AdministratorAccess`;
|
|
8578
|
-
await this.
|
|
8579
|
-
this.msg.action,
|
|
9264
|
+
await this.ioHelper.notify(warn2(
|
|
8580
9265
|
`Using default execution policy of '${implicitPolicy}'. Pass '--cloudformation-execution-policies' to customize.`
|
|
8581
9266
|
));
|
|
8582
9267
|
} else if (cloudFormationExecutionPolicies.length === 0) {
|
|
@@ -8597,18 +9282,15 @@ var Bootstrapper = class {
|
|
|
8597
9282
|
}
|
|
8598
9283
|
if (currentPermissionsBoundary !== policyName) {
|
|
8599
9284
|
if (!currentPermissionsBoundary) {
|
|
8600
|
-
await this.
|
|
8601
|
-
this.msg.action,
|
|
9285
|
+
await this.ioHelper.notify(warn2(
|
|
8602
9286
|
`Adding new permissions boundary ${policyName}`
|
|
8603
9287
|
));
|
|
8604
9288
|
} else if (!policyName) {
|
|
8605
|
-
await this.
|
|
8606
|
-
this.msg.action,
|
|
9289
|
+
await this.ioHelper.notify(warn2(
|
|
8607
9290
|
`Removing existing permissions boundary ${currentPermissionsBoundary}`
|
|
8608
9291
|
));
|
|
8609
9292
|
} else {
|
|
8610
|
-
await this.
|
|
8611
|
-
this.msg.action,
|
|
9293
|
+
await this.ioHelper.notify(warn2(
|
|
8612
9294
|
`Changing permissions boundary from ${currentPermissionsBoundary} to ${policyName}`
|
|
8613
9295
|
));
|
|
8614
9296
|
}
|
|
@@ -8708,11 +9390,11 @@ var Bootstrapper = class {
|
|
|
8708
9390
|
}
|
|
8709
9391
|
]
|
|
8710
9392
|
};
|
|
8711
|
-
const
|
|
9393
|
+
const request2 = {
|
|
8712
9394
|
PolicyName: policyName,
|
|
8713
9395
|
PolicyDocument: JSON.stringify(policyDoc)
|
|
8714
9396
|
};
|
|
8715
|
-
const createPolicyResponse = await iam.createPolicy(
|
|
9397
|
+
const createPolicyResponse = await iam.createPolicy(request2);
|
|
8716
9398
|
if (createPolicyResponse.Policy?.Arn) {
|
|
8717
9399
|
return createPolicyResponse.Policy.Arn;
|
|
8718
9400
|
} else {
|
|
@@ -8777,8 +9459,8 @@ var AmiContextProviderPlugin = class {
|
|
|
8777
9459
|
async getValue(args) {
|
|
8778
9460
|
const region = args.region;
|
|
8779
9461
|
const account = args.account;
|
|
8780
|
-
|
|
8781
|
-
|
|
9462
|
+
info2(`Searching for AMI in ${account}:${region}`);
|
|
9463
|
+
debug2(`AMI search parameters: ${JSON.stringify(args)}`);
|
|
8782
9464
|
const ec2 = (await initContextProviderSdk(this.aws, args)).ec2();
|
|
8783
9465
|
const response = await ec2.describeImages({
|
|
8784
9466
|
Owners: args.owners,
|
|
@@ -8792,7 +9474,7 @@ var AmiContextProviderPlugin = class {
|
|
|
8792
9474
|
throw new ContextProviderError("No AMI found that matched the search criteria");
|
|
8793
9475
|
}
|
|
8794
9476
|
images.sort(descending((i) => Date.parse(i.CreationDate || "1970")));
|
|
8795
|
-
|
|
9477
|
+
debug2(`Selected image '${images[0].ImageId}' created at '${images[0].CreationDate}'`);
|
|
8796
9478
|
return images[0].ImageId;
|
|
8797
9479
|
}
|
|
8798
9480
|
};
|
|
@@ -8810,7 +9492,7 @@ var AZContextProviderPlugin = class {
|
|
|
8810
9492
|
async getValue(args) {
|
|
8811
9493
|
const region = args.region;
|
|
8812
9494
|
const account = args.account;
|
|
8813
|
-
|
|
9495
|
+
debug2(`Reading AZs for ${account}:${region}`);
|
|
8814
9496
|
const ec2 = (await initContextProviderSdk(this.aws, args)).ec2();
|
|
8815
9497
|
const response = await ec2.describeAvailabilityZones({});
|
|
8816
9498
|
if (!response.AvailabilityZones) {
|
|
@@ -8837,8 +9519,8 @@ var CcApiContextProviderPlugin = class {
|
|
|
8837
9519
|
*/
|
|
8838
9520
|
async getValue(args) {
|
|
8839
9521
|
const cloudControl = (await initContextProviderSdk(this.aws, args)).cloudControl();
|
|
8840
|
-
const
|
|
8841
|
-
return
|
|
9522
|
+
const result2 = await this.findResources(cloudControl, args);
|
|
9523
|
+
return result2;
|
|
8842
9524
|
}
|
|
8843
9525
|
async findResources(cc, args) {
|
|
8844
9526
|
if (args.exactIdentifier && args.propertyMatch) {
|
|
@@ -8863,14 +9545,14 @@ var CcApiContextProviderPlugin = class {
|
|
|
8863
9545
|
async getResource(cc, typeName, exactIdentifier, propertiesToReturn) {
|
|
8864
9546
|
const resultObjs = [];
|
|
8865
9547
|
try {
|
|
8866
|
-
const
|
|
9548
|
+
const result2 = await cc.getResource({
|
|
8867
9549
|
TypeName: typeName,
|
|
8868
9550
|
Identifier: exactIdentifier
|
|
8869
9551
|
});
|
|
8870
|
-
const id =
|
|
9552
|
+
const id = result2.ResourceDescription?.Identifier ?? "";
|
|
8871
9553
|
if (id !== "") {
|
|
8872
|
-
const propsObject = JSON.parse(
|
|
8873
|
-
const propsObj = getResultObj(propsObject,
|
|
9554
|
+
const propsObject = JSON.parse(result2.ResourceDescription?.Properties ?? "");
|
|
9555
|
+
const propsObj = getResultObj(propsObject, result2.ResourceDescription?.Identifier, propertiesToReturn);
|
|
8874
9556
|
resultObjs.push(propsObj);
|
|
8875
9557
|
} else {
|
|
8876
9558
|
throw new ContextProviderError(`Could not get resource ${exactIdentifier}.`);
|
|
@@ -8890,10 +9572,10 @@ var CcApiContextProviderPlugin = class {
|
|
|
8890
9572
|
async listResources(cc, typeName, propertyMatch, propertiesToReturn) {
|
|
8891
9573
|
const resultObjs = [];
|
|
8892
9574
|
try {
|
|
8893
|
-
const
|
|
9575
|
+
const result2 = await cc.listResources({
|
|
8894
9576
|
TypeName: typeName
|
|
8895
9577
|
});
|
|
8896
|
-
|
|
9578
|
+
result2.ResourceDescriptions?.forEach((resource) => {
|
|
8897
9579
|
const id = resource.Identifier ?? "";
|
|
8898
9580
|
if (id !== "") {
|
|
8899
9581
|
const propsObject = JSON.parse(resource.Properties ?? "");
|
|
@@ -8933,17 +9615,17 @@ var EndpointServiceAZContextProviderPlugin = class {
|
|
|
8933
9615
|
const region = args.region;
|
|
8934
9616
|
const account = args.account;
|
|
8935
9617
|
const serviceName = args.serviceName;
|
|
8936
|
-
|
|
9618
|
+
debug2(`Reading AZs for ${account}:${region}:${serviceName}`);
|
|
8937
9619
|
const ec2 = (await initContextProviderSdk(this.aws, args)).ec2();
|
|
8938
9620
|
const response = await ec2.describeVpcEndpointServices({
|
|
8939
9621
|
ServiceNames: [serviceName]
|
|
8940
9622
|
});
|
|
8941
9623
|
if (!response.ServiceDetails || response.ServiceDetails.length === 0) {
|
|
8942
|
-
|
|
9624
|
+
debug2(`Could not retrieve service details for ${account}:${region}:${serviceName}`);
|
|
8943
9625
|
return [];
|
|
8944
9626
|
}
|
|
8945
9627
|
const azs = response.ServiceDetails[0].AvailabilityZones;
|
|
8946
|
-
|
|
9628
|
+
debug2(`Endpoint service ${account}:${region}:${serviceName} is available in availability zones ${azs}`);
|
|
8947
9629
|
return azs;
|
|
8948
9630
|
}
|
|
8949
9631
|
};
|
|
@@ -8960,7 +9642,7 @@ var HostedZoneContextProviderPlugin = class {
|
|
|
8960
9642
|
throw new ContextProviderError(`HostedZoneProvider requires domainName property to be set in ${args}`);
|
|
8961
9643
|
}
|
|
8962
9644
|
const domainName = args.domainName;
|
|
8963
|
-
|
|
9645
|
+
debug2(`Reading hosted zone ${account}:${region}:${domainName}`);
|
|
8964
9646
|
const r53 = (await initContextProviderSdk(this.aws, args)).route53();
|
|
8965
9647
|
const response = await r53.listHostedZonesByName({ DNSName: domainName });
|
|
8966
9648
|
if (!response.HostedZones) {
|
|
@@ -8979,9 +9661,9 @@ var HostedZoneContextProviderPlugin = class {
|
|
|
8979
9661
|
async filterZones(r53, zones, props) {
|
|
8980
9662
|
let candidates = [];
|
|
8981
9663
|
const domainName = props.domainName.endsWith(".") ? props.domainName : `${props.domainName}.`;
|
|
8982
|
-
|
|
9664
|
+
debug2(`Found the following zones ${JSON.stringify(zones)}`);
|
|
8983
9665
|
candidates = zones.filter((zone) => zone.Name === domainName);
|
|
8984
|
-
|
|
9666
|
+
debug2(`Found the following matched name zones ${JSON.stringify(candidates)}`);
|
|
8985
9667
|
if (props.privateZone) {
|
|
8986
9668
|
candidates = candidates.filter((zone) => zone.Config && zone.Config.PrivateZone);
|
|
8987
9669
|
} else {
|
|
@@ -8992,7 +9674,7 @@ var HostedZoneContextProviderPlugin = class {
|
|
|
8992
9674
|
for (const zone of candidates) {
|
|
8993
9675
|
const data = await r53.getHostedZone({ Id: zone.Id });
|
|
8994
9676
|
if (!data.VPCs) {
|
|
8995
|
-
|
|
9677
|
+
debug2(`Expected VPC for private zone but no VPC found ${zone.Id}`);
|
|
8996
9678
|
continue;
|
|
8997
9679
|
}
|
|
8998
9680
|
if (data.VPCs.map((vpc) => vpc.VPCId).includes(props.vpcId)) {
|
|
@@ -9020,7 +9702,7 @@ var KeyContextProviderPlugin = class {
|
|
|
9020
9702
|
}
|
|
9021
9703
|
// TODO: use paginator function
|
|
9022
9704
|
async findKey(kms, args) {
|
|
9023
|
-
|
|
9705
|
+
debug2(`Listing keys in ${args.account}:${args.region}`);
|
|
9024
9706
|
let response;
|
|
9025
9707
|
let nextMarker;
|
|
9026
9708
|
do {
|
|
@@ -9047,7 +9729,7 @@ var KeyContextProviderPlugin = class {
|
|
|
9047
9729
|
if (!alias.TargetKeyId) {
|
|
9048
9730
|
throw new ContextProviderError(`Could not find any key with alias named ${args.aliasName}`);
|
|
9049
9731
|
}
|
|
9050
|
-
|
|
9732
|
+
debug2(`Key found ${alias.TargetKeyId}`);
|
|
9051
9733
|
return {
|
|
9052
9734
|
keyId: alias.TargetKeyId
|
|
9053
9735
|
};
|
|
@@ -9275,7 +9957,7 @@ var SSMContextProviderPlugin = class {
|
|
|
9275
9957
|
throw new ContextProviderError("parameterName must be provided in props for SSMContextProviderPlugin");
|
|
9276
9958
|
}
|
|
9277
9959
|
const parameterName = args.parameterName;
|
|
9278
|
-
|
|
9960
|
+
debug2(`Reading SSM parameter ${account}:${region}:${parameterName}`);
|
|
9279
9961
|
const response = await this.getSsmParameterValue(args);
|
|
9280
9962
|
const parameterNotFound = !response.Parameter || response.Parameter.Value === void 0;
|
|
9281
9963
|
const suppressError = "ignoreErrorOnMissingContext" in args && args.ignoreErrorOnMissingContext;
|
|
@@ -9324,7 +10006,7 @@ var VpcNetworkContextProviderPlugin = class {
|
|
|
9324
10006
|
}
|
|
9325
10007
|
async findVpc(ec2, args) {
|
|
9326
10008
|
const filters = Object.entries(args.filter).map(([tag, value]) => ({ Name: tag, Values: [value] }));
|
|
9327
|
-
|
|
10009
|
+
debug2(`Listing VPCs in ${args.account}:${args.region}`);
|
|
9328
10010
|
const response = await ec2.describeVpcs({ Filters: filters });
|
|
9329
10011
|
const vpcs = response.Vpcs || [];
|
|
9330
10012
|
if (vpcs.length === 0) {
|
|
@@ -9337,7 +10019,7 @@ var VpcNetworkContextProviderPlugin = class {
|
|
|
9337
10019
|
}
|
|
9338
10020
|
async readVpcProps(ec2, vpc, args) {
|
|
9339
10021
|
const vpcId = vpc.VpcId;
|
|
9340
|
-
|
|
10022
|
+
debug2(`Describing VPC ${vpcId}`);
|
|
9341
10023
|
const filters = { Filters: [{ Name: "vpc-id", Values: [vpcId] }] };
|
|
9342
10024
|
const subnetsResponse = await ec2.describeSubnets(filters);
|
|
9343
10025
|
const listedSubnets = subnetsResponse.Subnets || [];
|
|
@@ -9619,7 +10301,7 @@ async function provideContextValues(missingValues, context, sdk) {
|
|
|
9619
10301
|
value = { [cxapi4.PROVIDER_ERROR_KEY]: formatErrorMessage(e), [TRANSIENT_CONTEXT_KEY]: true };
|
|
9620
10302
|
}
|
|
9621
10303
|
context.set(key, value);
|
|
9622
|
-
|
|
10304
|
+
debug2(`Setting "${key}" context to ${JSON.stringify(value)}`);
|
|
9623
10305
|
}
|
|
9624
10306
|
}
|
|
9625
10307
|
function registerContextProvider(name, provider) {
|
|
@@ -9957,36 +10639,36 @@ var StackCollection = class _StackCollection {
|
|
|
9957
10639
|
let warnings = false;
|
|
9958
10640
|
let errors = false;
|
|
9959
10641
|
for (const stack of this.stackArtifacts) {
|
|
9960
|
-
for (const
|
|
9961
|
-
switch (
|
|
10642
|
+
for (const message2 of stack.messages) {
|
|
10643
|
+
switch (message2.level) {
|
|
9962
10644
|
case import_cx_api9.SynthesisMessageLevel.WARNING:
|
|
9963
10645
|
warnings = true;
|
|
9964
|
-
await logger("warn",
|
|
10646
|
+
await logger("warn", message2);
|
|
9965
10647
|
break;
|
|
9966
10648
|
case import_cx_api9.SynthesisMessageLevel.ERROR:
|
|
9967
10649
|
errors = true;
|
|
9968
|
-
await logger("error",
|
|
10650
|
+
await logger("error", message2);
|
|
9969
10651
|
break;
|
|
9970
10652
|
case import_cx_api9.SynthesisMessageLevel.INFO:
|
|
9971
|
-
await logger("info",
|
|
10653
|
+
await logger("info", message2);
|
|
9972
10654
|
break;
|
|
9973
10655
|
}
|
|
9974
10656
|
}
|
|
9975
10657
|
}
|
|
9976
10658
|
if (errors && failAt != "none") {
|
|
9977
|
-
throw
|
|
10659
|
+
throw AssemblyError.withStacks("Found errors", this.stackArtifacts);
|
|
9978
10660
|
}
|
|
9979
10661
|
if (warnings && failAt === "warn") {
|
|
9980
|
-
throw
|
|
10662
|
+
throw AssemblyError.withStacks("Found warnings (--strict mode)", this.stackArtifacts);
|
|
9981
10663
|
}
|
|
9982
10664
|
}
|
|
9983
10665
|
};
|
|
9984
10666
|
function indexByHierarchicalId(stacks) {
|
|
9985
|
-
const
|
|
10667
|
+
const result2 = /* @__PURE__ */ new Map();
|
|
9986
10668
|
for (const stack of stacks) {
|
|
9987
|
-
|
|
10669
|
+
result2.set(stack.hierarchicalId, stack);
|
|
9988
10670
|
}
|
|
9989
|
-
return
|
|
10671
|
+
return result2;
|
|
9990
10672
|
}
|
|
9991
10673
|
function includeDownstreamStacks(selectedStacks, allStacks) {
|
|
9992
10674
|
const added = new Array();
|
|
@@ -10002,7 +10684,7 @@ function includeDownstreamStacks(selectedStacks, allStacks) {
|
|
|
10002
10684
|
}
|
|
10003
10685
|
} while (madeProgress);
|
|
10004
10686
|
if (added.length > 0) {
|
|
10005
|
-
|
|
10687
|
+
info2("Including depending stacks: %s", chalk16.bold(added.join(", ")));
|
|
10006
10688
|
}
|
|
10007
10689
|
}
|
|
10008
10690
|
function includeUpstreamStacks(selectedStacks, allStacks) {
|
|
@@ -10021,7 +10703,7 @@ function includeUpstreamStacks(selectedStacks, allStacks) {
|
|
|
10021
10703
|
}
|
|
10022
10704
|
}
|
|
10023
10705
|
if (added.length > 0) {
|
|
10024
|
-
|
|
10706
|
+
info2("Including dependency stacks: %s", chalk16.bold(added.join(", ")));
|
|
10025
10707
|
}
|
|
10026
10708
|
}
|
|
10027
10709
|
function sanitizePatterns(patterns) {
|
|
@@ -10036,7 +10718,7 @@ var cxschema4 = __toESM(require("@aws-cdk/cloud-assembly-schema"));
|
|
|
10036
10718
|
var cxapi5 = __toESM(require("@aws-cdk/cx-api"));
|
|
10037
10719
|
var fs16 = __toESM(require("fs-extra"));
|
|
10038
10720
|
var semver6 = __toESM(require("semver"));
|
|
10039
|
-
async function prepareDefaultEnvironment(aws, logFn =
|
|
10721
|
+
async function prepareDefaultEnvironment(aws, logFn = debug2) {
|
|
10040
10722
|
const env = {};
|
|
10041
10723
|
env[cxapi5.DEFAULT_REGION_ENV] = aws.defaultRegion;
|
|
10042
10724
|
await logFn(`Setting "${cxapi5.DEFAULT_REGION_ENV}" environment variable to`, env[cxapi5.DEFAULT_REGION_ENV]);
|
|
@@ -10073,7 +10755,7 @@ async function prepareContext(settings, context, env) {
|
|
|
10073
10755
|
}
|
|
10074
10756
|
const bundlingStacks = settings.get(["bundlingStacks"]) ?? ["**"];
|
|
10075
10757
|
context[cxapi5.BUNDLING_STACKS] = bundlingStacks;
|
|
10076
|
-
|
|
10758
|
+
debug2("context:", context);
|
|
10077
10759
|
return context;
|
|
10078
10760
|
}
|
|
10079
10761
|
function appToArray(app) {
|
|
@@ -10092,7 +10774,7 @@ async function guessExecutable(app) {
|
|
|
10092
10774
|
try {
|
|
10093
10775
|
fstat = await fs16.stat(commandLine[0]);
|
|
10094
10776
|
} catch {
|
|
10095
|
-
|
|
10777
|
+
debug2(`Not a file: '${commandLine[0]}'. Using '${commandLine}' as command-line`);
|
|
10096
10778
|
return commandLine;
|
|
10097
10779
|
}
|
|
10098
10780
|
const isExecutable = (fstat.mode & fs16.constants.X_OK) !== 0;
|
|
@@ -10131,7 +10813,6 @@ function spaceAvailableForContext(env, limit) {
|
|
|
10131
10813
|
WorkGraphBuilder,
|
|
10132
10814
|
contextproviders,
|
|
10133
10815
|
findCloudWatchLogGroups,
|
|
10134
|
-
formatSdkLoggerContent,
|
|
10135
10816
|
guessExecutable,
|
|
10136
10817
|
loadTree,
|
|
10137
10818
|
prepareContext,
|