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

feat(toolkit): bootstrap action #33453

Closed
wants to merge 4 commits into from
Closed

Conversation

iankhou
Copy link
Contributor

@iankhou iankhou commented Feb 14, 2025

Issue #33180.

Closes #33180.

Reason for this change

Programmatic toolkit bootstrap action.

Description of changes

Added the bootstrap action and tests.

Describe any new or updated permissions being added

No permissions changes.

Description of how you validated changes

Added unit tests.

Checklist


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

@iankhou iankhou self-assigned this Feb 14, 2025
@github-actions github-actions bot added the p2 label Feb 14, 2025
@aws-cdk-automation aws-cdk-automation requested a review from a team February 14, 2025 18:26
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Feb 14, 2025
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.

The pull request linter fails with the following errors:

❌ Features must contain a change to an integration test file and the resulting snapshot.

If you believe this pull request should receive an exemption, please comment and provide a justification. A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed, add Clarification Request to a comment.

@iankhou iankhou changed the title cli(toolkit): bootstrap action feat(toolkit): bootstrap action Feb 14, 2025
Copy link

codecov bot commented Feb 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.00%. Comparing base (39151d0) to head (bb5767c).
Report is 28 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #33453   +/-   ##
=======================================
  Coverage   81.00%   81.00%           
=======================================
  Files         238      238           
  Lines       14271    14271           
  Branches     2492     2492           
=======================================
  Hits        11560    11560           
  Misses       2425     2425           
  Partials      286      286           
Flag Coverage Δ
suite.unit 81.00% <ø> (ø)

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

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

@iankhou iankhou added the pr-linter/exempt-readme The PR linter will not require README changes label Feb 14, 2025
Comment on lines 164 to 165
*/

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
*/
*/

await ioHost.notify({
time: new Date(),
level: 'error',
code: 'CDK_TOOLKIT_E9900' as IoMessageCode,
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we need to typecast this to IoMessageCode?

* Bootstraps the CDK Toolkit stack in the environments used by the specified stack(s).
*/

public async bootstrap(cx: ICloudAssemblySource, options: BootstrapEnvironmentOptions = {}): Promise<void> {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you should copy over and expose only what makes sense for BootstrapEnvironmentOptions. Take a look at what we've brought in thats slightly different than what the CDK CLI offers. It lives in lib/actions/destroy/index.ts and all the other actions we currently have

// APIs
export { formatSdkLoggerContent, SdkProvider } from '../../../../aws-cdk/lib/api/aws-auth';
export { Mode } from '../../../../aws-cdk/lib/api/plugin';
Copy link
Contributor

Choose a reason for hiding this comment

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

where are we using Mode?

@@ -17,10 +20,11 @@ export { HotswapMode } from '../../../../aws-cdk/lib/api/hotswap/common';
export { StackActivityProgress } from '../../../../aws-cdk/lib/api/util/cloudformation/stack-activity-monitor';
export { RWLock, type ILock } from '../../../../aws-cdk/lib/api/util/rwlock';
export { formatTime } from '../../../../aws-cdk/lib/api/util/string-manipulation';
export { rootDir } from '../../../../aws-cdk/lib/util/directories';
Copy link
Contributor

Choose a reason for hiding this comment

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

where are we using rootDir?


// @todo Not yet API probably should be
export { formatErrorMessage } from '../../../../aws-cdk/lib/util/error';
export { obscureTemplate, serializeStructure } from '../../../../aws-cdk/lib/serialize';
export { loadStructuredFile, obscureTemplate, serializeStructure } from '../../../../aws-cdk/lib/serialize';
Copy link
Contributor

Choose a reason for hiding this comment

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

where are we using loadStructuredFile?

import * as path from 'node:path';
import * as cxapi from '@aws-cdk/cx-api';
import * as fs from 'fs-extra';
import { BootstrapEnvironmentOptions, SdkProvider, Bootstrapper, StringWithoutPlaceholders } from '../../lib/api/aws-cdk';
Copy link
Contributor

Choose a reason for hiding this comment

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

the imports here, if needed, should be imported into https://github.com/aws/aws-cdk/blob/main/packages/@aws-cdk/toolkit/test/util/aws-cdk.ts and used from there. that is because you are currently importing things you want to use in tests but it will get bundled into the released toolkit as well.

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

@iankhou
Copy link
Contributor Author

iankhou commented Feb 19, 2025

See aws/aws-cdk-cli#63

@iankhou iankhou closed this Feb 19, 2025
Copy link

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 19, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
contribution/core This is a PR that came from AWS. p2 pr-linter/exempt-readme The PR linter will not require README changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Toolkit Action: bootstrap incl. typed return
3 participants