Skip to content

Commit

Permalink
Do not upload ghost workspace logs
Browse files Browse the repository at this point in the history
  • Loading branch information
aledbf committed Aug 12, 2021
1 parent 8f867ae commit 3174a5b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
12 changes: 7 additions & 5 deletions components/ws-daemon/pkg/content/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,11 +311,13 @@ func (s *WorkspaceService) DisposeWorkspace(ctx context.Context, req *api.Dispos
return resp, nil
}

// Ok, we have to do all the work
err = s.uploadWorkspaceLogs(ctx, sess)
if err != nil {
log.WithError(err).WithFields(sess.OWI()).Error("log backup failed")
// atm we do not fail the workspace here, yet, because we still might succeed with its content!
if req.BackupLogs {
// Ok, we have to do all the work
err = s.uploadWorkspaceLogs(ctx, sess)
if err != nil {
log.WithError(err).WithFields(sess.OWI()).Error("log backup failed")
// atm we do not fail the workspace here, yet, because we still might succeed with its content!
}
}

if req.Backup {
Expand Down
3 changes: 2 additions & 1 deletion components/ws-manager/pkg/manager/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,7 @@ func (m *Monitor) finalizeWorkspaceContent(ctx context.Context, wso *workspaceOb
}

doBackup := wso.WasEverReady() && !wso.IsWorkspaceHeadless()
doBackupLogs := !wsk8s.IsGhostWorkspace(wso.Pod)
doSnapshot := tpe == api.WorkspaceType_PREBUILD
doFinalize := func() (worked bool, gitStatus *csapi.GitStatus, err error) {
m.finalizerMapLock.Lock()
Expand Down Expand Up @@ -863,7 +864,7 @@ func (m *Monitor) finalizeWorkspaceContent(ctx context.Context, wso *workspaceOb
resp, err := snc.DisposeWorkspace(ctx, &wsdaemon.DisposeWorkspaceRequest{
Id: workspaceID,
Backup: doBackup,
BackupLogs: true,
BackupLogs: doBackupLogs,
})
if resp != nil {
gitStatus = resp.GitStatus
Expand Down

0 comments on commit 3174a5b

Please sign in to comment.