diff --git a/build/README-bundle.md b/build/README-bundle.md index 2bbe652eb..4dc96c687 100644 --- a/build/README-bundle.md +++ b/build/README-bundle.md @@ -34,10 +34,10 @@ development = true - You can also specify a URL, together with a sha256 checksum to avoid downloading from github. -- You can also specify an EnvVar, to provide the path dynamically at runtime. +- You can also specify an environment variable (`LOTUS_BUILTIN_ACTORS_VX_BUNDLE`), to provide the path dynamically at runtime. The precedence for bundle fetching/loading is as folllows: -- Check the EnvVar; use the bundle specified by it. +- Check the environment variable `LOTUS_BUILTIN_ACTORS_VX_BUNDLE` for version X bundle; use it if set. - Check the Path; use the bundle specified by it. - Check the URL; use the bundle specified by it, and verify the checksum which must be present. - Otherwise, use the release tag and download from github. diff --git a/build/bundle.go b/build/bundle.go index e404abf09..c1c5df611 100644 --- a/build/bundle.go +++ b/build/bundle.go @@ -20,8 +20,6 @@ type Bundle struct { Version actors.Version // Release is the release id Release string - // EnvVar is the (optional) env var specifying the bundle path; takes precdence over path - EnvVar string // Path is the (optional) bundle path; takes precedence over url Path string // URL is the (optional) bundle URL; takes precdence over github release diff --git a/node/bundle/manifest.go b/node/bundle/manifest.go index 0e4819ce2..c1a5b0953 100644 --- a/node/bundle/manifest.go +++ b/node/bundle/manifest.go @@ -2,6 +2,7 @@ package bundle import ( "context" + "fmt" "io" "os" @@ -86,13 +87,11 @@ func FetchAndLoadBundles(ctx context.Context, bs blockstore.Blockstore, bar map[ } for av, bd := range bar { + envvar := fmt.Sprintf("LOGUS_BUILTIN_ACTORS_V%d_BUNDLE", av) switch { - case bd.EnvVar != "": + case os.Getenv(envvar) != "": // this is a local bundle, specified by an env var to load from the filesystem - path := os.Getenv(bd.EnvVar) - if path == "" { - return xerrors.Errorf("bundle envvar is empty: %s", bd.EnvVar) - } + path := os.Getenv(envvar) if _, err := LoadBundle(ctx, bs, path, av); err != nil { return err diff --git a/node/modules/builtin_actors.go b/node/modules/builtin_actors.go index c7cacaa56..3697747d8 100644 --- a/node/modules/builtin_actors.go +++ b/node/modules/builtin_actors.go @@ -68,14 +68,11 @@ func LoadBuiltinActors(lc fx.Lifecycle, mctx helpers.MetricsCtx, r repo.LockedRe } // we haven't recorded it in the datastore, so we need to load it + envvar := fmt.Sprintf("LOGUS_BUILTIN_ACTORS_V%d_BUNDLE", av) var mfCid cid.Cid switch { - case bd.EnvVar != "": - // this is a local bundle, specified by an env var to load from the filesystem - path := os.Getenv(bd.EnvVar) - if path == "" { - return result, xerrors.Errorf("bundle envvar is empty: %s", bd.EnvVar) - } + case os.Getenv(envvar) != "": + path := os.Getenv(envvar) mfCid, err = bundle.LoadBundle(ctx, bs, path, av) if err != nil {