Skip to content

Commit a4684ce

Browse files
committed
Launch additional project
1 parent eed1d00 commit a4684ce

File tree

1 file changed

+34
-0
lines changed
  • components/ide/jetbrains/launcher

1 file changed

+34
-0
lines changed

components/ide/jetbrains/launcher/main.go

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,14 @@ func launch(launchCtx *LaunchContext) {
602602
log.WithError(err).Error("failed to install gitpod-remote plugin")
603603
}
604604

605+
go func(launchCtx *LaunchContext, additonalProjects []string) {
606+
// TODO: wait until backend is healthy
607+
time.Sleep(5 * time.Second)
608+
for _, project := range additonalProjects {
609+
go appendAdditonalProject(launchCtx, project)
610+
}
611+
}(launchCtx, gitpodConfig.Jetbrains.Projects)
612+
605613
// run backend
606614
run(launchCtx)
607615
}
@@ -640,6 +648,31 @@ func run(launchCtx *LaunchContext) {
640648
os.Exit(cmd.ProcessState.ExitCode())
641649
}
642650

651+
func appendAdditonalProject(launchCtx *LaunchContext, projectLocation string) {
652+
var args []string
653+
if launchCtx.warmup {
654+
args = append(args, "warmup")
655+
} else if launchCtx.preferToolbox {
656+
args = append(args, "serverMode")
657+
} else {
658+
args = append(args, "run")
659+
}
660+
args = append(args, projectLocation)
661+
662+
cmd := remoteDevServerCmd(args, launchCtx)
663+
// Enable host status endpoint
664+
cmd.Env = append(cmd.Env, "CWM_HOST_STATUS_OVER_HTTP_TOKEN=gitpod")
665+
666+
if err := cmd.Start(); err != nil {
667+
log.WithError(err).Error("failed to start")
668+
}
669+
670+
err := cmd.Wait()
671+
if err != nil {
672+
log.Warn("faild to start additional project", log.WithField("project", projectLocation), log.WithError(err))
673+
}
674+
}
675+
643676
// resolveUserEnvs emulats the interactive login shell to ensure that all user defined shell scripts are loaded
644677
func resolveUserEnvs() (userEnvs []string, err error) {
645678
shell := os.Getenv("SHELL")
@@ -1113,6 +1146,7 @@ func installPlugins(config *gitpod.GitpodConfig, launchCtx *LaunchContext) error
11131146

11141147
var args []string
11151148
args = append(args, "installPlugins")
1149+
// TODO(hw): Do we need project path here?
11161150
args = append(args, launchCtx.projectContextDir)
11171151
args = append(args, plugins...)
11181152
cmd := remoteDevServerCmd(args, launchCtx)

0 commit comments

Comments
 (0)