Repository navigation
Add NodeJSRuntimeInfo provider - #863
Globegitter wants to merge 20 commits into
Conversation
|
Cool, I agree we should fix this |
|
Ah just saw that comment now, so missed out on talking with @gregmagolan about that. But yes it would be good to find some more public place for these. We also depend on the I also started to adding starlark unit tests, which I think are the perfect way to test this. Just need to finish them up and make sure they also pass on windows. |
|
I am a fan of these starlark unit-tests. They uncovered some inefficiencies - that we where including all node_modules in sources as well. So we where passing some files around twice. That should be fixed now. Just hoping it will not break anything else. |
|
some broken logic doing |
|
Hmm yeah I will investigate. |
|
@alexeagle Found a fix and also cleaned up the way runfiles are created and added a test to make sure we have the same contents as before. So this PR is also coming with some slight performance improvements, at least theoretical ones. |
|
Ok still some of the tests failing - will investigate. |
|
So, should be all fixed now @alexeagle |
The layers never really worked properly as all the nodejs_binary runfiles, including node_modules and the nodejs binary, where still being put into the top-layer anyway. Now that rules_nodejs are supporting toolchain we could fix that partially by also requiring the toolchain, but that would still not fix node_modules. For that we would need a provider from nodejs_binary, which is proposed here: bazel-contrib/rules_nodejs#863 So we should fix this once it is really possible from the rules_nodejs side.
|
Now that we have toolchain support in we can actually update this provider to include the real toolchain. Will do so shortly. |
The layers never really worked properly as all the nodejs_binary runfiles, including node_modules and the nodejs binary, where still being put into the top-layer anyway. Now that rules_nodejs are supporting toolchain we could fix that partially by also requiring the toolchain, but that would still not fix node_modules. For that we would need a provider from nodejs_binary, which is proposed here: bazel-contrib/rules_nodejs#863 So we should fix this once it is really possible from the rules_nodejs side.
|
I think maybe bazelbuild/rules_docker#1346 made this obsolete? We now get node_modules in a lower layer of the docker image? |
|
This PR was automatically closed because it went two weeks without a reply since it was labeled "Can Close?" |
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
When using
nodejs_imageofrules_dockerthere currently was no way for it to put the npm modules and source files into different layers so even if just changes are being made to the source files incremental rebuilds will have to repack all of node_modules which can be quite slow. In our app a rebuild could take up to 10s.What is the new behavior?
We now expose a provider that other rules can access the needed
nodejs_binaryrunfiles separately, split by its toolchain (i.e. the node binary), node_modules, source files and all other necessary/implicit runfiles. This would allow for `nodejs_image´ to create dedicated layers and in my tests it brought incremental builds, where just source files changed, down to ~3s.Does this PR introduce a breaking change?
Other information
This replaces #283 as it has gotten stale by now but also updates the provider to be compatible with the upcoming toolchain support.