return err
}
defer os.RemoveAll(boot.tempdir)
+ if err := os.Mkdir(filepath.Join(boot.tempdir, "bin"), 0777); err != nil {
+ return err
+ }
// Fill in any missing config keys, and write the resulting
// config in the temp dir for child services to use.
boot.setEnv("ARVADOS_CONFIG", boot.configfile)
boot.setEnv("RAILS_ENV", boot.ClusterType)
boot.setEnv("TMPDIR", boot.tempdir)
+ boot.prependEnv("PATH", filepath.Join(boot.tempdir, "bin")+":")
boot.prependEnv("PATH", filepath.Join(boot.LibPath, "bin")+":")
boot.cluster, err = cfg.GetCluster("")
func (boot *Booter) installGoProgram(ctx context.Context, srcpath string) error {
boot.goMutex.Lock()
defer boot.goMutex.Unlock()
- return boot.RunProgram(ctx, filepath.Join(boot.SourcePath, srcpath), nil, []string{"GOPATH=" + boot.LibPath}, "go", "install")
+ return boot.RunProgram(ctx, filepath.Join(boot.SourcePath, srcpath), nil, []string{"GOBIN=" + boot.tempdir + "/bin"}, "go", "install")
}
func (boot *Booter) setupRubyEnv() error {
func (runner runGoProgram) Run(ctx context.Context, fail func(error), boot *Booter) error {
boot.wait(ctx, runner.depends...)
- err := boot.RunProgram(ctx, runner.src, nil, nil, "go", "install")
+ bindir := filepath.Join(boot.tempdir, "bin")
+ err := boot.RunProgram(ctx, runner.src, nil, []string{"GOBIN=" + bindir}, "go", "install")
if err != nil {
return err
}
return ctx.Err()
}
_, basename := filepath.Split(runner.src)
+ binfile := filepath.Join(bindir, basename)
+
if len(runner.svc.InternalURLs) > 0 {
// Run one for each URL
for u := range runner.svc.InternalURLs {
boot.waitShutdown.Add(1)
go func() {
defer boot.waitShutdown.Done()
- fail(boot.RunProgram(ctx, boot.tempdir, nil, []string{"ARVADOS_SERVICE_INTERNAL_URL=" + u.String()}, basename))
+ fail(boot.RunProgram(ctx, boot.tempdir, nil, []string{"ARVADOS_SERVICE_INTERNAL_URL=" + u.String()}, binfile))
}()
}
} else {
boot.waitShutdown.Add(1)
go func() {
defer boot.waitShutdown.Done()
- fail(boot.RunProgram(ctx, boot.tempdir, nil, nil, basename))
+ fail(boot.RunProgram(ctx, boot.tempdir, nil, nil, binfile))
}()
}
return nil