@@ -748,14 +748,15 @@ export class GitpodServerImpl implements GitpodServerWithTracing, Disposable {
748
748
await this . guardAccess ( { kind : "workspace" , subject : workspace } , "get" ) ;
749
749
}
750
750
751
- this . internalStopWorkspace ( ctx , workspace ) . catch ( ( err ) => {
751
+ this . internalStopWorkspace ( ctx , workspace , "stopped via API" ) . catch ( ( err ) => {
752
752
log . error ( logCtx , "stopWorkspace error: " , err ) ;
753
753
} ) ;
754
754
}
755
755
756
756
protected async internalStopWorkspace (
757
757
ctx : TraceContext ,
758
758
workspace : Workspace ,
759
+ reason : string ,
759
760
policy ?: StopWorkspacePolicy ,
760
761
admin : boolean = false ,
761
762
) : Promise < void > {
@@ -782,7 +783,8 @@ export class GitpodServerImpl implements GitpodServerWithTracing, Disposable {
782
783
await this . guardAccess ( { kind : "workspaceInstance" , subject : instance , workspace } , "update" ) ;
783
784
}
784
785
}
785
- await this . workspaceStarter . stopWorkspaceInstance ( ctx , instance . id , instance . region , policy ) ;
786
+
787
+ await this . workspaceStarter . stopWorkspaceInstance ( ctx , instance . id , instance . region , reason , policy ) ;
786
788
}
787
789
788
790
protected async guardAdminAccess ( method : string , params : any , requiredPermission : PermissionName ) {
@@ -834,7 +836,7 @@ export class GitpodServerImpl implements GitpodServerWithTracing, Disposable {
834
836
await this . guardAccess ( { kind : "workspace" , subject : ws } , "delete" ) ;
835
837
836
838
// for good measure, try and stop running instances
837
- await this . internalStopWorkspace ( ctx , ws ) ;
839
+ await this . internalStopWorkspace ( ctx , ws , "deleted via API" ) ;
838
840
839
841
// actually delete the workspace
840
842
await this . workspaceDeletionService . softDeleteWorkspace ( ctx , ws , "user" ) ;
0 commit comments