@@ -60,7 +60,14 @@ var ring0Cmd = &cobra.Command{
60
60
Short : "starts ring0 - enter here" ,
61
61
Run : func (_ * cobra.Command , args []string ) {
62
62
log .Init (ServiceName , Version , true , false )
63
- log := log .WithField ("ring" , 0 )
63
+
64
+ wsid := os .Getenv ("GITPOD_WORKSPACE_ID" )
65
+ if wsid == "" {
66
+ log .Error ("cannot find GITPOD_WORKSPACE_ID" )
67
+ return
68
+ }
69
+
70
+ log := log .WithField ("ring" , 0 ).WithField ("workspaceId" , wsid )
64
71
65
72
common_grpc .SetupLogging ()
66
73
@@ -113,6 +120,7 @@ var ring0Cmd = &cobra.Command{
113
120
cmd .Env = append (os .Environ (),
114
121
"WORKSPACEKIT_FSSHIFT=" + prep .FsShift .String (),
115
122
fmt .Sprintf ("WORKSPACEKIT_NO_WORKSPACE_MOUNT=%v" , prep .FullWorkspaceBackup || prep .PersistentVolumeClaim ),
123
+ "GITPOD_WORKSPACE_ID=" + wsid ,
116
124
)
117
125
118
126
if err := cmd .Start (); err != nil {
@@ -186,7 +194,13 @@ var ring1Cmd = &cobra.Command{
186
194
Short : "starts ring1" ,
187
195
Run : func (_cmd * cobra.Command , args []string ) {
188
196
log .Init (ServiceName , Version , true , false )
189
- log := log .WithField ("ring" , 1 )
197
+
198
+ wsid := os .Getenv ("GITPOD_WORKSPACE_ID" )
199
+ if wsid == "" {
200
+ log .Error ("cannot find GITPOD_WORKSPACE_ID" )
201
+ return
202
+ }
203
+ log := log .WithField ("ring" , 1 ).WithField ("workspaceId" , wsid )
190
204
191
205
common_grpc .SetupLogging ()
192
206
@@ -359,6 +373,7 @@ var ring1Cmd = &cobra.Command{
359
373
}
360
374
361
375
env = append (env , "WORKSPACEKIT_WRAP_NETNS=true" )
376
+ env = append (env , "GITPOD_WORKSPACE_ID=" + wsid )
362
377
363
378
socketFN := filepath .Join (os .TempDir (), fmt .Sprintf ("workspacekit-ring1-%d.unix" , time .Now ().UnixNano ()))
364
379
skt , err := net .Listen ("unix" , socketFN )
@@ -738,7 +753,13 @@ var ring2Cmd = &cobra.Command{
738
753
Args : cobra .ExactArgs (1 ),
739
754
Run : func (_cmd * cobra.Command , args []string ) {
740
755
log .Init (ServiceName , Version , true , false )
741
- log := log .WithField ("ring" , 2 )
756
+
757
+ wsid := os .Getenv ("GITPOD_WORKSPACE_ID" )
758
+ if wsid == "" {
759
+ log .Error ("cannot find GITPOD_WORKSPACE_ID" )
760
+ return
761
+ }
762
+ log := log .WithField ("ring" , 2 ).WithField ("workspaceId" , wsid )
742
763
743
764
common_grpc .SetupLogging ()
744
765
0 commit comments