@@ -191,15 +191,18 @@ func Run(options ...RunOption) {
191
191
configureGit (cfg , childProcEnvvars )
192
192
193
193
tokenService := NewInMemoryTokenService ()
194
- tkns , err := cfg .GetTokens (true )
195
- if err != nil {
196
- log .WithError (err ).Warn ("cannot prepare tokens" )
197
- }
198
- for i := range tkns {
199
- _ , err = tokenService .SetToken (context .Background (), & tkns [i ].SetTokenRequest )
194
+
195
+ if ! opts .RunGP {
196
+ tkns , err := cfg .GetTokens (true )
200
197
if err != nil {
201
198
log .WithError (err ).Warn ("cannot prepare tokens" )
202
199
}
200
+ for i := range tkns {
201
+ _ , err = tokenService .SetToken (context .Background (), & tkns [i ].SetTokenRequest )
202
+ if err != nil {
203
+ log .WithError (err ).Warn ("cannot prepare tokens" )
204
+ }
205
+ }
203
206
}
204
207
205
208
tunneledPortsService := ports .NewTunneledPortsService (cfg .DebugEnable )
@@ -238,29 +241,41 @@ func Run(options ...RunOption) {
238
241
desktopIdeReady * ideReadyState = nil
239
242
240
243
cstate = NewInMemoryContentState (cfg .RepoRoot )
244
+ gitpodService serverapi.APIInterface
245
+
246
+ notificationService = NewNotificationService ()
247
+ )
248
+
249
+ if ! opts .RunGP {
241
250
gitpodService = serverapi .NewServerApiService (ctx , & serverapi.ServiceConfig {
242
251
Host : host ,
243
252
Endpoint : endpoint ,
244
253
InstanceID : cfg .WorkspaceInstanceID ,
245
254
WorkspaceID : cfg .WorkspaceID ,
246
255
SupervisorVersion : Version ,
247
256
}, tokenService )
257
+ }
248
258
249
- notificationService = NewNotificationService ()
250
- )
251
259
if cfg .DesktopIDE != nil {
252
260
desktopIdeReady = & ideReadyState {cond : sync .NewCond (& sync.Mutex {})}
253
261
}
254
- if ! cfg .isHeadless () {
262
+ if ! cfg .isHeadless () && ! opts . RunGP {
255
263
go trackReadiness (ctx , gitpodService , cfg , cstate , ideReady , desktopIdeReady )
256
264
}
257
265
tokenService .provider [KindGit ] = []tokenProvider {NewGitTokenProvider (gitpodService , cfg .WorkspaceConfig , notificationService )}
258
266
259
267
gitpodConfigService := config .NewConfigService (cfg .RepoRoot + "/.gitpod.yml" , cstate .ContentReady (), log .Log )
260
268
go gitpodConfigService .Watch (ctx )
261
269
270
+ var exposedPorts ports.ExposedPortsInterface
271
+
272
+ if ! opts .RunGP {
273
+ exposedPorts = createExposedPortsImpl (cfg , gitpodService )
274
+ }
275
+
276
+ // createExposedPortsImpl(cfg, gitpodService)
262
277
portMgmt := ports .NewManager (
263
- createExposedPortsImpl ( cfg , gitpodService ) ,
278
+ exposedPorts ,
264
279
& ports.PollingServedPortsObserver {
265
280
RefreshInterval : 2 * time .Second ,
266
281
},
@@ -270,7 +285,10 @@ func Run(options ...RunOption) {
270
285
)
271
286
272
287
topService := NewTopService ()
273
- topService .Observe (ctx )
288
+
289
+ if ! opts .RunGP {
290
+ topService .Observe (ctx )
291
+ }
274
292
275
293
supervisorMetrics := metrics .NewMetrics ()
276
294
var metricsReporter * metrics.GrpcMetricsReporter
@@ -353,17 +371,28 @@ func Run(options ...RunOption) {
353
371
wg sync.WaitGroup
354
372
shutdown = make (chan ShutdownReason , 1 )
355
373
)
356
- wg .Add (1 )
357
- go startContentInit (ctx , cfg , & wg , cstate , supervisorMetrics )
374
+
375
+ if ! opts .RunGP {
376
+ wg .Add (1 )
377
+ go startContentInit (ctx , cfg , & wg , cstate , supervisorMetrics )
378
+ }
379
+
358
380
wg .Add (1 )
359
381
go startAPIEndpoint (ctx , cfg , & wg , apiServices , tunneledPortsService , metricsReporter , apiEndpointOpts ... )
360
- wg .Add (1 )
361
- go startSSHServer (ctx , cfg , & wg , childProcEnvvars )
382
+
383
+ if ! opts .RunGP {
384
+ wg .Add (1 )
385
+ go startSSHServer (ctx , cfg , & wg , childProcEnvvars )
386
+ }
387
+
362
388
wg .Add (1 )
363
389
tasksSuccessChan := make (chan taskSuccess , 1 )
364
390
go taskManager .Run (ctx , & wg , tasksSuccessChan )
365
- wg .Add (1 )
366
- go socketActivationForDocker (ctx , & wg , termMux )
391
+
392
+ if ! opts .RunGP {
393
+ wg .Add (1 )
394
+ go socketActivationForDocker (ctx , & wg , termMux )
395
+ }
367
396
368
397
if cfg .isHeadless () {
369
398
wg .Add (1 )
@@ -897,7 +926,7 @@ func prepareIDELaunch(cfg *Config, ideConfig *IDEConfig, childProcEnvvars []stri
897
926
// of envvars. If envvars is nil, os.Environ() is used.
898
927
//
899
928
// Beware: if config contains an OTS URL the results may differ on subsequent calls.
900
- func buildChildProcEnv (cfg * Config , envvars []string ) []string {
929
+ func buildChildProcEnv (cfg * Config , envvars []string , runGP bool ) []string {
901
930
if envvars == nil {
902
931
envvars = os .Environ ()
903
932
}
@@ -917,7 +946,10 @@ func buildChildProcEnv(cfg *Config, envvars []string) []string {
917
946
918
947
envs [nme ] = val
919
948
}
920
- envs ["SUPERVISOR_ADDR" ] = fmt .Sprintf ("localhost:%d" , cfg .APIEndpointPort )
949
+
950
+ if ! runGP {
951
+ envs ["SUPERVISOR_ADDR" ] = fmt .Sprintf ("localhost:%d" , cfg .APIEndpointPort )
952
+ }
921
953
922
954
if cfg .EnvvarOTS != "" {
923
955
es , err := downloadEnvvarOTS (cfg .EnvvarOTS )
0 commit comments