Skip to content
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

Don't trigger TUF when running from build directory #1607

Merged
merged 1 commit into from
Feb 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion cmd/launcher/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,19 @@ func main() {
Level: slog.LevelInfo,
}))

// 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, systemSlogger.Logger)
}

Expand Down
Loading