Skip to content

Commit 92e14cf

Browse files
[server] Pass selected desktop IDE to ws-manager
1 parent faa677c commit 92e14cf

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

components/gitpod-protocol/src/workspace-instance.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,4 +212,7 @@ export interface WorkspaceInstanceConfiguration {
212212

213213
// ideImage is the ref of the IDE image this instance uses.
214214
ideImage: string;
215+
216+
// desktopIdeImage is the ref of the desktop IDE image this instance uses.
217+
desktopIdeImage?: string
215218
}

components/server/src/ide-config.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ interface RawIDEConfig {
1717
ideVersion: string;
1818
ideImageRepo: string;
1919
ideImageAliases?: { [index: string]: string };
20+
desktopIdeImageAliases?: { [index: string]: string };
2021
}
2122
const scheme = {
2223
"type": "object",
@@ -30,7 +31,11 @@ const scheme = {
3031
"ideImageAliases": {
3132
"type": "object",
3233
"additionalProperties": { "type": "string" }
33-
}
34+
},
35+
"desktopIdeImageAliases": {
36+
"type": "object",
37+
"additionalProperties": { "type": "string" }
38+
},
3439
},
3540
"required": [
3641
"ideVersion",
@@ -42,7 +47,7 @@ export interface IDEConfig {
4247
ideVersion: string;
4348
ideImageRepo: string;
4449
ideImageAliases: { [index: string]: string };
45-
50+
desktopIdeImageAliases: { [index: string]: string };
4651
ideImage: string;
4752
}
4853

@@ -112,6 +117,9 @@ export class IDEConfigService {
112117
ideImageAliases: {
113118
...raw.ideImageAliases,
114119
"theia": ideImage,
120+
},
121+
desktopIdeImageAliases: {
122+
...raw.desktopIdeImageAliases
115123
}
116124
}
117125
}

components/server/src/workspace/workspace-starter.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,21 @@ export class WorkspaceStarter {
323323
}
324324
}
325325

326+
const useDesktopIdeChoice = user.additionalData?.ideSettings?.useDesktopIde || false;
327+
if (useDesktopIdeChoice) {
328+
const desktopIdeChoice = user.additionalData?.ideSettings?.defaultDesktopIde;
329+
if (!!desktopIdeChoice) {
330+
const mappedImage = ideConfig.desktopIdeImageAliases[desktopIdeChoice];
331+
if (!!mappedImage) {
332+
configuration.desktopIdeImage = mappedImage;
333+
} else if (this.authService.hasPermission(user, "ide-settings")) {
334+
// if the IDE choice isn't one of the preconfiured choices, we assume its the image name.
335+
// For now, this feature requires special permissions.
336+
configuration.desktopIdeImage = desktopIdeChoice;
337+
}
338+
}
339+
}
340+
326341
let featureFlags: NamedWorkspaceFeatureFlag[] = workspace.config._featureFlags || [];
327342
featureFlags = featureFlags.concat(this.config.workspaceDefaults.defaultFeatureFlags);
328343
if (user.featureFlags && user.featureFlags.permanentWSFeatureFlags) {
@@ -724,6 +739,7 @@ export class WorkspaceStarter {
724739
spec.setPortsList(ports);
725740
spec.setInitializer((await initializerPromise).initializer);
726741
spec.setIdeImage(ideImage);
742+
spec.setDesktopIdeImage(instance.configuration?.desktopIdeImage || "");
727743
spec.setWorkspaceImage(instance.workspaceImage);
728744
spec.setWorkspaceLocation(workspace.config.workspaceLocation || spec.getCheckoutLocation());
729745
spec.setFeatureFlagsList(this.toWorkspaceFeatureFlags(featureFlags));

0 commit comments

Comments
 (0)