Skip to content
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

[dashboard] integrate v2 WorkspaceService.getWorkspace #18884

Merged
merged 1 commit into from
Oct 18, 2023

Conversation

akosyakov
Copy link
Member

@akosyakov akosyakov commented Oct 6, 2023

Description

This PR integrates V2 WorkspaceService.getWorkspace in the dashboard. The migration will be done in 2 steps:

  • First the dashboard code is changed to use gRPC shapes, but under the hood still JSON-RPC service is used. The PR should strive to minimal changes in the UI component code of the dashboard. It is not feature flagged, and the quality control happens on the PR.
  • Second traffic is shifted to the actual gRPC service using a feature flag. It will done first for internal users and after confirming functionality for all users.
Summary generated by Copilot

🤖 Generated by Copilot at 6e11f42

This pull request adds experimental support for a new WorkspaceService API that allows managing workspaces using different RPC frameworks. It introduces a new proto file that defines the service and its messages, and several generated files that provide client and server implementations for Go, TypeScript, and web browsers using Connect, gRPC, and gRPC-Web.

Related Issue(s)

Part of EXP-643

How to test

  • Start, stop and restart a workspace, check that the start page works well.
  • Trigger a prebuild and check that logs from prebuild are streamed still.
  • Start, stop and restart a workspace from the prebuild, check that the start page works well.

Documentation

Preview status

Gitpod was successfully deployed to your preview environment.

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

@akosyakov akosyakov force-pushed the ak/public_api_v2_get_workspace branch from 5522f52 to 0e146dd Compare October 6, 2023 12:44
@akosyakov akosyakov force-pushed the ak/public_api_v2_get_workspace branch 2 times, most recently from df9024b to 9f8afad Compare October 16, 2023 08:25
@akosyakov akosyakov changed the base branch from main to ak/get_workspace_v2 October 16, 2023 09:01
@akosyakov akosyakov changed the title [public-api] add v2 WorkspaceService.getWorkspace [dashboard] integrate v2 WorkspaceService.getWorkspace Oct 16, 2023
@akosyakov akosyakov force-pushed the ak/public_api_v2_get_workspace branch from 9f8afad to 20a6d13 Compare October 16, 2023 09:10
@akosyakov
Copy link
Member Author

akosyakov commented Oct 16, 2023

/gh run recreate-vm=true

Comment triggered a workflow run

Started workflow run: 6531719748

  • recreate_vm: true

@akosyakov akosyakov force-pushed the ak/public_api_v2_get_workspace branch 3 times, most recently from db84465 to ef8fe77 Compare October 16, 2023 20:43
Base automatically changed from ak/get_workspace_v2 to main October 17, 2023 08:06
@akosyakov akosyakov force-pushed the ak/public_api_v2_get_workspace branch 2 times, most recently from 3f8d83b to 17a2c6a Compare October 17, 2023 08:39
@akosyakov akosyakov marked this pull request as ready for review October 17, 2023 08:41
@akosyakov akosyakov requested a review from a team as a code owner October 17, 2023 08:41
const metadata: HeadersInit = {};
metadata[applicationErrorCode] = String(reason.code);
metadata[applicationErrorData] = JSON.stringify(reason.data);
if (reason.code === ErrorCodes.NOT_FOUND) {
Copy link
Member

Choose a reason for hiding this comment

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

🧡

@@ -57,6 +57,8 @@
"exit": true
},
"dependencies": {
"@connectrpc/connect": "1.1.2",
"@gitpod/public-api": "0.1.5",
Copy link
Member

Choose a reason for hiding this comment

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

Hm, this dependenciy feels a bit weird. What's the reason to not put the converter into the typescript lib exported by public-api? 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

You mean reverse dependency? I don't think public-api should pull gitpod-protocol.
We need some place where we share converter between dashboard and server.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, probably not the single package that we have there now that contains the connect types.
But maybe having a separate one next to it... not sure if it's worth it though. Also can't pinpoint why it feels weird to me. 🙃

private readonly apiConverter: PublicAPIConverter;

async getWorkspace(req: GetWorkspaceRequest, context: HandlerContext): Promise<GetWorkspaceResponse> {
const info = await this.workspaceService.getWorkspace(context.user.id, req.id);
Copy link
Member

Choose a reason for hiding this comment

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

Let's talk about context.user in the sync. IMO we should try to avoid this when implementing the new API. 👍

@geropl
Copy link
Member

geropl commented Oct 17, 2023

There is one glitch: When stopping a workspace the displayed status is stuck on "stopping", and never changes to "stopped" (consistently). Dashboard updates fine in parallel, as well as does this on reload.

@geropl
Copy link
Member

geropl commented Oct 17, 2023

Everything else works as expected! 🎉 Nice work @akosyakov ! 💪

@akosyakov
Copy link
Member Author

akosyakov commented Oct 17, 2023

/gh run recreate-vm=true

Comment triggered a workflow run

Started workflow run: 6552203451

  • recreate_vm: true

@akosyakov akosyakov force-pushed the ak/public_api_v2_get_workspace branch 2 times, most recently from 8a717a9 to ab9722a Compare October 17, 2023 20:36
@akosyakov akosyakov force-pushed the ak/public_api_v2_get_workspace branch from ab9722a to 211745a Compare October 17, 2023 20:53
@akosyakov
Copy link
Member Author

There is one glitch: When stopping a workspace the displayed status is stuck on "stopping", and never changes to "stopped" (consistently). Dashboard updates fine in parallel, as well as does this on reload.

@geropl I tried but I could not reproduce it.

@geropl
Copy link
Member

geropl commented Oct 18, 2023

/gh run recreate-vm=true

Comment triggered a workflow run

Started workflow run: 6558168925

  • recreate_vm: true

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.

@akosyakov It works now! 🎉

@akosyakov
Copy link
Member Author

/unhold

@roboquat roboquat merged commit c7f8c35 into main Oct 18, 2023
@roboquat roboquat deleted the ak/public_api_v2_get_workspace branch October 18, 2023 08:50
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.

4 participants