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

[code] serve each webview from own origin #4738

Merged
merged 1 commit into from
Jul 16, 2021

Conversation

akosyakov
Copy link
Member

@akosyakov akosyakov commented Jul 8, 2021

What it does

  • fix [code] serve each webview from own origin #4529 by moving workpsace ID from foreign content URL origin to URL path. It allows to give each extension host and webview an unique origin at the same time enabling ws-proxy to route properly

Change in Gitpod Code: gitpod-io/openvscode-server@6cf68ce

How to test

  • Start a workspace.
  • Open the extensions view, try to preview GitLens extenison, content should be displayed.
  • Then install GitLens extension, you should see Welcome page from this extension.
  • Install VIM extension. It should be properly activated. Maybe you need to reload, but you should not see anything like failed to activate notifications.
  • After that open devtools and inspect what kind of origins you have. It should be something like that:

Screenshot 2021-07-08 at 13 06 05

Bonus: start a workspace for github.com/gitpod-io/vscode, wait for the build and then check everything in dev version

@akosyakov akosyakov changed the title [code] fix #4529: serve each webview from own origin [code] serve each webview from own origin Jul 8, 2021
@akosyakov akosyakov force-pushed the akosyakov/code-serve-each-webview-4529 branch from 913ffc9 to c8b3074 Compare July 8, 2021 08:17
@codecov
Copy link

codecov bot commented Jul 8, 2021

Codecov Report

Merging #4738 (74e60f0) into main (c060c81) will increase coverage by 36.78%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##           main    #4738       +/-   ##
=========================================
+ Coverage      0   36.78%   +36.78%     
=========================================
  Files         0       13       +13     
  Lines         0     3670     +3670     
=========================================
+ Hits          0     1350     +1350     
- Misses        0     2204     +2204     
- Partials      0      116      +116     
Flag Coverage Δ
components-ws-manager-app 36.78% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
components/ws-manager/pkg/manager/config.go 32.50% <ø> (ø)
components/ws-manager/pkg/manager/create.go 79.05% <100.00%> (ø)
components/ws-manager/pkg/manager/monitor.go 0.00% <0.00%> (ø)
...s/ws-manager/pkg/manager/internal/grpcpool/pool.go 74.46% <0.00%> (ø)
...omponents/ws-manager/pkg/manager/pod_controller.go 0.00% <0.00%> (ø)
components/ws-manager/pkg/manager/metrics.go 11.26% <0.00%> (ø)
components/ws-manager/pkg/manager/imagespec.go 0.00% <0.00%> (ø)
components/ws-manager/pkg/manager/probe.go 0.00% <0.00%> (ø)
components/ws-manager/pkg/manager/status.go 70.84% <0.00%> (ø)
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c060c81...74e60f0. Read the comment docs.

@akosyakov akosyakov marked this pull request as ready for review July 8, 2021 08:46
@akosyakov akosyakov requested review from a team, AlexTugarev and csweichel and removed request for a team July 8, 2021 08:46
@csweichel
Copy link
Contributor

For the review I'd greatly benefit from a joint walkthrough. Would you have some time tomorrow?

@akosyakov akosyakov force-pushed the akosyakov/code-serve-each-webview-4529 branch 3 times, most recently from 39b867c to ae57f7d Compare July 13, 2021 04:18
@akosyakov akosyakov requested a review from fntlnz July 13, 2021 06:18
@akosyakov akosyakov force-pushed the akosyakov/code-serve-each-webview-4529 branch from ae57f7d to ec8c304 Compare July 15, 2021 03:36
@akosyakov akosyakov requested a review from geropl July 15, 2021 08:03
@geropl
Copy link
Member

geropl commented Jul 15, 2021

Starting to review now

@geropl
Copy link
Member

geropl commented Jul 15, 2021

/werft run

👍 started the job as gitpod-build-akosyakov-code-serve-each-webview-4529.16

@geropl
Copy link
Member

geropl commented Jul 15, 2021

@akosyakov Awesome change, really cool to see this "hack" resolved with a proper solution! 🚀 Plus the loom video really nails it: so much easier to grok the context and scope. I left a few comments, exclusively requests for more comments so my future me still knows what ws-proxy does 🙃

@akosyakov akosyakov force-pushed the akosyakov/code-serve-each-webview-4529 branch from ec8c304 to 71a5d39 Compare July 15, 2021 10:06
@akosyakov
Copy link
Member Author

akosyakov commented Jul 15, 2021

@geropl I refactored a bit and added comments with examples. Does it look good like that?

I'm going to add wsHost attribute to supervisor info endpoint also, but tomorrow. To replace parsing here: gitpod-io/openvscode-server@cd2128e#diff-b68e95d8ebaec9fc38aad38c3df9f68d2951bc577b3de330bf552bcafa7f1d34R277-R278

@akosyakov akosyakov force-pushed the akosyakov/code-serve-each-webview-4529 branch from 71a5d39 to f9006f3 Compare July 15, 2021 10:08
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.

Awesome! Tested and works as advertised.

@akosyakov akosyakov force-pushed the akosyakov/code-serve-each-webview-4529 branch from f9006f3 to ca7c3e2 Compare July 16, 2021 02:22
@roboquat
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: akosyakov, geropl

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@akosyakov
Copy link
Member Author

@csweichel I added workspace_cluster_host to the supervisor info endpoint to avoid parsing it from URL location. Could you have a look please? I thought to name it workspace_host but i think it will be confusing, i would think it is coral-duck-93mwvmd2.ws-us11.gitpod.io not ws-us11.gitpod.io

@akosyakov akosyakov marked this pull request as ready for review July 16, 2021 03:19
@csweichel
Copy link
Contributor

/lgtm

decoupled from workpace origin (also extension host origin)
@akosyakov akosyakov force-pushed the akosyakov/code-serve-each-webview-4529 branch from 7d0e10b to 74e60f0 Compare July 16, 2021 08:08
@roboquat roboquat removed the lgtm label Jul 16, 2021
@roboquat
Copy link
Contributor

New changes are detected. LGTM label has been removed.

@akosyakov akosyakov merged commit ed076d7 into main Jul 16, 2021
@akosyakov akosyakov deleted the akosyakov/code-serve-each-webview-4529 branch July 16, 2021 09:08
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.

[code] serve each webview from own origin
4 participants