-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Managed directories should rerun repository rule if directory is deleted or timestamp changes #8487
Comments
/cc @irengrig @alexeagle |
…ess: - If managed directory is declared for the external repository and does not exist (probably was deleted by user), make external repository dirty and re-fetch it. - Add tests to demonstrate the added behavior to ManagedDirectoriesBlackBoxTest. - Closes bazelbuild#8487.
* entry_point attribute of nodejs_binary & rollup_bundle is now a label * symlinking of node_modules for yarn_install temporarily disabled (except for integration/bazel) until the fix for bazelbuild/bazel#8487 makes it into a future bazel release
* entry_point attribute of nodejs_binary & rollup_bundle is now a label * symlinking of node_modules for yarn_install temporarily disabled (except for integration/bazel) until the fix for bazelbuild/bazel#8487 makes it into a future bazel release
…SPACE and bazel schematics This is needed to work-around issue: yarn_install & npm_install with managed directories can't handle deleted or manually regenerated node_modules folder [bazel-contrib/rules_nodejs#802] Underlying issue has been fixed in Bazel bazelbuild/bazel#8487 but hasn't landed in a release yet
* entry_point attribute of nodejs_binary & rollup_bundle is now a label * symlinking of node_modules for yarn_install temporarily disabled (except for integration/bazel) until the fix for bazelbuild/bazel#8487 makes it into a future bazel release
…SPACE and bazel schematics This is needed to work-around issue: yarn_install & npm_install with managed directories can't handle deleted or manually regenerated node_modules folder [bazel-contrib/rules_nodejs#802] Underlying issue has been fixed in Bazel bazelbuild/bazel#8487 but hasn't landed in a release yet
* entry_point attribute of nodejs_binary & rollup_bundle is now a label * symlinking of node_modules for yarn_install temporarily disabled (except for integration/bazel) until the fix for bazelbuild/bazel#8487 makes it into a future bazel release
…SPACE and bazel schematics This is needed to work-around issue: yarn_install & npm_install with managed directories can't handle deleted or manually regenerated node_modules folder [bazel-contrib/rules_nodejs#802] Underlying issue has been fixed in Bazel bazelbuild/bazel#8487 but hasn't landed in a release yet
* entry_point attribute of nodejs_binary & rollup_bundle is now a label * symlinking of node_modules for yarn_install temporarily disabled (except for integration/bazel) until the fix for bazelbuild/bazel#8487 makes it into a future bazel release PR Close #30627
…SPACE and bazel schematics (#30627) This is needed to work-around issue: yarn_install & npm_install with managed directories can't handle deleted or manually regenerated node_modules folder [bazel-contrib/rules_nodejs#802] Underlying issue has been fixed in Bazel bazelbuild/bazel#8487 but hasn't landed in a release yet PR Close #30627
* Entry_point attribute of nodejs_binary & rollup_bundle is now a label * Nodejs rules 0.30.1 has new feature to symlink node_modules with yarn_install and bazel 0.26.0 includes new managed_directories feature which enables this * Symlinking of node_modules for yarn_install temporarily disabled (except for integration/bazel) until the fix for bazelbuild/bazel#8487 makes it into a future bazel release. This is needed to work-around issue: yarn_install & npm_install with managed directories can't handle deleted or manually regenerated node_modules folder [bazel-contrib/rules_nodejs#802]. Underlying issue has been fixed in Bazel bazelbuild/bazel#8487 but hasn't landed in a release yet
* entry_point attribute of nodejs_binary & rollup_bundle is now a label * nodejs rules 0.30.1 has new feature to symlink node_modules with yarn_install and bazel 0.26.0 includes new managed_directories feature which enables this * Symlinking of node_modules for yarn_install temporarily disabled (except for integration/bazel) until the fix for bazelbuild/bazel#8487 makes it into a future bazel release. This is needed to work-around issue: yarn_install & npm_install with managed directories can't handle deleted or manually regenerated node_modules folder [bazel-contrib/rules_nodejs#802]. Underlying issue has been fixed in Bazel bazelbuild/bazel#8487 but hasn't landed in a release yet
* entry_point attribute of nodejs_binary & rollup_bundle is now a label * nodejs rules 0.30.1 has new feature to symlink node_modules with yarn_install and bazel 0.26.0 includes new managed_directories feature which enables this * Symlinking of node_modules for yarn_install temporarily disabled (except for integration/bazel) until the fix for bazelbuild/bazel#8487 makes it into a future bazel release. This is needed to work-around issue: yarn_install & npm_install with managed directories can't handle deleted or manually regenerated node_modules folder [bazel-contrib/rules_nodejs#802]. Underlying issue has been fixed in Bazel bazelbuild/bazel#8487 but hasn't landed in a release yet PR Close #30965
…ess. - If managed directory is declared for the external repository and does not exist (probably was deleted by user), make external repository dirty and re-fetch it. - Add tests to demonstrate the added behavior to ManagedDirectoriesBlackBoxTest. - Closes #8487. Closes #8564. PiperOrigin-RevId: 251882207
* entry_point attribute of nodejs_binary & rollup_bundle is now a label * symlinking of node_modules for yarn_install temporarily disabled (except for integration/bazel) until the fix for bazelbuild/bazel#8487 makes it into a future bazel release PR Close angular#30627
…SPACE and bazel schematics (angular#30627) This is needed to work-around issue: yarn_install & npm_install with managed directories can't handle deleted or manually regenerated node_modules folder [bazel-contrib/rules_nodejs#802] Underlying issue has been fixed in Bazel bazelbuild/bazel#8487 but hasn't landed in a release yet PR Close angular#30627
Tested 0.27.0rc5 in my repro repo and the first case of the node_modules folder being deleted is fixed:
|
The 2nd case described where node_modules is deleted and then manually re-created with Repro is:
=>
|
…ess. - If managed directory is declared for the external repository and does not exist (probably was deleted by user), make external repository dirty and re-fetch it. - Add tests to demonstrate the added behavior to ManagedDirectoriesBlackBoxTest. - Closes bazelbuild#8487. Closes bazelbuild#8564. PiperOrigin-RevId: 251882207
…ess. - If managed directory is declared for the external repository and does not exist (probably was deleted by user), make external repository dirty and re-fetch it. - Add tests to demonstrate the added behavior to ManagedDirectoriesBlackBoxTest. - Closes bazelbuild#8487. Closes bazelbuild#8564. PiperOrigin-RevId: 251882207
Is this fixed in any released version? |
The fix to determine if the node_modules (managed directory) exists is in Bazel 0.27.1. |
I think this is a potentially big problem - is it really solved by the proposed solution? Out in the wild, it's common for developers to perform operations that mutate contents of node_modules. It's not rare for Node-based software to write to node_modules. Therefore, it seems insufficient (for a correct and reliable development experience) to just look for a missing or time stamped node_modules as a signal to recreate. So I wonder if this is really a case echoing some other discussion (forget where) about the need for users to have (read-only) access to intermediate build output like generated code. How can a writable node_modules exposed to users or tools be trusted to contain the results of a yarn-install? At the moment, my impression from all this (maybe wrong) is that to get a reliable build, a user must freshly:
What can be done to make node_modules (both what users see, and what rules see) reliably contain a pure function of the contents of package.json, lock file, and upstream NPM repos? |
@kylecordes, if Node-based software truly writes to node_modules then there would be an issue whether managed directories is being used or not. More info here: https://docs.bazel.build/versions/master/skylark/repository_rules.html#when-is-the-implementation-function-executed A way to avoid having to run those commands is to just call |
One possible way to resolve some of the user pain is for |
No longer needed as managed directories is removed |
Description of the problem / feature request:
rules_nodejs yarn_install & npm_install with managed directories can't handle deleted or manually regenerated node_modules folder. See bazel-contrib/rules_nodejs#802 for full description.
Feature requests: what underlying problem are you trying to solve with this feature?
When using managed directories with yarn_install & npm_install in rules_nodejs 0.30.0+, when a user deletes the node_modules folder and runs bazel the repository rule should re-run (managed directory missing) which would recreate the node_modules folder from scratch.
If a user deletes the node_modules folder and recreates it manually using
yarn
ornpm install
then the repository rule should also re-run in that case as well (managed directory timestamp changed).Currently after deleting node_modules, the only way to get back to a working build (besides modifying package.json or the lock file) is to run
bazel clean --expunge
to clear out the external repository and force the yarn_install or npm_install rule to rerun.Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
case 1:
case 2:
error in both cases:
What operating system are you running Bazel on?
OSX but issue is OS agnostic.
What's the output of
bazel info release
?release 0.26.0-homebrew
The text was updated successfully, but these errors were encountered: