-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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(cli): diff
allow specifying changeSet
via cdk.json
#29375
base: main
Are you sure you want to change the base?
Conversation
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.
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.
Exemption Request: There are integration tests here but there should be no need to touch any snapshots for this change. |
@Mergifyio update |
✅ Branch has been successfully updated |
Thank you for picking up this change. I'm running this through our test pipeline before doing a full review. I've also added the integ test exemption because, you are correct, this does not require a change to snapshots. |
@Mergifyio update |
✅ Branch has been successfully updated |
@Mergifyio update |
✅ Branch has been successfully updated |
Thanks for taking a look at this @TheRealAmazonKendra I have another PR open at #29372, which is a bit more important to me; if there was any chance someone could take a look. |
@@ -341,7 +341,7 @@ async function uploadBodyParameterAndCreateChangeSet(options: PrepareChangeSetOp | |||
const exists = (await CloudFormationStack.lookup(cfn, options.stack.stackName, false)).exists; | |||
|
|||
const executionRoleArn = preparedSdk.cloudFormationRoleArn; | |||
options.stream.write('Hold on while we create a read-only change set to get a diff with accurate replacement information (use --no-change-set to use a less accurate but faster template-only diff)\n'); | |||
debug('Hold on while we create a read-only change set to get a diff with accurate replacement information (use --no-change-set to use a less accurate but faster template-only diff)'); |
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.
💯 - thank you! This message appears too often now.
packages/aws-cdk/lib/cli.ts
Outdated
@@ -514,7 +514,7 @@ export async function exec(args: string[], synthesizer?: Synthesizer): Promise<n | |||
stream: args.ci ? process.stdout : undefined, | |||
compareAgainstProcessedTemplate: args.processed, | |||
quiet: args.quiet, | |||
changeSet: args['change-set'], | |||
changeSet: configuration.settings.get(['diff', 'changeSet']) ?? args['change-set'], |
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.
Perhaps this needs to be swapped so that the cdk.json setting can be overridden via the cli argument?
packages/aws-cdk/lib/cli.ts
Outdated
@@ -514,7 +514,7 @@ export async function exec(args: string[], synthesizer?: Synthesizer): Promise<n | |||
stream: args.ci ? process.stdout : undefined, | |||
compareAgainstProcessedTemplate: args.processed, | |||
quiet: args.quiet, | |||
changeSet: args['change-set'], | |||
changeSet: configuration.settings.get(['diff', 'changeSet']) ?? args['change-set'], |
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.
changeSet: configuration.settings.get(['diff', 'changeSet']) ?? args['change-set'], | |
changeSet: args['change-set'] ?? configuration.settings.get(['diff', 'changeSet'], |
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.
I think you are right about this order of operations. Only question is if there is a difference between no flag being provided and the default.
If the flag is always given a value regardless of being set, we may have to put the context first (but I will ask some others on the team about this).
Hey @andreialecu, I have eyes on this. Will try to give a full review tomorrow, but at a glance this looks helpful and straightforward! |
This PR has been in the CHANGES REQUESTED state for 3 weeks, and looks abandoned. To keep this PR from being closed, please continue work on it. If not, it will automatically be closed in a week. |
I pushed some changes so the flag and context are both respected. Will put a full explanation in the PR description. |
Shushing up the PR bot that says changes have been requested for too long. That's on us. The bot will still want us to run the PR through our test pipeline, but now it won't close it. |
The pull request linter fails with the following errors:
PRs must pass status checks before we can provide a meaningful review. If you would like to request an exemption from the status checks or clarification on feedback, please leave a comment on this PR containing ✅ A exemption request has been requested. Please wait for a maintainer's review. |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
➡️ PR build request submitted to A maintainer must now check the pipeline and add the |
One of the CLI integ tests is failing for this PR:
Could you fix this one? |
Issue # (if applicable)
Closes #29232
Reason for this change
Allows specifying whether to use changesets via cdk.json:
It also moves this informational message to the
debug()
log level:There was a
--quiet
CLI argument that was not squelching it, which seemed like an oversight in the initial PR.With many stacks, the message can be quite verbose.
--verbose
will reveal it, but otherwise it will be hiddenDescription of changes
The default value of the change-set flag is removed and instead is handled in the diff call.
The value for
changeSet
in the diff call is processed in this way: setting the flag gives the value > if the flag is un-set, check the context in cdk.json > if both are un-set, default to true.This poses a question about what flags we allow to be set in cdk.json. Here, "diff" is new in cdk.json, and "changeSet" is the first and only flag able to be set. The team can have a discussion and come to a conclusion.
Description of how you validated changes
Added tests.
Manual testing.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license