diff --git a/components/ide/jetbrains/image/status/main.go b/components/ide/jetbrains/image/status/main.go index 9fc75794e242ec..7c1441a174ced5 100644 --- a/components/ide/jetbrains/image/status/main.go +++ b/components/ide/jetbrains/image/status/main.go @@ -50,9 +50,10 @@ var ( type LaunchContext struct { startTime time.Time - port string - alias string - label string + port string + alias string + label string + warmup bool qualifier string productDir string @@ -89,10 +90,27 @@ func main() { log.Info(ServiceName + ": " + Version) startTime := time.Now() - if len(os.Args) < 3 { - log.Fatalf("Usage: %s []\n", os.Args[0]) + var port string + var warmup bool + + if len(os.Args) < 2 { + log.Fatalf("Usage: %s (warmup|)\n", os.Args[0]) + } + + if os.Args[1] == "warmup" { + if len(os.Args) < 3 { + log.Fatalf("Usage: %s %s \n", os.Args[0], os.Args[1]) + } + + warmup = true + } else { + if len(os.Args) < 3 { + log.Fatalf("Usage: %s []\n", os.Args[0]) + } + + port = os.Args[1] } - port := os.Args[1] + alias := os.Args[2] label := "Open JetBrains IDE" if len(os.Args) > 3 { @@ -129,9 +147,10 @@ func main() { launchCtx := &LaunchContext{ startTime: startTime, - port: port, - alias: alias, - label: label, + warmup: warmup, + port: port, + alias: alias, + label: label, qualifier: qualifier, productDir: productDir, @@ -140,6 +159,11 @@ func main() { backendVersion: backendVersion, wsInfo: wsInfo, } + + if launchCtx.warmup { + launch(launchCtx) + return + } // we should start serving immediately and postpone launch // in order to enable a JB Gateway to connect as soon as possible go launch(launchCtx) @@ -423,7 +447,11 @@ func launch(launchCtx *LaunchContext) { func run(launchCtx *LaunchContext) { var args []string - args = append(args, "run") + if launchCtx.warmup { + args = append(args, "warmup") + } else { + args = append(args, "run") + } args = append(args, launchCtx.projectContextDir) cmd := remoteDevServerCmd(args, launchCtx)