Skip to content

Commit

Permalink
Don't trigger TUF when running from build
Browse files Browse the repository at this point in the history
  • Loading branch information
directionless committed Feb 15, 2024
1 parent 48b47f2 commit e3ef6dc
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cmd/launcher/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,19 @@ func main() {

ctx = ctxlog.NewContext(ctx, logger)

// If this is a development build directory, we want to skip the TUF lookups and just run
// the requested build. Don't care about errors here. This is developer experience shim
inBuildDir := false
if execPath, err := os.Executable(); err == nil {
inBuildDir = strings.Contains(execPath, filepath.Join("launcher", "build")) && !env.Bool("LAUNCHER_FORCE_UPDATE_IN_BUILD", false)
}

// If there's a newer version of launcher on disk, use it.
// Allow a caller to set `LAUNCHER_SKIP_UPDATES` as a way to
// skip exec'ing an update. This helps prevent launcher from
// fork-bombing itself. This is an ENV, because there's no
// good way to pass it through the flags.
if !env.Bool("LAUNCHER_SKIP_UPDATES", false) {
if !env.Bool("LAUNCHER_SKIP_UPDATES", false) && !inBuildDir {
runNewerLauncherIfAvailable(ctx, logger)
}

Expand Down

0 comments on commit e3ef6dc

Please sign in to comment.