-
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
chore: build.sh script unnecessarily requires lerna to be globally installed #24217
Conversation
Either lerna needs to be installed as a dependency or run through npx. Otherwise build.sh fails in the middle of a build on a system without it installed.
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 My changes un-break the build. I'm not sure how I would write a test for it. |
Exemption Request My changes un-break the build. I'm not sure how I would write a test for it. |
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.
Thanks for the PR @timmattison! Changing this to a "chore" instead of a "fix" because it's developer/contributor facing and not customer facing. (Anything labeled as "fix" or "feat" ends up in the changelog and release notes, which is not necessary here.)
✅ Updated pull request passes all PRLinter validations. Dissmissing previous PRLinter review.
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). |
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.
@timmattison @madeline-k Are you sure that's what's going on? Because in line 38 the scripts adds node_modules/.bin
to the path and in line 48 it does a yarn install
which would install lerna at the right version.
And this does work on my machine (I know, I know) and in CI. So something else must be going on.
Either way, if we want to use npx
it would at least have to be qualified to the correct version npx lerna@^4.0.0
PS: @madeline-k feel free to just dismiss my review if I'm blocking something =)
@mrgrain You are completely correct, the script does install (The |
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). |
@mrgrain, dismissing your review. We can always revert this if I am incorrect on something, but I think the change is good as is. |
Pull request has been modified.
This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state. |
3 similar comments
This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state. |
This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state. |
This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state. |
This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state. |
4 similar comments
This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state. |
This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state. |
This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state. |
This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state. |
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 like our automations weren't working correctly here when previously approved.
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.
Actually, it looks like a piece of the command got removed with this change. We want the concurrency setting left in there.
Pull request has been modified.
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). |
Pull request has been modified.
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). |
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 CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
`npm bin` was [removed in npm 9](npm/cli#5459). `npx` or `npm exec` should be used instead. `build.sh` already uses `npm exec`, since aws#24217.
`npm bin` was [removed in npm 9](npm/cli#5459). `npx` or `npm exec` should be used instead. [This comment](aws#24217 (comment)) on a similar PR, and the discussion on the [PR in npm removing `npm bin`](npm/cli#5459) explain why `npx lerna` is preferable.
This change removes the expression `export PATH=$(npm bin):$PATH`, which had formerly been used in scripts to ensure `node_modules` is in `PATH`. `npm bin` was [removed in npm 9](npm/cli#5459). `npm exec` or `npx` should be used instead. `build.sh` already uses `npx`. This change revises `scripts/gen.sh` to use `npx` as well. Prior to this change, within shells executing `build.sh` or `scripts/gen.sh`, `PATH` actually contains error text if npm 9+ is used. ``` ~/repos/aws-cdk $ docker run --rm -v $PWD:$PWD -w $PWD node:hydrogen-alpine sh -c 'node --version && npm --version && export PATH=$(npm bin):$PATH && echo $PATH' # output when npm bin is unavailable v18.16.0 9.5.1 Unknown command: "bin" To see a list of supported npm commands, run: npm help:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin ~/repos/aws-cdk $ docker run --rm -v $PWD:$PWD -w $PWD node:gallium-alpine sh -c 'node --version && npm --version && export PATH=$(npm bin):$PATH && echo $PATH' # output when npm bin is available v16.20.0 8.19.4 /Users/douglasnaphas/repos/aws-cdk/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin ``` It didn't make `build.sh` fail, because `lerna` has been run via `npx` since #24217, and `build.sh` doesn't need anything from `node_modules` to be added to `PATH`. `export PATH=$(npm bin):$PATH` succeeds even though `npm bin` fails, per `export`'s normal behavior. Prior to this change, `scripts/gen.sh` failed with ``` ./scripts/gen.sh: line 18: lerna: command not found ``` when I ran it. After this change, `scripts/gen.sh` ran successfully. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Either lerna needs to be installed as a dependency or run through npx. Otherwise build.sh fails in the middle of a build on a system without it installed.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license