diff --git a/assets/shared-tools/build.sh b/assets/shared-tools/build.sh index d7ddef02..0429b7c9 100644 --- a/assets/shared-tools/build.sh +++ b/assets/shared-tools/build.sh @@ -65,7 +65,9 @@ tool=$1 version=$2 file=$3 wait_share sudo rm -rf "$work"; sudo mkdir -p "$work"; sudo chown "$USER" "$work" cd "$share/.build" -export MISE_LOCKED=1 MISE_TRUSTED_CONFIG_PATHS="$share/.build" MISE_YES=1 +# Six retries of a download, each try at most 30 s without bytes (mise's own timeout): mise's 3 end +# within a two-minute stall, as it tries again on the connection that stalled. +export MISE_LOCKED=1 MISE_TRUSTED_CONFIG_PATHS="$share/.build" MISE_YES=1 MISE_HTTP_RETRIES=6 if [[ $tool == rust ]]; then # The toolchain as rustup lays it out, plus rustup itself for the VM to install (it links the diff --git a/docs/content/docs/internals/images.md b/docs/content/docs/internals/images.md index 4b243865..fc0367e2 100644 --- a/docs/content/docs/internals/images.md +++ b/docs/content/docs/internals/images.md @@ -24,6 +24,7 @@ A build's downloads survive a network that cuts or stalls them: - **`devvm-fetch`**, which base installs and every layer downloads through, gives up on a connection that takes more than 20 seconds to open or stays slower than 1 KB/s for 30 seconds, and tries again from where it stopped, five tries in all, waiting a little longer after each. A server that won't resume (curl's exits 33 and 36) starts the file again from nothing, and so does a file that doesn't match its checksum, once, as a resume may have joined two versions of it. It follows a redirect only to https, and it keeps only a file whose checksum is the pinned one. - **apt** tries a package's download again three times once a source has answered ([base's packages](#bases-packages)). - **crane**, in a `--from` conversion, is tried again five times, and **oh-my-bash**'s clone, in the `omb` feature, is tried five times in all, each failing on a connection that stays slower than 1 KB/s for 30 seconds. +- **mise**, in a tool image's build and on this machine, tries each download again six times (`MISE_HTTP_RETRIES`), as its own three end within a two-minute stall. ## Keys and caching diff --git a/docs/content/docs/releases/0.2.0.md b/docs/content/docs/releases/0.2.0.md index 690e5b2f..7a8ca6de 100644 --- a/docs/content/docs/releases/0.2.0.md +++ b/docs/content/docs/releases/0.2.0.md @@ -122,7 +122,7 @@ A first run also downloads about 210 MB less on arm64 and about 280 MB less on a While tool images build side by side, one status line covers them, and each line of a build's commands in the run log starts with its tool's name, such as `[node]`. When one fails, devvm stops the others and shows the end of that tool's own lines. Each build VM has a name of its own on Lima, `devvm-tools-build` and then `devvm-tools-build-2` to `devvm-tools-build-4`, and a later build or `devvm gc` deletes any of them that a killed or failed run left, and gc names each one it deletes. -These changes, and the next section's, change what goes into base and every layer, so they're built again once, with the pins since 0.2.0-rc.1. Run `devvm update` in each existing VM's folder, as for those pins. +These changes, and the next section's, change what goes into base, every layer and every shared tool, so they're built again once, with the pins since 0.2.0-rc.1. Run `devvm update` in each existing VM's folder, as for those pins. ### A first run on a bad network @@ -130,7 +130,7 @@ A first run failed at the first connection that was cut or stalled, in Lima's do - **Ubuntu's cloud image:** devvm downloads it itself, and a download that's cut or stalls goes on from where it stopped, in the same run or the next ([Ubuntu's cloud image in devvm's folder](#ubuntus-cloud-image-in-devvms-folder)). - **`devvm-fetch`**, which base and every layer download through, gives up on a connection slower than 1 KB/s for 30 seconds and goes on from where it stopped, five tries in all, and a file that doesn't match its checksum is fetched again from nothing once. Your own layers' `devvm-fetch` downloads get the same. -- **apt** tries a package's download again three times, **crane** five times, and **oh-my-bash**'s clone gets five tries in all. +- **apt** tries a package's download again three times, **crane** five times and **mise** six times, in tool builds and on this machine, and **oh-my-bash**'s clone gets five tries in all. ### Ubuntu's cloud image in devvm's folder diff --git a/internal/tools/mise.go b/internal/tools/mise.go index da93945d..fcacb739 100644 --- a/internal/tools/mise.go +++ b/internal/tools/mise.go @@ -258,6 +258,9 @@ func (t Versions) miseCmd(ctx context.Context, mise, dir string, args ...string) "MISE_TRUSTED_CONFIG_PATHS="+dir, "MISE_CEILING_PATHS="+filepath.Dir(dir), "MISE_LOG_FILE="+filepath.Join(dir, miseLog), + // Six retries, as the tool builds' (shared-tools/build.sh): mise's + // three end within a two-minute stall. + "MISE_HTTP_RETRIES=6", ) cmd.Env = append(cmd.Env, proxyEnv...) cmd.Env = append(cmd.Env, caEnv...) diff --git a/internal/tools/proxy_test.go b/internal/tools/proxy_test.go index b468a176..dc725eb8 100644 --- a/internal/tools/proxy_test.go +++ b/internal/tools/proxy_test.go @@ -91,9 +91,9 @@ func TestMiseCmdCompanyProxy(t *testing.T) { if err != nil || slices.ContainsFunc(cmd.Env, func(kv string) bool { return strings.Contains(kv, "proxy.corp") }) { t.Errorf("the environment's: %v, %q", err, cmd.Env) } - // None: nothing added to mise's own eight. + // None: nothing added to mise's own nine. e.Proxy = nil - if cmd, err = e.miseCmd(t.Context(), "/bin/true", t.TempDir(), "lock"); err != nil || len(cmd.Env) != len(os.Environ())+8 { + if cmd, err = e.miseCmd(t.Context(), "/bin/true", t.TempDir(), "lock"); err != nil || len(cmd.Env) != len(os.Environ())+9 { t.Errorf("none: %v, %d of %d", err, len(cmd.Env), len(os.Environ())) } }