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

+1
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

+5
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

+1-1
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

+3-3
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

+6-2
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

+10-2
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

+1-1
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

+10-2
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

+1-1
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

+1-1
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")

test/e2e/logout.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// NOTE@jsjoeio commenting out until we can figure out what's wrong
22
// import { describe, test, expect } from "./baseFixture"
33

4-
// describe("logout", true, () => {
4+
// describe("logout", true, [], () => {
55
// test("should be able logout", async ({ codeServerPage }) => {
66
// // Recommended by Playwright for async navigation
77
// // https://github.com/microsoft/playwright/issues/1987#issuecomment-620182151

test/e2e/models/CodeServer.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export class CodeServer {
3131
public readonly logger: Logger
3232
private closed = false
3333

34-
constructor(name: string) {
34+
constructor(name: string, private readonly codeServerArgs: string[]) {
3535
this.logger = logger.named(name)
3636
}
3737

@@ -78,6 +78,7 @@ export class CodeServer {
7878
"node",
7979
[
8080
process.env.CODE_SERVER_TEST_ENTRY || ".",
81+
...this.codeServerArgs,
8182
// Using port zero will spawn on a random port.
8283
"--bind-addr",
8384
"127.0.0.1:0",

test/e2e/openHelpAbout.test.ts

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

3-
describe("Open Help > About", true, () => {
3+
describe("Open Help > About", true, [], () => {
44
test("should see code-server version in about dialog", async ({ codeServerPage }) => {
55
// Open using the menu.
66
await codeServerPage.navigateMenus(["Help", "About"])

test/e2e/terminal.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import util from "util"
44
import { clean, tmpdir } from "../utils/helpers"
55
import { describe, expect, test } from "./baseFixture"
66

7-
describe("Integrated Terminal", true, () => {
7+
describe("Integrated Terminal", true, [], () => {
88
const testName = "integrated-terminal"
99
test.beforeAll(async () => {
1010
await clean(testName)

vendor/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
"postinstall": "./postinstall.sh"
88
},
99
"devDependencies": {
10-
"code-oss-dev": "coder/vscode#d4f09b4df0d23ead4389b4a69c6fad86ac358892"
10+
"code-oss-dev": "coder/vscode#96e241330d9c44b64897c1e5031e00aa894103db"
1111
}
1212
}

vendor/yarn.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,9 @@ clone-response@^1.0.2:
274274
dependencies:
275275
mimic-response "^1.0.0"
276276

277-
code-oss-dev@coder/vscode#d4f09b4df0d23ead4389b4a69c6fad86ac358892:
277+
code-oss-dev@coder/vscode#96e241330d9c44b64897c1e5031e00aa894103db:
278278
version "1.63.0"
279-
resolved "https://codeload.github.com/coder/vscode/tar.gz/d4f09b4df0d23ead4389b4a69c6fad86ac358892"
279+
resolved "https://codeload.github.com/coder/vscode/tar.gz/96e241330d9c44b64897c1e5031e00aa894103db"
280280
dependencies:
281281
"@microsoft/applicationinsights-web" "^2.6.4"
282282
"@parcel/watcher" "2.0.3"

yarn.lock

+21-8
Original file line numberDiff line numberDiff line change
@@ -603,11 +603,21 @@ acorn-jsx@^5.3.1:
603603
resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.1.tgz#fc8661e11b7ac1539c47dbfea2e72b3af34d267b"
604604
integrity sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng==
605605

606+
acorn-walk@^8.2.0:
607+
version "8.2.0"
608+
resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.2.0.tgz#741210f2e2426454508853a2f44d0ab83b7f69c1"
609+
integrity sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==
610+
606611
acorn@^7.4.0:
607612
version "7.4.1"
608613
resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa"
609614
integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==
610615

616+
acorn@^8.7.0:
617+
version "8.7.0"
618+
resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.7.0.tgz#90951fde0f8f09df93549481e5fc141445b791cf"
619+
integrity sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==
620+
611621
agent-base@6, agent-base@^6.0.0, agent-base@^6.0.2:
612622
version "6.0.2"
613623
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.2.tgz#49fff58577cfee3f37176feab4c22e00f86d7f77"
@@ -1879,10 +1889,10 @@ flatted@^3.1.0:
18791889
resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.1.1.tgz#c4b489e80096d9df1dfc97c79871aea7c617c469"
18801890
integrity sha512-zAoAQiudy+r5SvnSw3KJy5os/oRJYHzrzja/tBDqrZtNhUw8bt6y8OBzMWcjWr+8liV8Eb6yOhw8WZ7VFZ5ZzA==
18811891

1882-
follow-redirects@^1.0.0, follow-redirects@^1.14.7:
1883-
version "1.14.7"
1884-
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.7.tgz#2004c02eb9436eee9a21446a6477debf17e81685"
1885-
integrity sha512-+hbxoLbFMbRKDwohX8GkTataGqO6Jb7jGwpAlwgy2bIz25XtRm7KEzJM76R1WiNT5SwZkX4Y75SwBolkpmE7iQ==
1892+
follow-redirects@^1.0.0, follow-redirects@^1.14.8:
1893+
version "1.14.8"
1894+
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.8.tgz#016996fb9a11a100566398b1c6839337d7bfa8fc"
1895+
integrity sha512-1x0S9UVJHsQprFcEC/qnNzBLcIxsjAV905f/UkQxbclCsoTWlacCNOpQa/anodLl2uaEKFhfWOvM2Qg77+15zA==
18861896

18871897
format@^0.2.0:
18881898
version "0.2.2"
@@ -4529,10 +4539,13 @@ vfile@^4.0.0:
45294539
unist-util-stringify-position "^2.0.0"
45304540
vfile-message "^2.0.0"
45314541

4532-
vm2@^3.9.3, vm2@^3.9.4:
4533-
version "3.9.5"
4534-
resolved "https://registry.yarnpkg.com/vm2/-/vm2-3.9.5.tgz#5288044860b4bbace443101fcd3bddb2a0aa2496"
4535-
integrity sha512-LuCAHZN75H9tdrAiLFf030oW7nJV5xwNMuk1ymOZwopmuK3d2H4L1Kv4+GFHgarKiLfXXLFU+7LDABHnwOkWng==
4542+
vm2@^3.9.3, vm2@^3.9.6:
4543+
version "3.9.7"
4544+
resolved "https://registry.yarnpkg.com/vm2/-/vm2-3.9.7.tgz#bb87aa677c97c61e23a6cb6547e44e990517a6f6"
4545+
integrity sha512-g/GZ7V0Mlmch3eDVOATvAXr1GsJNg6kQ5PjvYy3HbJMCRn5slNbo/u73Uy7r5yUej1cRa3ZjtoVwcWSQuQ/fow==
4546+
dependencies:
4547+
acorn "^8.7.0"
4548+
acorn-walk "^8.2.0"
45364549

45374550
webidl-conversions@^3.0.0:
45384551
version "3.0.1"

0 commit comments

Comments
 (0)