Skip to content

Commit f9961f9

Browse files
authored
Merge branch 'main' into jsjoeio-test-node
2 parents d8deb78 + e3e9f05 commit f9961f9

17 files changed

+68
-28
lines changed

ci/helm-chart/templates/deployment.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ spec:
2121
app.kubernetes.io/name: {{ include "code-server.name" . }}
2222
app.kubernetes.io/instance: {{ .Release.Name }}
2323
spec:
24+
imagePullSecrets: {{- toYaml .Values.imagePullSecrets | nindent 8 }}
2425
{{- if .Values.hostnameOverride }}
2526
hostname: {{ .Values.hostnameOverride }}
2627
{{- end }}

ci/helm-chart/values.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@ image:
99
tag: '4.0.2'
1010
pullPolicy: Always
1111

12+
# Specifies one or more secrets to be used when pulling images from a
13+
# private container repository
14+
# https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry
1215
imagePullSecrets: []
16+
# - name: registry-creds
17+
1318
nameOverride: ""
1419
fullnameOverride: ""
1520
hostnameOverride: ""

docs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# code-server
22

3-
[!["GitHub Discussions"](https://img.shields.io/badge/%20GitHub-%20Discussions-gray.svg?longCache=true&logo=github&colorB=purple)](https://github.com/coder/code-server/discussions) [!["Join us on Slack"](https://img.shields.io/badge/join-us%20on%20slack-gray.svg?longCache=true&logo=slack&colorB=brightgreen)](https://coder.co/join-community) [![Twitter Follow](https://img.shields.io/twitter/follow/CoderHQ?label=%40CoderHQ&style=social)](https://twitter.com/coderhq) [![codecov](https://codecov.io/gh/coder/code-server/branch/main/graph/badge.svg?token=5iM9farjnC)](https://codecov.io/gh/coder/code-server) [![See v4.0.2 docs](https://img.shields.io/static/v1?label=Docs&message=see%20v4.0.2%20&color=blue)](https://github.com/coder/code-server/tree/v4.0.2/docs)
3+
[!["GitHub Discussions"](https://img.shields.io/badge/%20GitHub-%20Discussions-gray.svg?longCache=true&logo=github&colorB=purple)](https://github.com/coder/code-server/discussions) [!["Join us on Slack"](https://img.shields.io/badge/join-us%20on%20slack-gray.svg?longCache=true&logo=slack&colorB=brightgreen)](https://coder.com/community) [![Twitter Follow](https://img.shields.io/twitter/follow/CoderHQ?label=%40CoderHQ&style=social)](https://twitter.com/coderhq) [![codecov](https://codecov.io/gh/coder/code-server/branch/main/graph/badge.svg?token=5iM9farjnC)](https://codecov.io/gh/coder/code-server) [![See v4.0.2 docs](https://img.shields.io/static/v1?label=Docs&message=see%20v4.0.2%20&color=blue)](https://github.com/coder/code-server/tree/v4.0.2/docs)
44

55
Run [VS Code](https://github.com/Microsoft/vscode) on any machine anywhere and
66
access it in the browser.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"release:github-draft": "./ci/build/release-github-draft.sh",
1818
"release:github-assets": "./ci/build/release-github-assets.sh",
1919
"release:prep": "./ci/build/release-prep.sh",
20-
"test:e2e": "./ci/dev/test-e2e.sh",
20+
"test:e2e": "VSCODE_IPC_HOOK_CLI= ./ci/dev/test-e2e.sh",
2121
"test:standalone-release": "./ci/build/test-standalone-release.sh",
2222
"test:unit": "./ci/dev/test-unit.sh --forceExit --detectOpenHandles",
2323
"test:scripts": "./ci/dev/test-scripts.sh",
@@ -78,8 +78,8 @@
7878
"vfile-message": "^2.0.2",
7979
"tar": "^6.1.9",
8080
"path-parse": "^1.0.7",
81-
"vm2": "^3.9.4",
82-
"follow-redirects": "^1.14.7",
81+
"vm2": "^3.9.6",
82+
"follow-redirects": "^1.14.8",
8383
"node-fetch": "^2.6.7",
8484
"nanoid": "^3.1.31"
8585
},

src/node/routes/vscode.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { logError } from "../../common/util"
55
import { toVsCodeArgs } from "../cli"
66
import { isDevMode } from "../constants"
77
import { authenticated, ensureAuthenticated, redirect, self } from "../http"
8+
import { SocketProxyProvider } from "../socket"
89
import { loadAMDModule } from "../util"
910
import { Router as WsRouter } from "../wsRouter"
1011
import { errorHandler } from "./errors"
@@ -13,6 +14,7 @@ export class CodeServerRouteWrapper {
1314
/** Assigned in `ensureCodeServerLoaded` */
1415
private _codeServerMain!: CodeServerLib.IServerAPI
1516
private _wsRouterWrapper = WsRouter()
17+
private _socketProxyProvider = new SocketProxyProvider()
1618
public router = express.Router()
1719

1820
public get wsRouter() {
@@ -77,9 +79,10 @@ export class CodeServerRouteWrapper {
7779
}
7880

7981
private $proxyWebsocket = async (req: WebsocketRequest) => {
80-
this._codeServerMain.handleUpgrade(req, req.socket)
82+
const wrappedSocket = await this._socketProxyProvider.createProxy(req.ws)
83+
this._codeServerMain.handleUpgrade(req, wrappedSocket)
8184

82-
req.socket.resume()
85+
req.ws.resume()
8386
}
8487

8588
//#endregion
@@ -130,5 +133,6 @@ export class CodeServerRouteWrapper {
130133

131134
dispose() {
132135
this._codeServerMain?.dispose()
136+
this._socketProxyProvider.stop()
133137
}
134138
}

test/e2e/baseFixture.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,15 @@ import { CodeServer, CodeServerPage } from "./models/CodeServer"
99
*
1010
* If `includeCredentials` is `true` page requests will be authenticated.
1111
*/
12-
export const describe = (name: string, includeCredentials: boolean, fn: (codeServer: CodeServer) => void) => {
12+
export const describe = (
13+
name: string,
14+
includeCredentials: boolean,
15+
codeServerArgs: string[],
16+
fn: (codeServer: CodeServer) => void,
17+
) => {
1318
test.describe(name, () => {
1419
// This will spawn on demand so nothing is necessary on before.
15-
const codeServer = new CodeServer(name)
20+
const codeServer = new CodeServer(name, codeServerArgs)
1621

1722
// Kill code-server after the suite has ended. This may happen even without
1823
// doing it explicitly but it seems prudent to be sure.
@@ -36,6 +41,9 @@ export const describe = (name: string, includeCredentials: boolean, fn: (codeSer
3641
authenticated: includeCredentials,
3742
// This provides a cookie that authenticates with code-server.
3843
storageState: includeCredentials ? storageState : {},
44+
// NOTE@jsjoeio some tests use --cert which uses a self-signed certificate
45+
// without this option, those tests will fail.
46+
ignoreHTTPSErrors: true,
3947
})
4048

4149
fn(codeServer)

test/e2e/codeServer.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { describe, test, expect } from "./baseFixture"
22

3-
describe("CodeServer", true, () => {
3+
describe("CodeServer", true, [], () => {
44
test("should navigate to home page", async ({ codeServerPage }) => {
55
// We navigate codeServer before each test
66
// and we start the test with a storage state

test/e2e/extensions.test.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
import { describe, test } from "./baseFixture"
22

3-
describe("Extensions", true, () => {
3+
function runTestExtensionTests() {
44
// This will only work if the test extension is loaded into code-server.
55
test("should have access to VSCODE_PROXY_URI", async ({ codeServerPage }) => {
66
const address = await codeServerPage.address()
77

88
await codeServerPage.executeCommandViaMenus("code-server: Get proxy URI")
99

10-
await codeServerPage.page.waitForSelector(`text=${address}/proxy/{port}`)
10+
await codeServerPage.page.waitForSelector(`text=${address}/proxy/{{port}}`)
1111
})
12+
}
13+
14+
describe("Extensions", true, [], () => {
15+
runTestExtensionTests()
16+
})
17+
18+
describe("Extensions with --cert", true, ["--cert"], () => {
19+
runTestExtensionTests()
1220
})

test/e2e/globalSetup.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { describe, test, expect } from "./baseFixture"
22

33
// This test is to make sure the globalSetup works as expected
44
// meaning globalSetup ran and stored the storageState
5-
describe("globalSetup", true, () => {
5+
describe("globalSetup", true, [], () => {
66
test("should keep us logged in using the storageState", async ({ codeServerPage }) => {
77
// Make sure the editor actually loaded
88
expect(await codeServerPage.isEditorVisible()).toBe(true)

test/e2e/login.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { PASSWORD } from "../utils/constants"
22
import { describe, test, expect } from "./baseFixture"
33

4-
describe("login", false, () => {
4+
describe("login", false, [], () => {
55
test("should see the login page", async ({ codeServerPage }) => {
66
// It should send us to the login page
77
expect(await codeServerPage.page.title()).toBe("code-server login")

0 commit comments

Comments
 (0)