chore(assertions): release as an alpha module in CDKv2#15614
chore(assertions): release as an alpha module in CDKv2#15614mergify[bot] merged 5 commits intoaws:v2-mainfrom
Conversation
6057a72 to
7986f2e
Compare
There was a problem hiding this comment.
All of this 'feels' super hacky. It feels too easy to introduce defects, unintended side effects, and worse of all, debugging is going to be a nightmare.
How about a different approach?
Move 'cloudformation-diff' into its own repo outside of the monorepo. It depends on a small part of 'cfnspec'. Without diving too deep into it, I think it should be possible to refactor this part of cfnspec into cloudformation-diff as well.
Then, copy over the files from 'assert-internal' into 'assertions' as part of the source tree instead of copying them in.
All that will remain to be copied over would the cloudformation spec from cfnspec which can then be passed as input to the 'cloudformation-diff' module.
added benefit: we'll get 'nozem' to work again.
|
@nija-at before I reply, help me understand something. Your proposal is to actually change the way |
Yes. Remove further v2 special casing. |
7986f2e to
38e2be0
Compare
OK. Can we get this PR merged then? I'm fine if you want to change how |
|
I'm not comfortable approving this change. We should not be looking at these independently. This change is increasing the complexity of our build system, which is already overloaded and complicated. Given that this is a v2 branch only change, this moves the burden of debugging and resolution to the oncall or somewhere later from the PR that introduces any defect here. We need to find a solution that makes the overall system simpler. |
|
Two options that come to mind are - the approach I had mentioned above, or supporting dependency bundling within the monorepo so we don't have to vendor in. Maybe there are others? |
|
Not sure why we can't enable this for V2 experimental builds while working on improving the mess in I don't think making this PR wait for the PR with the build changes for
This is already the case, whether we merge this PR or not. I take the responsibility for fixing these issues, not the oncall, like I already did in #15648. |
This seems to suggest that it's fine to NOT run If so, then why is the fix not to do the following in the monorepo preparation script? ? |
38e2be0 to
a59f2d9
Compare
It's a possible solution, but I'd rather keep these hacks locally to the packages, instead of putting them in the experimental packages generation. For example, if Niranjan's plan goes through, and the build of |
a59f2d9 to
7eb25db
Compare
7eb25db to
5820f85
Compare
The `@aws-cdk/assertions` library was previously excluded from the V2 build of the experimental modules, because the `vendor.sh` script it used for vendoring in a few modules (`cfnspec`, `cloudformation-diff`, and `assert-internal`) used relative paths inside the repository. Change the script to use relative paths instead, and also adjust the module copying logic to account for bundled dependencies, which `@aws-cdk/assertion` uses.
5820f85 to
a67ebe0
Compare
tools/pkglint/lib/rules.ts
Outdated
| // don't do this check for the separately-vended modules | ||
| if (pkg.packageName.startsWith('@aws-cdk-lib-alpha/')) { | ||
| return; | ||
| } |
There was a problem hiding this comment.
Huh, it's not clear. I removed this check and re-ran pkglint, and didn't see any differences in any of these packages. Perhaps a hold-out from an older iteration? I'll remove for now until the reason becomes clearer.
There was a problem hiding this comment.
Huh, I must not have built and/or linted the right thing. Here's the build failure.
@aws-cdk-lib-alpha/assertions: In package package.json
@aws-cdk-lib-alpha/assertions: - [yarn/nohoist-bundled-dependencies] Repository-level 'workspaces.nohoist' directive is missing: @aws-cdk-lib-alpha/assertions/colors, @aws-cdk-lib-alpha/assertions/colors/**, @aws-cdk-lib-alpha/assertions/diff, @aws-cdk-lib-alpha/assertions/diff/**, @aws-cdk-lib-alpha/assertions/fast-deep-equal, @aws-cdk-lib-alpha/assertions/fast-deep-equal/**, @aws-cdk-lib-alpha/assertions/string-width, @aws-cdk-lib-alpha/assertions/string-width/**, @aws-cdk-lib-alpha/assertions/table, @aws-cdk-lib-alpha/assertions/table/** (fixable)
There was a problem hiding this comment.
I don't know enough to understand this. What is this rule meant to prevent and why we should not apply this to v2?
For example, an alternate solution could be to add this to the 'nohoist' flag here - https://github.com/aws/aws-cdk/blob/v2-main/packages/individual-packages/lerna.json.
I'm not saying that's the right solution, just that I don't understand enough of it.
Can you provide a little more context?
There was a problem hiding this comment.
It's really not clear. I don't think I understand why Adam wanted to exclude the alpha packages from this rule.
The build is complaining that a bundled dependency (e.g., colors) is not added to the top-level nohoist config, which keeps those dependencies at the local package level rather than hoisting them up to the top-level workspace. We have colors as a nohoist listing three other times already (@aws-cdk/assertions/colors, aws-cdk-lib/colors, and monocdk/colors). Not sure why we wouldn't add the alpha packages in the same way.
I ran pkglint -f in the alpha assertions package, which added the relevant entries to the top-level package.json. This should solve the build error, and I think is the right thing to do.
There was a problem hiding this comment.
Thanks for diving in. Sounds like the right approach, until we have info that says otherwise.
…table-build # Conflicts: # tools/individual-pkg-gen/copy-files-removing-deps.ts
@aws-cdk/assertions libraryThere was a problem hiding this comment.
Thanks for taking care of this @njlynch
I've updated the title to be cleaner. It looks the description is slightly stale (e.g., uses the term @aws-cdk-lib while we've changed to @aws-cdk-lib-alpha).
Would be good to clean up the description before merging.
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
|
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
The
@aws-cdk/assertionslibrary was previously excluded from the V2 build of the experimental modules,because the
vendor.shscript it used for vendoring in a few modules(
cfnspec,cloudformation-diff, andassert-internal)used paths relative to the V1 module inside the repository.
Change the
vendor.shscript to short-circuit and exit when running intransformphase forthe alpha packages. That's required because the transform phase re-writes imports when copying
the TS files (because it needs to know which modules are also experimental to do the rewriting correctly),
but the
vendor.shscript runs only after thebuildscript for the package has been invoked,which means any TS files copied by it successfully would not have their imports re-written.
Since the build for alpha packages runs after the build for
@aws-cdk/assertions(we add an explicit dependency to make sure that happens),
those files are already "vendored in" correctly, and will be copied when creating the separate package.
Also adjust the module copying logic to account for bundled dependencies,
which
@aws-cdk/assertionuses.Closes #15589
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license