-
Notifications
You must be signed in to change notification settings - Fork 229
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 xsnap from NPM tarball without git #8536
Comments
Use presence/absence of submodule directories and their `.git` metadata to distinguish between an agoric-sdk clone and an unpacked NPM tarball. Use `git submodule update --init` in the first case, and leave the sources alone in the last case. Still needs real tests, but manual testing passes. refs #8536
This is a pain point for @kbennett2000 , whose internet bandwidth might be lower than usual. |
Reverted #9122 |
When attacking this problem again, a litmus test is whether |
@warner’s branch is over here for the next attempt release-getting-started...warner/8536-xsnap-without-git |
Per conversation with @warner, a thing we haven’t tried yet is determining whether to shell out to
|
Man, this problem is redonculous. https://github.com/Agoric/documentation/actions/runs/8460729116/job/23179429437?pr=1050 I’ll update the parameters and find a better test for whether to shell out to |
What is the Problem Being Solved?
Currently,
@agoric/xsnap
requires thegit
tool to be on $PATH before it can compile the C code that it needs. If the xsnap code is coming from an NPM tarball (i.e. any use outside of the Agoric-SDK), then the build scripts performs agit clone
at install time, to fetch the code from github. This is a drag, and precludes some no-network/hermetic build environments.The intended change is to build xsnap without using git at install time.
Description of the Design
package/xsnap
depends upon Moddable's XS SDK (in a subdirectory namedmoddable/
), as well as the "xsnap" application (in a subdirectory namedxsnap-native/
). This code lives upstream in a separate repository, specifically anagoric-labs
fork of repos from Moddable's github organization.In agoric-sdk, both subdirectories are registered as "git submodules". Currently, during build, our
src/build.js
performs agit submodule update
to either populate these for the first time (i.e. in a brand newgit clone https://github.com/Agoric/agoric-sdk
worktree), or to update them (in case the developer switched branches, and the new branch calls for a different commit-id of the moddable/xsnap code). A file namedbuild.env
is updated to record the git repository URL and commit ID for each. This filename is listed in the package.jsonfiles:
property, so it will be included in the generated tarball when publishing to the NPM registry. Then, if a build is performed from that NPM tarball,build.env
is consulted to perform agit clone
of the two dependency repos, dropping their code into the right subdirectories (as an independent git worktree, rather than a git submodule).Instead, the new plan is:
moddable/
subdirectory, and themoddable/.git
path (which might be a directory, or a redirection file), to determine which of the three cases we're in:git submodule update --init
moddable/
exists butmoddable/.git
does not: we're in an unpacked NPM tarballxsnap-native/
)yarn build
should rungit submodule update --init SUBDIR
to either create or update the submodulemake
command, to recompile any C code that might have changedIn addition, we'll change the
files:
property to include all of the necessary XS and xsnap source code in thenpm pack
tarball that is uploaded to the NPM registry. This allows case C to get the source it needs without git on the second machine.We'll continue to create/update the
build.env
file with the URL and commit-ID of each submodule, and this file will continue to be included in the NPM tarball, however it will be for reference/auditing only (a hint to NPM users as to where the source files came from), and will not be read by the build process.Security Considerations
Slightly improves security: the XS/xsnap source code is included in the uploaded tarball, rather than being downloaded at build time. This removes GitHub from the TCB of the second (downloading) machine. Auditors who inspect the source code of the NPM-hosted tarball (whose hash is generally included in yarn.lock -type files) can rely upon the code they see there, rather than hoping that GitHub will return the same code on each install.
Scaling Considerations
Somewhat worse: the generated NPM tarball is about 2.7MB in size, vs the current 35kB.
Test Plan
yarn pack
from an agoric-sdk checkout, thenyarn install ../../agoric-xsnap-VER.tgz
from a new environment (without /usr/bin/git) and a smoke test to make sure the resulting binary will workgit
from the environmentfiles:
list needs to include things likemodules/base64
andmodules/textencoder
, even though we omit all the XS device drivers (LCD panels, etc) and test262 subdirectories. So this automated test is very important, to make sure we don't accidentally start depending upon a file that we forgot to add tofiles:
. If we made that mistake, agoric-sdk would keep working, but the tarballs we push to NPM would stop being usableUpgrade Considerations
None: existing agoric-sdk worktrees will use the new logic, but will continue to keep their
moddable/
andxsnap-native/
directories the way they are.The text was updated successfully, but these errors were encountered: