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: upgrade jsii-pacmak and other jsii tools to 1.106.0 #33057

Merged
merged 3 commits into from
Jan 22, 2025

Conversation

mrgrain
Copy link
Contributor

@mrgrain mrgrain commented Jan 22, 2025

After the version upgrade of @aws-cdk/cloud-assembly-schema to ^39.2.0 in #32998 our cli integration and init tests started failing with the following error in all .NET projects:

/tmp/CdkInteg0Rk0Rq9U2Tk.csproj : error NU1605: Warning As Error: Detected package downgrade: Amazon.JSII.Runtime from 1.106.0 to 1.104.0. Reference the package directly from the project to select a different version. 
/tmp/CdkInteg0Rk0Rq9U2Tk.csproj : error NU1605:  CdkInteg0Rk0Rq9U2Tk -> Amazon.CDK.Lib 2.177.0-rc.0 -> Amazon.CDK.CloudAssembly.Schema 39.2.0 -> Amazon.JSII.Runtime (>= 1.106.0 && < 2.0.0) 
/tmp//CdkInteg0Rk0Rq9U2Tk.csproj : error NU1605:  CdkInteg0Rk0Rq9U2Tk -> Amazon.CDK.Lib 2.177.0-rc.0 -> Amazon.JSII.Runtime (>= 1.104.0 && < 2.0.0)

Reason for this change

This error is documented in the NuGet docs as Example 1.

The .NET CDK project that is created in these tests declares a dependency on depending on Amazon.CDK.Lib.
Amazon.CDK.Lib declares a direct dependency on Amazon.JSII.Runtime (>= 1.104.0 && < 2.0.0). But it also declares an indirect dependency on Amazon.JSII.Runtime (>= 1.106.0 && < 2.0.0) through the Amazon.CDK.CloudAssembly.Schema package:

TestProject -> Amazon.CDK.Lib 2.177.0-rc.0 -> Amazon.CDK.CloudAssembly.Schema 39.2.0 -> Amazon.JSII.Runtime (>= 1.106.0 && < 2.0.0) 
TestProject -> Amazon.CDK.Lib 2.177.0-rc.0 -> Amazon.JSII.Runtime (>= 1.104.0 && < 2.0.0)

Because of the direct-dependency-wins rule Amazon.JSII.Runtime (>= 1.104.0 && < 2.0.0) would be selected. It overrules the distant package and thus causes the package downgrade, which is an error.

Why does the issue surface now?

The previous (released) version of Amazon.CDK.Lib declares these dependencies (Source):

Amazon.CDK.CloudAssembly.Schema (>= 39.0.1 && < 40.0.0)
Amazon.JSII.Runtime (>= 1.104.0 && < 2.0.0)

And Amazon.CDK.CloudAssembly.Schema v39.0.1 declares this dependency (Source):

Amazon.JSII.Runtime (>= 1.104.0 && < 2.0.0)

As you can see, both versions of Amazon.JSII.Runtime are the same.

The pre-released package of Amazon.CDK.Lib however has updated its dependency on Amazon.CDK.CloudAssembly.Schema to (>= 39.2.0 && < 40.0.0). And if we check the distant dependencies for the newer version of Amazon.CDK.CloudAssembly.Schema, we get this (Source):

Amazon.JSII.Runtime (>= 1.106.0 && < 2.0.0)

This is where the problem stems from.

Root cause

The dependency constraint for Amazon.JSII.Runtime is determined by the used version of jsii-pacmak in each package. The root cause is that the tested versions of aws-cdk-lib and @aws-cdk/cloud-assembly-schema are build with a different version of jsii-pacmak.

Description of changes

Update the version of jsii-pacmak in all monorepo packages to be the latest version and the same as in @aws-cdk/cloud-assembly-schema.

Describe any new or updated permissions being added

n/a

Description of how you validated changes

Run through the integration test pipeline.

Checklist


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

This must be the same version as used by CloudAssemblySchema, otherwise .NET projects cannot pick the right version.
@mrgrain mrgrain requested a review from a team as a code owner January 22, 2025 13:32
@aws-cdk-automation aws-cdk-automation requested a review from a team January 22, 2025 13:33
@github-actions github-actions bot added the p2 label Jan 22, 2025
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Jan 22, 2025
@mrgrain mrgrain added the pr/do-not-merge This PR should not be merged at this time. label Jan 22, 2025
Copy link

codecov bot commented Jan 22, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.52%. Comparing base (6677b33) to head (dbfdcd4).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #33057   +/-   ##
=======================================
  Coverage   81.52%   81.52%           
=======================================
  Files         224      224           
  Lines       13762    13762           
  Branches     2414     2414           
=======================================
  Hits        11220    11220           
  Misses       2270     2270           
  Partials      272      272           
Flag Coverage Δ
suite.unit 81.52% <ø> (ø)

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

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

@mrgrain mrgrain removed the pr/do-not-merge This PR should not be merged at this time. label Jan 22, 2025
Copy link
Contributor

mergify bot commented Jan 22, 2025

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: dbfdcd4
  • 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 f58f80f into main Jan 22, 2025
20 checks passed
Copy link
Contributor

mergify bot commented Jan 22, 2025

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).

@mergify mergify bot deleted the mrgrain/chore/upgrade-pacmak-and-other-jsii branch January 22, 2025 18:30
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 Jan 22, 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants