-
Notifications
You must be signed in to change notification settings - Fork 4k
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): make new CLI recognize old assembly versions #4307
Conversation
In the latest release, we changed the CX protocol, requiring users of a newer CLI to upgrade their CDK framework libraries (to be safe). This particular change was actually backwards compatible, so add the requisite code to the CLI to recognize and fix that condition. Fixes #4294.
Thanks so much for taking the time to contribute to the AWS CDK ❤️ We will shortly assign someone to review this pull request and help get it
|
} | ||
|
||
// if framework < cli, we require a newer framework version | ||
if (semver.lt(frameworkVersion, toolkitVersion)) { | ||
throw new Error( | ||
`CDK CLI can only be used with apps created by CDK >= ${CLOUD_ASSEMBLY_VERSION}`); | ||
`A newer version of the CDK framework (>= ${CLOUD_ASSEMBLY_VERSION}) is necessary to interact with this version of the CLI`); |
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.
Maybe something like “the CDK CLI you are using requires your CDK app to use CDK modules with version >= xxx”
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.
😭
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
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.
While we are at it, can we also relay the CLI version through context so that apps can be smarter if needed in the future?
For reference: https://t.co/CEircxyDqv |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
@@ -73,6 +74,10 @@ export async function execProgram(aws: ISDK, config: Configuration): Promise<cxa | |||
debug('outdir:', outdir); | |||
env[cxapi.OUTDIR_ENV] = outdir; | |||
|
|||
// Send version information | |||
env[cxapi.CLI_ASM_VERSION_ENV] = cxapi.CLOUD_ASSEMBLY_VERSION; |
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.
Curious why through environment variables and not through context... not that I have a strong opinion...
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.
Looks good. Regarding your PR description: the change was not backwards compatible because the CloudAssembly used to throw if it saw an unknown artifact type. So either way we needed to bump both sides (or gracefully degrade at the framework level, which we couldn’t).
Or make the CLI understand old assembly types, which in this case is totally safe. |
In the latest release, we changed the CX protocol (adding a new artifact type), requiring users of a newer CLI to upgrade their CDK framework libraries. This check was originally written to improve safety. This particular change was actually backwards compatible, so add the requisite code to the CLI to recognize and fix that condition. Fixes #4294.
* fix(cli): make new CLI work with old assembly versions (#4307) In the latest release, we changed the CX protocol (adding a new artifact type), requiring users of a newer CLI to upgrade their CDK framework libraries. This check was originally written to improve safety. This particular change was actually backwards compatible, so add the requisite code to the CLI to recognize and fix that condition. Fixes #4294. * v1.10.1 See CHANGELOG
In the latest release, we changed the CX protocol, requiring users of a
newer CLI to upgrade their CDK framework libraries (to be safe).
This particular change was actually backwards compatible, so add the
requisite code to the CLI to recognize and fix that condition.
Fixes #4294.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license