Skip to content
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

chore(toolkit): capture all output from an app #33259

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mrgrain
Copy link
Contributor

@mrgrain mrgrain commented Jan 31, 2025

Issue #32997

Relates to #32997

Reason for this change

When a CDK app is invoked by a sub-shell, we need to capture all output by lines and send it to the IoHost.

Description of changes

Adds an EventPublisher interface to the execInChildProcess helper. This is getting passed in a publisher that uses the IoHost.
Inspired from the ShellEventPublisher in cdk-assets.

Describe any new or updated permissions being added

n/a

Description of how you validated changes

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@mrgrain mrgrain requested a review from a team as a code owner January 31, 2025 18:53
@aws-cdk-automation aws-cdk-automation requested a review from a team January 31, 2025 18:54
@github-actions github-actions bot added the p2 label Jan 31, 2025
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Jan 31, 2025
import { AssemblyBuilder, CdkAppSourceProps } from '../source-builder';

export abstract class CloudAssemblySourceBuilder {
/**
* Helper to provide the CloudAssemblySourceBuilder with required toolkit services
* @deprecated this should move to the toolkit really.
*/
protected abstract toolkitServices(): Promise<ToolkitServices>;
protected abstract sourceBuilderServices(): Promise<ToolkitServices>;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renaming this to make it clear this should only be used in the source builder

Comment on lines -4 to -16
// Default codes -- all 0000 codes
CDK_TOOLKIT_I0000: 'Default toolkit info code',
CDK_TOOLKIT_E0000: 'Default toolkit error code',
CDK_TOOLKIT_W0000: 'Default toolkit warning code',
CDK_SDK_I0000: 'Default sdk info code',
CDK_SDK_E0000: 'Default sdk error code',
CDK_SDK_WOOOO: 'Default sdk warning code',
CDK_ASSETS_I0000: 'Default assets info code',
CDK_ASSETS_E0000: 'Default assets error code',
CDK_ASSETS_W0000: 'Default assets warning code',
CDK_ASSEMBLY_I0000: 'Default assembly info code',
CDK_ASSEMBLY_E0000: 'Default assembly error code',
CDK_ASSEMBLY_W0000: 'Default assembly warning code',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't want to allow explicitly using this code for now. When generating the docs page we can probably inject the description differently.

return {
ioHost: this.ioHost,
ioHost: withAction(this.ioHost, 'assembly'),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Messages previously came through without an action.

Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(This review is outdated)

@@ -104,6 +105,7 @@
"promptly": "^3.2.0",
"proxy-agent": "^6.4.0",
"semver": "^7.6.3",
"split2": "^4.2.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Taking a new dependency here to split a stream on new lines. This is fairly complex to do, so rather have it handled by a tested module. The dep is very popular (>14mio weekly downloads) and is maintained by an extermely well-known Node.JS core contributor.

https://www.npmjs.com/package/split2

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No app should do that, but you never know...

@mrgrain mrgrain added the pr-linter/cli-integ-tested Assert that any CLI changes have been integ tested label Jan 31, 2025
@aws-cdk-automation aws-cdk-automation dismissed their stale review January 31, 2025 18:59

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

Copy link

codecov bot commented Jan 31, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.84%. Comparing base (c346e82) to head (13eaeac).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #33259   +/-   ##
=======================================
  Coverage   80.84%   80.84%           
=======================================
  Files         232      232           
  Lines       14135    14135           
  Branches     2460     2460           
=======================================
  Hits        11428    11428           
  Misses       2427     2427           
  Partials      280      280           
Flag Coverage Δ
suite.unit 80.84% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
packages/aws-cdk 79.64% <ø> (ø)
packages/aws-cdk-lib/core 82.17% <ø> (ø)

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 13eaeac
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core This is a PR that came from AWS. p2 pr/needs-maintainer-review This PR needs a review from a Core Team Member pr-linter/cli-integ-tested Assert that any CLI changes have been integ tested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants