@@ -38,15 +38,15 @@ import (
3838type ResolverProvider func () remotes.Resolver
3939
4040type IDEServiceServer struct {
41- config * config.ServiceConfiguration
42- originIDEConfig []byte
43- parsedIDEConfigContent string
44- parsedIDENonExperimental string
45- ideConfig * config.IDEConfig
46- nonExperimentalIDEConfig * config.IDEConfig
47- ideConfigFileName string
48- experimentsClient experiments.Client
49- resolver ResolverProvider
41+ config * config.ServiceConfiguration
42+ originIDEConfig []byte
43+ parsedIDEConfigContent string
44+ parsedCode1_85IDEConfigContent string
45+ ideConfig * config.IDEConfig
46+ code1_85IdeConfig * config.IDEConfig
47+ ideConfigFileName string
48+ experimentsClient experiments.Client
49+ resolver ResolverProvider
5050
5151 api.UnimplementedIDEServiceServer
5252}
@@ -176,70 +176,71 @@ func (s *IDEServiceServer) GetConfig(ctx context.Context, req *api.GetConfigRequ
176176 UserEmail : req .User .GetEmail (),
177177 }
178178
179- experimentalIdesEnabled := s .experimentsClient .GetBoolValue (ctx , "experimentalIdes" , false , attributes )
179+ // Check flag to enable vscode for older linux distros (distros that don't support glibc 2.28)
180+ enableVscodeForOlderLinuxDistros := s .experimentsClient .GetBoolValue (ctx , "enableVscodeForOlderLinuxDistros" , false , attributes )
180181
181- if experimentalIdesEnabled {
182+ if enableVscodeForOlderLinuxDistros {
182183 return & api.GetConfigResponse {
183- Content : s .parsedIDEConfigContent ,
184+ Content : s .parsedCode1_85IDEConfigContent ,
184185 }, nil
185186 } else {
186187 return & api.GetConfigResponse {
187- Content : s .parsedIDENonExperimental ,
188+ Content : s .parsedIDEConfigContent ,
188189 }, nil
189190 }
190191}
191192
192193func (s * IDEServiceServer ) readIDEConfig (ctx context.Context , isInit bool ) {
193- b , err := os .ReadFile (s .ideConfigFileName )
194+ ideConfigbuffer , err := os .ReadFile (s .ideConfigFileName )
194195 if err != nil {
195- log .WithError (err ).Warn ("cannot read ide config file" )
196+ log .WithError (err ).Warn ("cannot read original ide config file" )
196197 return
197198 }
198- if ideConfig , err := ParseConfig (ctx , s .resolver (), b ); err != nil {
199+ if originalIdeConfig , err := ParseConfig (ctx , s .resolver (), ideConfigbuffer ); err != nil {
199200 if ! isInit {
200- log .WithError (err ).Fatal ("cannot parse ide config" )
201+ log .WithError (err ).Fatal ("cannot parse original ide config" )
201202 }
202- log .WithError (err ).Error ("cannot parse ide config" )
203+ log .WithError (err ).Error ("cannot parse original ide config" )
203204 return
204205 } else {
205- parsedConfig , err := json .Marshal (ideConfig )
206+ parsedConfig , err := json .Marshal (originalIdeConfig )
206207 if err != nil {
207- log .WithError (err ).Error ("cannot marshal ide config" )
208+ log .WithError (err ).Error ("cannot marshal original ide config" )
208209 return
209210 }
210211
211- // Precompute the config without experimental IDEs
212- ideOptions := ideConfig .IdeOptions .Options
213- nonExperimentalIdeOptions := make (map [string ]config.IDEOption )
214- for key , ide := range ideOptions {
215- if ! ide . Experimental {
216- nonExperimentalIdeOptions [key ] = ide
212+ // Precompute the config without code 1.85
213+ code1_85IdeOptions := originalIdeConfig .IdeOptions .Options
214+ ideOptions := make (map [string ]config.IDEOption )
215+ for key , ide := range code1_85IdeOptions {
216+ if key != "code1_85" {
217+ ideOptions [key ] = ide
217218 }
218219 }
219220
220- nonExperimentalConfig := & config.IDEConfig {
221- SupervisorImage : ideConfig .SupervisorImage ,
221+ ideConfig := & config.IDEConfig {
222+ SupervisorImage : originalIdeConfig .SupervisorImage ,
222223 IdeOptions : config.IDEOptions {
223- Options : nonExperimentalIdeOptions ,
224- DefaultIde : ideConfig .IdeOptions .DefaultIde ,
225- DefaultDesktopIde : ideConfig .IdeOptions .DefaultDesktopIde ,
226- Clients : ideConfig .IdeOptions .Clients ,
224+ Options : ideOptions ,
225+ DefaultIde : originalIdeConfig .IdeOptions .DefaultIde ,
226+ DefaultDesktopIde : originalIdeConfig .IdeOptions .DefaultDesktopIde ,
227+ Clients : originalIdeConfig .IdeOptions .Clients ,
227228 },
228229 }
229230
230- parsedNonExperimentalConfig , err := json .Marshal (nonExperimentalConfig )
231+ parsedIdeConfig , err := json .Marshal (ideConfig )
231232 if err != nil {
232- log .WithError (err ).Error ("cannot marshal non-experimental ide config" )
233+ log .WithError (err ).Error ("cannot marshal ide config" )
233234 return
234235 }
235236
236- s .parsedIDEConfigContent = string (parsedConfig )
237- s .ideConfig = ideConfig
237+ s .parsedCode1_85IDEConfigContent = string (parsedConfig )
238+ s .code1_85IdeConfig = originalIdeConfig
238239
239- s .nonExperimentalIDEConfig = nonExperimentalConfig
240- s .parsedIDENonExperimental = string (parsedNonExperimentalConfig )
240+ s .ideConfig = ideConfig
241+ s .parsedIDEConfigContent = string (parsedIdeConfig )
241242
242- s .originIDEConfig = b
243+ s .originIDEConfig = ideConfigbuffer
243244
244245 log .Info ("ide config updated" )
245246 }
@@ -353,7 +354,7 @@ func (s *IDEServiceServer) ResolveWorkspaceConfig(ctx context.Context, req *api.
353354 log .WithField ("req" , req ).Debug ("receive ResolveWorkspaceConfig request" )
354355
355356 // make a copy for ref ideConfig, it's safe because we replace ref in update config
356- ideConfig := s .ideConfig
357+ ideConfig := s .code1_85IdeConfig
357358
358359 var defaultIde * config.IDEOption
359360
0 commit comments