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

fix: cdk diff prints upgrade bootstrap warning even when current version exceeds the recommended version #29938

Merged
merged 12 commits into from
Apr 26, 2024

Conversation

vinayak-kukreja
Copy link
Contributor

@vinayak-kukreja vinayak-kukreja commented Apr 23, 2024

Closes #28888

Reason for this change

Currently, we just check for if a minimum bootstrap version is needed for a functionality and give a warning. But, we do not check the bootstrap version of the stack itself. This gives a confusing warning for upgrading to a bootstrap version (example: version 8) when the stack bootstrap version is already higher than the recommended version.

Description of changes

We cannot know successfully what the bootstrap version is in the AWS account without the lookup role. We are getting this warning while trying to assume the lookup role and failing to assume it.

I am removing upgrade related warnings since we are emitting them without any confirmation of the user's account bootstrap version. This will lead to confusion. Instead, I am trying to make some of the existing error messages more clear.

Description of how you validated changes

Updated unit tests.
Will run this through test pipeline.

Checklist


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

…ion exceeds the recommended version

Signed-off-by: Vinayak Kukreja <[email protected]>
@aws-cdk-automation aws-cdk-automation requested a review from a team April 23, 2024 19:56
@github-actions github-actions bot added bug This issue is a bug. effort/medium Medium work item – several days of effort p2 labels Apr 23, 2024
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Apr 23, 2024
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 has failed. See the aws-cdk-automation comment below for failure reasons. 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.

Signed-off-by: Vinayak Kukreja <[email protected]>
Signed-off-by: Vinayak Kukreja <[email protected]>
Signed-off-by: Vinayak Kukreja <[email protected]>
@vinayak-kukreja vinayak-kukreja marked this pull request as ready for review April 23, 2024 23:15
@vinayak-kukreja vinayak-kukreja added the pr/do-not-merge This PR should not be merged at this time. label Apr 24, 2024
@@ -532,7 +532,7 @@ export class Deployments {

// try to assume the lookup role
const warningMessage = `Could not assume ${arns.lookupRoleArn}, proceeding anyway.`;
const upgradeMessage = `(To get rid of this warning, please upgrade to bootstrap version >= ${stack.lookupRole?.requiresBootstrapStackVersion})`;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we are unable to assume the lookup role and are not looking for the bootstrap version in SSM of the user's account, then there is no way we are sure about this recommendation. And, we should not just be recommending this without knowing it for a fact that they are on an older version of bootstrap.

We already error out if the user is using an older version of bootstrap than the recommended version.

@@ -241,7 +241,6 @@ describe('readCurrentTemplate', () => {
// THEN
expect(flatten(stderrMock.mock.calls)).toEqual(expect.arrayContaining([
expect.stringMatching(/Could not assume bloop-lookup:here:123456789012/),
expect.stringMatching(/please upgrade to bootstrap version >= 5/),
Copy link
Contributor

Choose a reason for hiding this comment

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

This one has an invalid bootstrap version (1 when >= 5 was expected) and an upgrade message should be emitted here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is weird. Without successfully assuming the lookup role, how will we know what bootstrap version is in SSM. Maybe cached? Taking a look

But, if we are able to assume the role, we do throw in such scenario instead of a warning: https://github.com/aws/aws-cdk/blob/vkukreja/doc-update/packages/aws-cdk/lib/api/deployments.ts#L546-L549

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So it was throwing the expected error but since we catch it and do nothing, it will only show up if we have --debug flag enabled. I believe it needs to be shown and hence adding it with error

Signed-off-by: Vinayak Kukreja <[email protected]>
Signed-off-by: Vinayak Kukreja <[email protected]>
Signed-off-by: Vinayak Kukreja <[email protected]>
@vinayak-kukreja vinayak-kukreja added the pr-linter/cli-integ-tested Assert that any CLI changes have been integ tested label Apr 26, 2024
@aws-cdk-automation aws-cdk-automation dismissed their stale review April 26, 2024 21:18

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

@vinayak-kukreja vinayak-kukreja removed the pr/do-not-merge This PR should not be merged at this time. label Apr 26, 2024
Copy link
Contributor

mergify bot commented Apr 26, 2024

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

@mergify mergify bot merged commit 28b0080 into main Apr 26, 2024
11 of 12 checks passed
@mergify mergify bot deleted the vkukreja/doc-update branch April 26, 2024 22:43
Copy link
Contributor

mergify bot commented Apr 26, 2024

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Collaborator

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.

@aws aws locked as resolved and limited conversation to collaborators Jul 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue is a bug. contribution/core This is a PR that came from AWS. effort/medium Medium work item – several days of effort p2 pr-linter/cli-integ-tested Assert that any CLI changes have been integ tested pr-linter/exempt-integ-test The PR linter will not require integ test changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect Bootstrap Warning
3 participants