Skip to content

[ws-daemon] Fix workspace location for log backup #18401

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 2, 2023
Merged

Conversation

WVerlaek
Copy link
Member

@WVerlaek WVerlaek commented Aug 1, 2023

Description

Fix workspace location for logs backup. Use the session's location (path on daemon host) instead of the WorkspaceLocation of the CRD (comes from .gitpod.yml's workspaceLocation)

Summary generated by Copilot

🤖 Generated by Copilot at 4c9fa34

Refactor uploadWorkspaceLogs and BackupOptions to use workspace location from Workspace object. This reduces code complexity and redundancy.

Related Issue(s)

Fixes ENG-50

How to test

Tested in a preview env, by creating a prebuild without this change (no logs in dashboard when viewing the completed prebuild), and then a prebuild after this change, which does show logs even after reloading the page.

Documentation

Preview status

gitpod:summary

Build Options

Build
  • /werft with-werft
    Run the build with werft instead of GHA
  • leeway-no-cache
  • /werft no-test
    Run Leeway with --dont-test
Publish
  • /werft publish-to-npm
  • /werft publish-to-jb-marketplace
Installer
  • analytics=segment
  • with-dedicated-emulation
  • workspace-feature-flags
    Add desired feature flags to the end of the line above, space separated
Preview Environment / Integration Tests
  • /werft with-local-preview
    If enabled this will build install/preview
  • /werft with-preview
  • /werft with-large-vm
  • /werft with-gce-vm
    If enabled this will create the environment on GCE infra
  • with-integration-tests=all
    Valid options are all, workspace, webapp, ide, jetbrains, vscode, ssh. If enabled, with-preview and with-large-vm will be enabled.
  • with-monitoring

/hold

Copy link
Contributor

@kylos101 kylos101 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Tested we can snapshot and restore, too.

Tested prebuilds stream while prebuilding, can start from a prebuild, stop, and restart

Tested backup of a regular workspace, and related restart

@@ -345,9 +344,9 @@ func ensureCleanSlate(location string) error {
return nil
}

func (wso *DefaultWorkspaceOperations) uploadWorkspaceLogs(ctx context.Context, opts BackupOptions) (err error) {
func (wso *DefaultWorkspaceOperations) uploadWorkspaceLogs(ctx context.Context, opts BackupOptions, location string) (err error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any unit tests we need to add/update as part of this to ensure the regression doesn't happen again in the future?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated an existing integration test to check for uploaded logs. There's no unit tests nor is it easy to add one now that would catch this regression

@WVerlaek WVerlaek requested a review from a team as a code owner August 2, 2023 09:29
@roboquat roboquat added size/M and removed size/S labels Aug 2, 2023
Copy link
Member

@geropl geropl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️

@WVerlaek
Copy link
Member Author

WVerlaek commented Aug 2, 2023

/unhold

@roboquat roboquat merged commit 1d68d00 into main Aug 2, 2023
@roboquat roboquat deleted the wv/fix-logs-backup branch August 2, 2023 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants