@@ -440,40 +440,49 @@ func actOnPodEvent(ctx context.Context, m actingManager, manager *Manager, statu
440
440
}
441
441
442
442
span .LogKV ("disposalStatusAnnotation" , ds )
443
- if terminated && ! ds .Status .IsDisposed () {
444
- if wso .Pod .Annotations [workspaceFailedBeforeStoppingAnnotation ] == util .BooleanTrueString && wso .Pod .Annotations [workspaceNeverReadyAnnotation ] == util .BooleanTrueString {
445
- span .LogKV ("event" , "failed before stopping and never ready" )
446
- // The workspace is never ready, so there is no need for a finalizer.
447
- if _ , ok := pod .Annotations [workspaceExplicitFailAnnotation ]; ! ok {
448
- failMessage := status .Conditions .Failed
449
- if failMessage == "" {
450
- failMessage = "workspace failed to start."
451
- }
452
- err := m .markWorkspace (ctx , workspaceID , addMark (workspaceExplicitFailAnnotation , failMessage ))
453
- if err != nil {
454
- log .WithError (err ).Error ("was unable to mark workspace as failed" )
455
- }
456
- }
443
+ if ! terminated {
444
+ return nil
445
+ }
457
446
458
- // delete PVC because the workspace pod is never ready
459
- if err = manager .deleteWorkspacePVC (ctx , pod .Name ); err != nil {
460
- log .Error (err )
461
- return err
447
+ if ds .Status .IsDisposed () {
448
+ if err = manager .deleteWorkspacePVC (ctx , pod .Name ); err != nil {
449
+ log .Error (err )
450
+ return err
451
+ }
452
+ }
453
+
454
+ if wso .Pod .Annotations [workspaceFailedBeforeStoppingAnnotation ] == util .BooleanTrueString && wso .Pod .Annotations [workspaceNeverReadyAnnotation ] == util .BooleanTrueString {
455
+ span .LogKV ("event" , "failed before stopping and never ready" )
456
+ // The workspace is never ready, so there is no need for a finalizer.
457
+ if _ , ok := pod .Annotations [workspaceExplicitFailAnnotation ]; ! ok {
458
+ failMessage := status .Conditions .Failed
459
+ if failMessage == "" {
460
+ failMessage = "workspace failed to start."
462
461
}
463
- return m .modifyFinalizer (ctx , workspaceID , gitpodFinalizerName , false )
464
- } else if wso .Pod .Annotations [abortRequestAnnotation ] == util .BooleanTrueString {
465
- span .LogKV ("event" , "workspace was aborted" )
466
- // The workspace is aborted, so there is no need to finalize content
467
- if err = manager .deleteWorkspacePVC (ctx , pod .Name ); err != nil {
468
- log .Error (err )
469
- return err
462
+ err := m .markWorkspace (ctx , workspaceID , addMark (workspaceExplicitFailAnnotation , failMessage ))
463
+ if err != nil {
464
+ log .WithError (err ).Error ("was unable to mark workspace as failed" )
470
465
}
471
- return m .modifyFinalizer (ctx , workspaceID , gitpodFinalizerName , false )
472
- } else {
473
- // We start finalizing the workspace content only after the container is gone. This way we ensure there's
474
- // no process modifying the workspace content as we create the backup.
475
- go m .finalizeWorkspaceContent (ctx , wso )
476
466
}
467
+
468
+ // delete PVC because the workspace pod is never ready
469
+ if err = manager .deleteWorkspacePVC (ctx , pod .Name ); err != nil {
470
+ log .Error (err )
471
+ return err
472
+ }
473
+ return m .modifyFinalizer (ctx , workspaceID , gitpodFinalizerName , false )
474
+ } else if wso .Pod .Annotations [abortRequestAnnotation ] == util .BooleanTrueString {
475
+ span .LogKV ("event" , "workspace was aborted" )
476
+ // The workspace is aborted, so there is no need to finalize content
477
+ if err = manager .deleteWorkspacePVC (ctx , pod .Name ); err != nil {
478
+ log .Error (err )
479
+ return err
480
+ }
481
+ return m .modifyFinalizer (ctx , workspaceID , gitpodFinalizerName , false )
482
+ } else {
483
+ // We start finalizing the workspace content only after the container is gone. This way we ensure there's
484
+ // no process modifying the workspace content as we create the backup.
485
+ go m .finalizeWorkspaceContent (ctx , wso )
477
486
}
478
487
479
488
case api .WorkspacePhase_STOPPED :
0 commit comments