@@ -109,6 +109,7 @@ import { Deferred } from "@gitpod/gitpod-protocol/lib/util/deferred";
109
109
import { ExtendedUser } from "@gitpod/ws-manager/lib/constraints" ;
110
110
import { increaseFailedInstanceStartCounter , increaseSuccessfulInstanceStartCounter } from "../prometheus-metrics" ;
111
111
import { ContextParser } from "./context-parser-service" ;
112
+ import { IDEService } from "../ide-service" ;
112
113
113
114
export interface StartWorkspaceOptions {
114
115
rethrow ?: boolean ;
@@ -119,6 +120,7 @@ export interface StartWorkspaceOptions {
119
120
const MAX_INSTANCE_START_RETRIES = 2 ;
120
121
const INSTANCE_START_RETRY_INTERVAL_SECONDS = 2 ;
121
122
123
+ // TODO(ak) move to IDE service
122
124
export const migrationIDESettings = ( user : User ) => {
123
125
if ( ! user ?. additionalData ?. ideSettings || user . additionalData . ideSettings . settingVersion === "2.0" ) {
124
126
return ;
@@ -145,6 +147,7 @@ export const migrationIDESettings = (user: User) => {
145
147
return newIDESettings ;
146
148
} ;
147
149
150
+ // TODO(ak) move to IDE service
148
151
export const chooseIDE = (
149
152
ideChoice : string ,
150
153
ideOptions : IDEOptions ,
@@ -181,6 +184,7 @@ export class WorkspaceStarter {
181
184
@inject ( WorkspaceManagerClientProvider ) protected readonly clientProvider : WorkspaceManagerClientProvider ;
182
185
@inject ( Config ) protected readonly config : Config ;
183
186
@inject ( IDEConfigService ) private readonly ideConfigService : IDEConfigService ;
187
+ @inject ( IDEService ) private readonly ideService : IDEService ;
184
188
@inject ( TracedWorkspaceDB ) protected readonly workspaceDb : DBWithTracing < WorkspaceDB > ;
185
189
@inject ( TracedUserDB ) protected readonly userDB : DBWithTracing < UserDB > ;
186
190
@inject ( TokenProvider ) protected readonly tokenProvider : TokenProvider ;
@@ -598,6 +602,7 @@ export class WorkspaceStarter {
598
602
excludeFeatureFlags : NamedWorkspaceFeatureFlag [ ] ,
599
603
ideConfig : IDEConfig ,
600
604
) : Promise < WorkspaceInstance > {
605
+ //#endregion IDE resolution TODO(ak) move to IDE service
601
606
// TODO: Compatible with ide-config not deployed, need revert after ide-config deployed
602
607
delete ideConfig . ideOptions . options [ "code-latest" ] ;
603
608
delete ideConfig . ideOptions . options [ "code-desktop-insiders" ] ;
@@ -654,6 +659,7 @@ export class WorkspaceStarter {
654
659
} ) ;
655
660
}
656
661
}
662
+ //#endregion
657
663
658
664
let featureFlags : NamedWorkspaceFeatureFlag [ ] = workspace . config . _featureFlags || [ ] ;
659
665
featureFlags = featureFlags . concat ( this . config . workspaceDefaults . defaultFeatureFlags ) ;
@@ -706,6 +712,7 @@ export class WorkspaceStarter {
706
712
return instance ;
707
713
}
708
714
715
+ // TODO(ak) move to IDE service
709
716
protected resolveReferrerIDE (
710
717
workspace : Workspace ,
711
718
user : User ,
@@ -1129,12 +1136,13 @@ export class WorkspaceStarter {
1129
1136
envvars . push ( contextEnv ) ;
1130
1137
1131
1138
log . debug ( "Workspace config" , workspace . config ) ;
1132
- if ( ! ! workspace . config . tasks ) {
1133
- // The task config is interpreted by Theia only, there's little point in transforming it into something
1139
+ const tasks = this . ideService . resolveGitpodTasks ( workspace ) ;
1140
+ if ( tasks . length ) {
1141
+ // The task config is interpreted by supervisor only, there's little point in transforming it into something
1134
1142
// wsman understands and back into the very same structure.
1135
1143
const ev = new EnvironmentVariable ( ) ;
1136
1144
ev . setName ( "GITPOD_TASKS" ) ;
1137
- ev . setValue ( JSON . stringify ( workspace . config . tasks ) ) ;
1145
+ ev . setValue ( JSON . stringify ( tasks ) ) ;
1138
1146
envvars . push ( ev ) ;
1139
1147
}
1140
1148
0 commit comments