diff --git a/components/ide-service/pkg/server/testdata/ideconfig_happypath.golden b/components/ide-service/pkg/server/testdata/ideconfig_happypath.golden deleted file mode 100644 index 3bc141b7eae493..00000000000000 --- a/components/ide-service/pkg/server/testdata/ideconfig_happypath.golden +++ /dev/null @@ -1,93 +0,0 @@ -{ - "Config": { - "supervisorImage": "eu.gcr.io/gitpod-core-dev/build/supervisor:commit-ff38b98b7dde4929159bcaeec68d178898dc2139", - "ideOptions": { - "options": { - "code": { - "orderKey": "00", - "title": "VS Code", - "type": "browser", - "logo": "https://ide.gitpod.io/image/ide-logo/vscode.svg", - "label": "Browser", - "image": "eu.gcr.io/gitpod-core-dev/build/ide/code:commit-d6329814c2aa34c414574fd0d1301447d6fe82c9", - "latestImage": "eu.gcr.io/gitpod-core-dev/build/ide/code:commit-d6329814c2aa34c414574fd0d1301447d6fe82c9@sha256:9f8f3951386b5490e798308c84695fbf448721ef1febd1779ecd668c47fa601a" - }, - "code-desktop": { - "orderKey": "02", - "title": "VS Code", - "type": "desktop", - "logo": "https://ide.gitpod.io/image/ide-logo/vscode.svg", - "image": "eu.gcr.io/gitpod-core-dev/build/ide/code-desktop:commit-c2b7421628ed5a5fb618817a4fd1549684659c2d", - "latestImage": "eu.gcr.io/gitpod-core-dev/build/ide/code-desktop-insiders:commit-c2b7421628ed5a5fb618817a4fd1549684659c2d@sha256:d9e39323a5b517ad753a3daeccb7b8d66ed8727bc222fc63cc124f1563723639" - }, - "goland": { - "orderKey": "05", - "title": "GoLand", - "type": "desktop", - "logo": "https://ide.gitpod.io/image/ide-logo/golandLogo.svg", - "image": "eu.gcr.io/gitpod-core-dev/build/ide/goland:commit-9a6c79a91b2b1f583d5bcb7f9f1ef54ee977e0df", - "latestImage": "eu.gcr.io/gitpod-core-dev/build/ide/goland:commit-9a6c79a91b2b1f583d5bcb7f9f1ef54ee977e0df@sha256:665b0456e38cf75e7ca7f300b5fd73827065210df310c6b57d1b41f179af0c46" - }, - "intellij": { - "orderKey": "04", - "title": "IntelliJ IDEA", - "type": "desktop", - "logo": "https://ide.gitpod.io/image/ide-logo/intellijIdeaLogo.svg", - "image": "eu.gcr.io/gitpod-core-dev/build/ide/intellij:commit-9a6c79a91b2b1f583d5bcb7f9f1ef54ee977e0df", - "latestImage": "eu.gcr.io/gitpod-core-dev/build/ide/intellij:commit-9a6c79a91b2b1f583d5bcb7f9f1ef54ee977e0df@sha256:d7528b797a73835ebf51d976c0e73782f501acf08801ca3ad81bde72bc32df98" - }, - "phpstorm": { - "orderKey": "07", - "title": "PhpStorm", - "type": "desktop", - "logo": "https://ide.gitpod.io/image/ide-logo/phpstormLogo.svg", - "image": "eu.gcr.io/gitpod-core-dev/build/ide/phpstorm:commit-9a6c79a91b2b1f583d5bcb7f9f1ef54ee977e0df", - "latestImage": "eu.gcr.io/gitpod-core-dev/build/ide/phpstorm:commit-9a6c79a91b2b1f583d5bcb7f9f1ef54ee977e0df@sha256:5c6ef331fbf7379c970565d9d62b9ddfdfbc945c3acaa895020a551144ba42b4" - }, - "pycharm": { - "orderKey": "06", - "title": "PyCharm", - "type": "desktop", - "logo": "https://ide.gitpod.io/image/ide-logo/pycharmLogo.svg", - "image": "eu.gcr.io/gitpod-core-dev/build/ide/pycharm:commit-9a6c79a91b2b1f583d5bcb7f9f1ef54ee977e0df", - "latestImage": "eu.gcr.io/gitpod-core-dev/build/ide/pycharm:commit-9a6c79a91b2b1f583d5bcb7f9f1ef54ee977e0df@sha256:94e3e684420179fc7ea6bf4245c2c9de666babc4c1366e08cc56b744f27dd275" - } - }, - "defaultIde": "code", - "defaultDesktopIde": "code-desktop", - "clients": { - "jetbrains-gateway": { - "defaultDesktopIDE": "intellij", - "desktopIDEs": [ - "intellij", - "goland", - "pycharm", - "phpstorm" - ], - "installationSteps": [ - "If you don't see an open dialog in your browser, make sure you have the \u003ca target='_blank' class='gp-link' href='https://www.gitpod.io/docs/ides-and-editors/jetbrains-gateway#getting-started-jetbrains-gateway'\u003eJetBrains Gateway with Gitpod Plugin\u003c/a\u003e installed on your machine, and then click \u003cb\u003e${OPEN_LINK_LABEL}\u003c/b\u003e below." - ] - }, - "vscode": { - "defaultDesktopIDE": "code-desktop", - "desktopIDEs": [ - "code-desktop" - ], - "installationSteps": [ - "If you don't see an open dialog in your browser, make sure you have \u003ca target='_blank' class='gp-link' href='https://code.visualstudio.com/download'\u003eVS Code\u003c/a\u003e installed on your machine, and then click \u003cb\u003e${OPEN_LINK_LABEL}\u003c/b\u003e below." - ] - }, - "vscode-insiders": { - "defaultDesktopIDE": "code-desktop", - "desktopIDEs": [ - "code-desktop" - ], - "installationSteps": [ - "If you don't see an open dialog in your browser, make sure you have \u003ca target='_blank' class='gp-link' href='https://code.visualstudio.com/insiders'\u003eVS Code Insiders\u003c/a\u003e installed on your machine, and then click \u003cb\u003e${OPEN_LINK_LABEL}\u003c/b\u003e below." - ] - } - } - } - }, - "Err": "" -} \ No newline at end of file diff --git a/components/ide-service/pkg/server/testdata/ideconfig_happypath_resolve.golden b/components/ide-service/pkg/server/testdata/ideconfig_happypath_resolve.golden deleted file mode 100644 index 9b2cf2a9e12702..00000000000000 --- a/components/ide-service/pkg/server/testdata/ideconfig_happypath_resolve.golden +++ /dev/null @@ -1,95 +0,0 @@ -{ - "Config": { - "supervisorImage": "eu.gcr.io/gitpod-core-dev/build/supervisor:commit-ff38b98b7dde4929159bcaeec68d178898dc2139", - "ideOptions": { - "options": { - "code": { - "orderKey": "00", - "title": "VS Code", - "type": "browser", - "logo": "https://ide.gitpod.io/image/ide-logo/vscode.svg", - "label": "Browser", - "image": "eu.gcr.io/gitpod-core-dev/build/ide/code:commit-d6329814c2aa34c414574fd0d1301447d6fe82c9@sha256:9f8f3951386b5490e798308c84695fbf448721ef1febd1779ecd668c47fa601a", - "latestImage": "eu.gcr.io/gitpod-core-dev/build/ide/code:commit-d6329814c2aa34c414574fd0d1301447d6fe82c9@sha256:9f8f3951386b5490e798308c84695fbf448721ef1febd1779ecd668c47fa601a", - "resolveImageDigest": true - }, - "code-desktop": { - "orderKey": "02", - "title": "VS Code", - "type": "desktop", - "logo": "https://ide.gitpod.io/image/ide-logo/vscode.svg", - "image": "eu.gcr.io/gitpod-core-dev/build/ide/code-desktop:commit-c2b7421628ed5a5fb618817a4fd1549684659c2d", - "latestImage": "eu.gcr.io/gitpod-core-dev/build/ide/code-desktop-insiders:commit-c2b7421628ed5a5fb618817a4fd1549684659c2d@sha256:d9e39323a5b517ad753a3daeccb7b8d66ed8727bc222fc63cc124f1563723639" - }, - "goland": { - "orderKey": "05", - "title": "GoLand", - "type": "desktop", - "logo": "https://ide.gitpod.io/image/ide-logo/golandLogo.svg", - "image": "eu.gcr.io/gitpod-core-dev/build/ide/goland:commit-9a6c79a91b2b1f583d5bcb7f9f1ef54ee977e0df@sha256:665b0456e38cf75e7ca7f300b5fd73827065210df310c6b57d1b41f179af0c46", - "latestImage": "eu.gcr.io/gitpod-core-dev/build/ide/goland:commit-9a6c79a91b2b1f583d5bcb7f9f1ef54ee977e0df@sha256:665b0456e38cf75e7ca7f300b5fd73827065210df310c6b57d1b41f179af0c46", - "resolveImageDigest": true - }, - "intellij": { - "orderKey": "04", - "title": "IntelliJ IDEA", - "type": "desktop", - "logo": "https://ide.gitpod.io/image/ide-logo/intellijIdeaLogo.svg", - "image": "eu.gcr.io/gitpod-core-dev/build/ide/intellij:commit-9a6c79a91b2b1f583d5bcb7f9f1ef54ee977e0df", - "latestImage": "eu.gcr.io/gitpod-core-dev/build/ide/intellij:commit-9a6c79a91b2b1f583d5bcb7f9f1ef54ee977e0df@sha256:d7528b797a73835ebf51d976c0e73782f501acf08801ca3ad81bde72bc32df98" - }, - "phpstorm": { - "orderKey": "07", - "title": "PhpStorm", - "type": "desktop", - "logo": "https://ide.gitpod.io/image/ide-logo/phpstormLogo.svg", - "image": "eu.gcr.io/gitpod-core-dev/build/ide/phpstorm:commit-9a6c79a91b2b1f583d5bcb7f9f1ef54ee977e0df", - "latestImage": "eu.gcr.io/gitpod-core-dev/build/ide/phpstorm:commit-9a6c79a91b2b1f583d5bcb7f9f1ef54ee977e0df@sha256:5c6ef331fbf7379c970565d9d62b9ddfdfbc945c3acaa895020a551144ba42b4" - }, - "pycharm": { - "orderKey": "06", - "title": "PyCharm", - "type": "desktop", - "logo": "https://ide.gitpod.io/image/ide-logo/pycharmLogo.svg", - "image": "eu.gcr.io/gitpod-core-dev/build/ide/pycharm:commit-9a6c79a91b2b1f583d5bcb7f9f1ef54ee977e0df", - "latestImage": "eu.gcr.io/gitpod-core-dev/build/ide/pycharm:commit-9a6c79a91b2b1f583d5bcb7f9f1ef54ee977e0df@sha256:94e3e684420179fc7ea6bf4245c2c9de666babc4c1366e08cc56b744f27dd275" - } - }, - "defaultIde": "code", - "defaultDesktopIde": "code-desktop", - "clients": { - "jetbrains-gateway": { - "defaultDesktopIDE": "intellij", - "desktopIDEs": [ - "intellij", - "goland", - "pycharm", - "phpstorm" - ], - "installationSteps": [ - "If you don't see an open dialog in your browser, make sure you have the \u003ca target='_blank' class='gp-link' href='https://www.gitpod.io/docs/ides-and-editors/jetbrains-gateway#getting-started-jetbrains-gateway'\u003eJetBrains Gateway with Gitpod Plugin\u003c/a\u003e installed on your machine, and then click \u003cb\u003e${OPEN_LINK_LABEL}\u003c/b\u003e below." - ] - }, - "vscode": { - "defaultDesktopIDE": "code-desktop", - "desktopIDEs": [ - "code-desktop" - ], - "installationSteps": [ - "If you don't see an open dialog in your browser, make sure you have \u003ca target='_blank' class='gp-link' href='https://code.visualstudio.com/download'\u003eVS Code\u003c/a\u003e installed on your machine, and then click \u003cb\u003e${OPEN_LINK_LABEL}\u003c/b\u003e below." - ] - }, - "vscode-insiders": { - "defaultDesktopIDE": "code-desktop", - "desktopIDEs": [ - "code-desktop" - ], - "installationSteps": [ - "If you don't see an open dialog in your browser, make sure you have \u003ca target='_blank' class='gp-link' href='https://code.visualstudio.com/insiders'\u003eVS Code Insiders\u003c/a\u003e installed on your machine, and then click \u003cb\u003e${OPEN_LINK_LABEL}\u003c/b\u003e below." - ] - } - } - } - }, - "Err": "" -} \ No newline at end of file diff --git a/components/ide-service/pkg/server/testdata/ideconfig_idetype_not_correct.golden b/components/ide-service/pkg/server/testdata/ideconfig_idetype_not_correct.golden deleted file mode 100644 index c5cb0883db93a5..00000000000000 --- a/components/ide-service/pkg/server/testdata/ideconfig_idetype_not_correct.golden +++ /dev/null @@ -1,12 +0,0 @@ -{ - "Config": { - "supervisorImage": "", - "ideOptions": { - "options": null, - "defaultIde": "", - "defaultDesktopIde": "", - "clients": null - } - }, - "Err": "invalid ide config: DefaultDesktopIde should be desktop but browser" -} \ No newline at end of file diff --git a/components/ide-service/pkg/server/testdata/ideconfig_idetype_unknown.golden b/components/ide-service/pkg/server/testdata/ideconfig_idetype_unknown.golden deleted file mode 100644 index 7893c5b89ecb39..00000000000000 --- a/components/ide-service/pkg/server/testdata/ideconfig_idetype_unknown.golden +++ /dev/null @@ -1,12 +0,0 @@ -{ - "Config": { - "supervisorImage": "", - "ideOptions": { - "options": null, - "defaultIde": "", - "defaultDesktopIde": "", - "clients": null - } - }, - "Err": "invalid ide config" -} \ No newline at end of file diff --git a/components/ide-service/pkg/server/testdata/resolve_ws_config_referrer_invalid.golden b/components/ide-service/pkg/server/testdata/resolve_ws_config_referrer_invalid.golden index ec088fcbca185b..d4ab298f485431 100644 --- a/components/ide-service/pkg/server/testdata/resolve_ws_config_referrer_invalid.golden +++ b/components/ide-service/pkg/server/testdata/resolve_ws_config_referrer_invalid.golden @@ -4,4 +4,4 @@ "web_image": "eu.gcr.io/gitpod-core-dev/build/ide/code:commit-d6329814c2aa34c414574fd0d1301447d6fe82c9" }, "Err": "" -} \ No newline at end of file +} diff --git a/components/ide-service/pkg/server/testdata/resolve_ws_config_regular_code.golden b/components/ide-service/pkg/server/testdata/resolve_ws_config_regular_code.golden index 22e8d5a9e166fc..738ae1ed74d8ba 100644 --- a/components/ide-service/pkg/server/testdata/resolve_ws_config_regular_code.golden +++ b/components/ide-service/pkg/server/testdata/resolve_ws_config_regular_code.golden @@ -10,4 +10,4 @@ "web_image": "eu.gcr.io/gitpod-core-dev/build/ide/code:commit-d6329814c2aa34c414574fd0d1301447d6fe82c9" }, "Err": "" -} \ No newline at end of file +} diff --git a/components/ide/jetbrains/launcher/main.go b/components/ide/jetbrains/launcher/main.go index f2d527088c5dce..373021b58a4f97 100644 --- a/components/ide/jetbrains/launcher/main.go +++ b/components/ide/jetbrains/launcher/main.go @@ -161,6 +161,7 @@ func main() { } if launchCtx.warmup { + waitForTasksToFinish() launch(launchCtx) return } @@ -853,3 +854,66 @@ func resolveProjectContextDir(launchCtx *LaunchContext) string { return launchCtx.projectDir } + +func waitForTasksToFinish() { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + var conn *grpc.ClientConn + var err error + + for { + conn, err = dial(ctx) + if err == nil { + err = checkTasks(ctx, conn) + } + + if err == nil { + return + } + + log.WithError(err).Error("launcher: failed to check tasks status") + + select { + case <-ctx.Done(): + return + case <-time.After(1 * time.Second): + } + } +} + +func checkTasks(ctx context.Context, conn *grpc.ClientConn) error { + client := supervisor.NewStatusServiceClient(conn) + tasksResponse, err := client.TasksStatus(ctx, &supervisor.TasksStatusRequest{Observe: true}) + if err != nil { + return xerrors.Errorf("failed get tasks status client: %w", err) + } + + for { + var runningTasksCounter int + + resp, err := tasksResponse.Recv() + if err != nil { + return err + } + + for _, task := range resp.Tasks { + if task.State != supervisor.TaskState_closed && task.Presentation.Name != "GITPOD_JB_WARMUP_TASK" { + runningTasksCounter++ + } + } + if runningTasksCounter == 0 { + break + } + } + + return nil +} + +func dial(ctx context.Context) (*grpc.ClientConn, error) { + supervisorConn, err := grpc.DialContext(ctx, util.GetSupervisorAddress(), grpc.WithTransportCredentials(insecure.NewCredentials())) + if err != nil { + err = xerrors.Errorf("failed connecting to supervisor: %w", err) + } + return supervisorConn, err +}