-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(cli): stack monitor uses io-host #150
Conversation
f4fecad
to
e8b93d8
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #150 +/- ##
==========================================
- Coverage 84.79% 84.46% -0.34%
==========================================
Files 198 204 +6
Lines 35400 35646 +246
Branches 4573 4563 -10
==========================================
+ Hits 30019 30108 +89
- Misses 5235 5393 +158
+ Partials 146 145 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
e8b93d8
to
97a7ca5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renamed to stack-activity-monitor.test.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We had multiple versions of this. Consolidating to one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pulling these out into a shared file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is now only a CLI concern (not toolkit anymore)
aaf99a7
to
a0fcbbd
Compare
function padRight(n: number, x: string): string { | ||
return x + ' '.repeat(Math.max(0, n - x.length)); | ||
} | ||
|
||
/** | ||
* Infamous padLeft() | ||
*/ | ||
function padLeft(n: number, x: string): string { | ||
return ' '.repeat(Math.max(0, n - x.length)) + x; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved to util/string-manipulation.ts
function calcMaxResourceTypeLength(template: any) { | ||
const resources = (template && template.Resources) || {}; | ||
let maxWidth = 0; | ||
for (const id of Object.keys(resources)) { | ||
const type = resources[id].Type || ''; | ||
if (type.length > maxWidth) { | ||
maxWidth = type.length; | ||
} | ||
} | ||
return maxWidth; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved to util/cloudformation.ts
return maxWidth; | ||
} | ||
|
||
interface PrinterProps { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rest of this file moved to various files in cli/activity-printer
but also got refactored a lot
a0fcbbd
to
1b28383
Compare
code: 'CDK_TOOLKIT_I5502', | ||
description: 'Stack Monitoring Activity event', | ||
level: 'info', | ||
interface: 'StackActivity', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have our own copy of this type? I'm not comfortable exposing other people's types as part of our API.
Also if we make our own copy of the type, we'll have the ability to add fields if we feel that's convenient, and we can simplify and omit fields that aren't necessary for our current implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is our own copy of StackActivity
.
However its event
property is typed as @aws-sdk/client-cloudformation.StackEvent
. I'm inclined to pass this on as is, since the CFN API is well defined und unlikely to change badly or even at all.
packages/aws-cdk/lib/api/stack-events/stack-activity-monitor.ts
Outdated
Show resolved
Hide resolved
1b28383
to
56a8ee3
Compare
94f39a2
to
1a42d87
Compare
1a42d87
to
79285c2
Compare
Provides stack events to the IoHost in a structured way.
The main change here is that
StackActivityMonitor
does not directly talk to theActivityPrinter
anymore. Instead messages are emitted to theIoHost
. This caused two related changes:StackProgressMonitor
and progress information is now provided directly by theStackActivityMonitor
Removed low-level options:
progress
-> now aCliIoHost
propertyci
-> use value fromCliIoHost
directly instead of passing through all the layersquiet
-> surprisingly this was unused by CLI. We should have something like this again, but can be implemented in a follow up PR.Manually tested the changes in addition to integ tests.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license