-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
build: make build
should work while offline
#21432
Comments
You can run I'm also inclined to fold this into #14615. Whatever solution we come up with for avoiding hitting the Yarn registry in CI will likely make building offline possible, too. |
Ah, I wasn't aware of |
Yeah, |
@benesch I also ran into this issue while trying to build current master to test for any follow-up bugs after #19472 (comment) . My distro (NixOS) completely blocks network access during builds, for reproducibility. I'm sure this is also the case on other distributions as well. Couldn't we move the |
I don't think there's anything actionable to do here. Regular users should usually be building from tarball, which includes the prebuilt If a dev wants to build a binary without the network, they run @benesch any reason we shouldn't just close this issue? |
@couchand So the My idea about stripping this into separate build phases also goes out into the direction of distro packaging, as some packager build systems fetch source on their own and keep the build phase isolated from network access. That's why I suggested a separate target to fetch external dependencies, and one to build everything assuming external deps are already there. The |
You could try `make pkg/ui/yarn.installed`, which will pull down the
necessary NPM deps without actually building.
As @couchand mentioned, though, your best bet is the source tarball, which
includes a precompiled version of the UI.
…On Wed, Feb 7, 2018 at 10:27 AM Florian Klink ***@***.***> wrote:
@couchand <https://github.com/couchand> So the yarn.lock being present in
the repo doesn't yet solve the problem we're trying to fix near
https://github.com/cockroachdb/cockroach/blob/master/Makefile#L324 ?
My idea about stripping this into separate build phases also goes out into
the direction of distro packaging, as some packager build systems fetch
source on their own and keep the build phase isolated from network access.
That's why I suggested a separate target to fetch external dependencies,
and one to build everything assuming external deps are already there. The
build target could then just execute those sequentially.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#21432 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA15IGLwkgnOslZQYm_tl6Xgq4kXLurZks5tScD1gaJpZM4RdAY5>
.
|
Going to close based on the arguments presented by @couchand. |
I think this is still worth doing something about (although not before 2.0). It's true that the source tarballs provide reproducible offline builds, but only at the go level. If I want to make a custom build with changed Go code, I can do that with the tarball. If I want to make a change to the UI, I need to pull in network resources to rebuild bindata.go (which makes it vulnerable to left-pad nonsense, etc). I think the source tarballs should include the node_modules dependency subtree, so you have the option to rebuild the UI from them too (it's fine if they use a baked-in bindata.go by default). |
Yeah, this is a dupe of #14615 (although my point about including node_modules in source tarballs is kind of independent) |
While I think the use case of someone wanting to pull the source tarball, modify the UI and rebuild without a network connection is awfully marginal, I'm not opposed to adding the I don't think this is the solution to concerns about the left-pad problem (or should we be calling it the gobindata problem now?). Perhaps we should add |
Fair enough, but we solve the gobindata problem with our vendor repo. Here we're talking about node_modules, so it's the left-pad problem :-P
I'm not sure I agree that it's more critical for mainline development than for release archives, but I agree that adding node_modules to the vendor repo would be a good move. I'm just making a cost/benefit argument. Adding the node_modules source to the tarball is (hopefully) trivial, while changing our js dependency workflow to incorporate the submodule is more of a pain. |
Vendor the NPM packages that our UI uses by checking them into a submodule, github.com/cockroachdb/yarn-vendored. This prevents NPM or Yarn registry flakiness from failing our CI builds, and also ensures that a `git clone --recurse-submodules` is sufficient to build CockroachDB offline. The feature that enables this is Yarn's "offline mirror." The blog post that introduced the feature also serves as its documentation: https://yarnpkg.com/blog/2016/11/24/offline-mirror/ To ensure the offline mirror is really used, we pass the '--offline' flag to all Yarn invocations in the build system. Fix cockroachdb#14615. Really fix cockroachdb#21432. Release note: None
Vendor the NPM packages that our UI uses by checking them into a submodule, github.com/cockroachdb/yarn-vendored. This prevents NPM or Yarn registry flakiness from failing our CI builds, and also ensures that a `git clone --recurse-submodules` is sufficient to build CockroachDB offline. The feature that enables this is Yarn's "offline mirror." The blog post that introduced the feature also serves as its documentation: https://yarnpkg.com/blog/2016/11/24/offline-mirror/ To ensure the offline mirror is really used, we pass the '--offline' flag to all Yarn invocations in the build system. Fix cockroachdb#14615. Really fix cockroachdb#21432. Release note: None
27035: ui: vendor NPM modules r=couchand,vilterp,bdarnell a=benesch Vendor the NPM packages that our UI uses by checking them into a submodule, [github.com/cockroachdb/yarn-vendored](https://github.com/cockroachdb/yarn-vendored). This prevents NPM or Yarn registry flakiness from failing our CI builds, and also ensures that a `git clone --recurse-submodules` is sufficient to build CockroachDB offline. The feature that enables this is Yarn's "offline mirror." The blog post that introduced the feature also serves as its documentation: https://yarnpkg.com/blog/2016/11/24/offline-mirror/ To ensure the offline mirror is really used, we pass the '--offline' flag to all Yarn invocations in the build system. Fix #14615. Really fix #21432. Release note: None Co-authored-by: Nikhil Benesch <nikhil.benesch@gmail.com>
I tried running
make build
while offline today, and it failed due to thebuild/node-run.sh -C ./pkg/ui yarn install
step of the build. I was able to work around it by ripping everything related toYARN_INSTALLED_TARGET
out of the Makefile, and the resulting binary's UI worked just fine.It's possible that it works normally and only needed the network because I changed between branches that had different versions of the UI code on them, but even so it'd be nice if there was an easier way to build cockroach while offline than having to do manual Makefile surgery.
The text was updated successfully, but these errors were encountered: