Compare commits

...

16 Commits
3.0.0 ... 3.0.2

Author SHA1 Message Date
Asher
e480f6527e Update VS Code to 1.43.2 2020-04-01 15:27:28 -05:00
Asher
26584f2060 Strip protocol from remote authority
In Google cloud shell the host header is 127.0.0.1:8080 instead of the
actual URL. This is what we write out to the HTML so VS Code can pick it
up. However cloud shell rewrites this string when found in the HTML
before serving it so it becomes https://8080-[...].appspot.com,
resulting in an extra unexpected https:// in the
URI (vscode-remote://https://8080[...]). The resulting malformed URI
causes the extension host to exit.

- Fixes #1471
- Fixes #1468
- Fixes #1440 (most likely).
2020-04-01 13:41:05 -05:00
Asher
a4c0fd1fdc Run ssh server listen after http
That way if they happen to conflict code-server doesn't crash.
2020-03-30 17:43:11 -05:00
Asher
6c104c016e Prevent exiting when an exception is uncaught 2020-03-30 17:43:10 -05:00
Asher
599670136d Output commit along with the version 2020-03-30 17:43:09 -05:00
Asher
ce637d318d Add descriptions to SSH flags 2020-03-30 17:43:08 -05:00
Anmol Sethi
d8654b5a19 Merge pull request #1460 from mjgallag/peg-yarn-version
Peg yarn version to ensure deterministic builds
2020-03-30 01:52:14 -04:00
Michael Gallagher
12c3ccd6c7 Peg yarn version to ensure deterministic builds
"Yarn is fully deterministic as long as all your teammates are using the same Yarn version." (https://classic.yarnpkg.com/blog/2017/05/31/determinism/)
2020-03-28 14:29:04 -07:00
Asher
7954656610 Set background color using VS Code theme 2020-03-27 16:58:50 -05:00
Asher
87ebf03eb7 Skip vscode dependencies for test phase
They aren't used so we can skip them.
2020-03-27 13:40:42 -05:00
Asher
df1c34e291 Overwrite GitHub releases again
I was under the impression this was causing existing releases to become
drafts again but that happens without this flag.
2020-03-27 12:03:01 -05:00
Asher
4a65b58772 Fix arm builds 2020-03-27 12:02:56 -05:00
Asher
11fdb8854b Skip unused dependencies 2020-03-26 15:12:17 -05:00
Asher
0a92bb1607 Fix node version mismatch 2020-03-26 13:54:41 -05:00
Asher
5bac2cbdb8 Add build test 2020-03-26 13:54:40 -05:00
Asher
511c3e95b2 Remove npm rebuild 2020-03-25 17:07:26 -05:00
13 changed files with 232 additions and 118 deletions

View File

@@ -4,17 +4,17 @@ jobs:
include: include:
- name: Test - name: Test
if: tag IS blank if: tag IS blank
script: ./ci/image/run.sh "yarn && GITHUB_TOKEN=3229b0eec0a1622d6d1d1e00fca5b626070f5a10 yarn vscode && ./ci/ci.sh" script: ./ci/image/run.sh "yarn && git submodule update --init && yarn vscode:patch && ./ci/ci.sh"
deploy: null deploy: null
- name: Linux Release - name: Linux Release
if: tag IS present if: tag IS present
script: script:
- travis_wait 60 ./ci/image/run.sh "yarn && yarn vscode && ci/release.sh" - travis_wait 60 ./ci/image/run.sh "yarn && yarn vscode && ci/release.sh && ./ci/build-test.sh"
- ./ci/release-image/push.sh - ./ci/release-image/push.sh
- name: Linux ARM64 Release - name: Linux ARM64 Release
if: tag IS present if: tag IS present
script: script:
- ./ci/image/run.sh "yarn && yarn vscode && ci/release.sh" - ./ci/image/run.sh "yarn && yarn vscode && ci/release.sh && ./ci/build-test.sh"
- ./ci/release-image/push.sh - ./ci/release-image/push.sh
arch: arm64 arch: arm64
- name: MacOS Release - name: MacOS Release
@@ -22,7 +22,7 @@ jobs:
os: osx os: osx
language: node_js language: node_js
node_js: 12 node_js: 12
script: yarn && yarn vscode && travis_wait 60 ci/release.sh script: yarn && yarn vscode && travis_wait 60 ci/release.sh && ./ci/build-test.sh
before_deploy: before_deploy:
- echo "$JSON_KEY" | base64 --decode > ./ci/key.json - echo "$JSON_KEY" | base64 --decode > ./ci/key.json
@@ -31,6 +31,7 @@ deploy:
- provider: releases - provider: releases
edge: true edge: true
draft: true draft: true
overwrite: true
tag_name: $TRAVIS_TAG tag_name: $TRAVIS_TAG
target_commitish: $TRAVIS_COMMIT target_commitish: $TRAVIS_COMMIT
name: $TRAVIS_TAG name: $TRAVIS_TAG
@@ -47,6 +48,8 @@ deploy:
local_dir: release-upload local_dir: release-upload
on: on:
tags: true tags: true
# TODO: The gcs provider fails to install on arm64.
condition: $TRAVIS_CPU_ARCH = amd64
cache: cache:
timeout: 600 timeout: 600

21
ci/build-test.sh Executable file
View File

@@ -0,0 +1,21 @@
#!/usr/bin/env bash
# build-test.bash -- Make sure the build worked.
# This is to make sure we don't have Node version errors or any other
# compilation-related errors.
set -euo pipefail
function main() {
cd "$(dirname "${0}")/.." || exit 1
local output
output=$(node ./build/out/node/entry.js --list-extensions 2>&1)
if echo "$output" | grep 'was compiled against a different Node.js version'; then
echo "$output"
exit 1
else
echo "Build ran successfully"
fi
}
main "$@"

View File

@@ -15,7 +15,7 @@ RUN yum update -y && yum install -y \
RUN mkdir /usr/share/node && cd /usr/share/node \ RUN mkdir /usr/share/node && cd /usr/share/node \
&& curl "https://nodejs.org/dist/v12.14.0/node-v12.14.0-linux-$(uname -m | sed 's/86_//; s/aarch/arm/').tar.xz" | tar xJ --strip-components=1 -- && curl "https://nodejs.org/dist/v12.14.0/node-v12.14.0-linux-$(uname -m | sed 's/86_//; s/aarch/arm/').tar.xz" | tar xJ --strip-components=1 --
ENV PATH "$PATH:/usr/share/node/bin" ENV PATH "$PATH:/usr/share/node/bin"
RUN npm install -g yarn RUN npm install -g yarn@1.22.4
RUN curl -L "https://github.com/mvdan/sh/releases/download/v3.0.1/shfmt_v3.0.1_linux_$(uname -m | sed 's/x86_/amd/; s/aarch64/arm/')" > /usr/local/bin/shfmt \ RUN curl -L "https://github.com/mvdan/sh/releases/download/v3.0.1/shfmt_v3.0.1_linux_$(uname -m | sed 's/x86_/amd/; s/aarch64/arm/')" > /usr/local/bin/shfmt \
&& chmod +x /usr/local/bin/shfmt && chmod +x /usr/local/bin/shfmt

View File

@@ -5,9 +5,22 @@ set -euo pipefail
main() { main() {
cd "$(dirname "$0")/../.." cd "$(dirname "$0")/../.."
# This, strangely enough, fixes the arm build being terminated for not having
# output on Travis. It's as if output is buffered and only displayed once a
# certain amount is collected. Five seconds didn't work but one second seems
# to generate enough output to make it work.
local pid
while true; do
echo 'Still running...'
sleep 1
done &
pid=$!
docker build ci/image docker build ci/image
imageTag="$(docker build -q ci/image)" imageTag="$(docker build -q ci/image)"
docker run -t --rm -e CI -e GITHUB_TOKEN -e TRAVIS_TAG -v "$(yarn cache dir):/usr/local/share/.cache/yarn/v6" -v "$PWD:/repo" -w /repo "$imageTag" "$*" docker run -t --rm -e CI -e GITHUB_TOKEN -e TRAVIS_TAG -v "$(yarn cache dir):/usr/local/share/.cache/yarn/v6" -v "$PWD:/repo" -w /repo "$imageTag" "$*"
kill $pid
} }
main "$@" main "$@"

View File

@@ -17,7 +17,7 @@ function package() {
fi fi
local arch local arch
arch="$(uname -m)" arch=$(uname -m | sed 's/aarch/arm/')
echo -n "Creating release..." echo -n "Creating release..."

View File

@@ -10,6 +10,44 @@ index e73dd4d9e8..e3192b3a0d 100644
resources/server resources/server
build/node_modules build/node_modules
coverage/ coverage/
diff --git a/.yarnrc b/.yarnrc
index 7808166004..1e16cde724 100644
--- a/.yarnrc
+++ b/.yarnrc
@@ -1,3 +1,3 @@
-disturl "https://atom.io/download/electron"
-target "7.1.11"
-runtime "electron"
+disturl "http://nodejs.org/dist"
+target "12.4.0"
+runtime "node"
diff --git a/build/npm/postinstall.js b/build/npm/postinstall.js
index 7a2320d828..5768890636 100644
--- a/build/npm/postinstall.js
+++ b/build/npm/postinstall.js
@@ -33,9 +33,9 @@ function yarnInstall(location, opts) {
yarnInstall('extensions'); // node modules shared by all extensions
-yarnInstall('remote'); // node modules used by vscode server
+// yarnInstall('remote'); // node modules used by vscode server
-yarnInstall('remote/web'); // node modules used by vscode web
+// yarnInstall('remote/web'); // node modules used by vscode web
const allExtensionFolders = fs.readdirSync('extensions');
const extensions = allExtensionFolders.filter(e => {
@@ -68,7 +68,7 @@ runtime "${runtime}"`;
}
yarnInstall(`build`); // node modules required for build
-yarnInstall('test/automation'); // node modules required for smoketest
-yarnInstall('test/smoke'); // node modules required for smoketest
-yarnInstall('test/integration/browser'); // node modules required for integration
+// yarnInstall('test/automation'); // node modules required for smoketest
+// yarnInstall('test/smoke'); // node modules required for smoketest
+// yarnInstall('test/integration/browser'); // node modules required for integration
yarnInstallBuildDependencies(); // node modules for watching, specific to host node version, not electron
diff --git a/coder.js b/coder.js diff --git a/coder.js b/coder.js
new file mode 100644 new file mode 100644
index 0000000000..6aee0e46bc index 0000000000..6aee0e46bc
@@ -119,7 +157,7 @@ index 2d8b725ff2..a8d93a17ca 100644
unique-stream@^2.0.2: unique-stream@^2.0.2:
version "2.2.1" version "2.2.1"
diff --git a/package.json b/package.json diff --git a/package.json b/package.json
index 6e9b9dc0a0..49b14e536a 100644 index 29d3cb6677..d3788cb1ab 100644
--- a/package.json --- a/package.json
+++ b/package.json +++ b/package.json
@@ -33,6 +33,9 @@ @@ -33,6 +33,9 @@
@@ -210,7 +248,7 @@ index 2c64061da7..c0ef8faedd 100644
// Do nothing. If we can't read the file we have no // Do nothing. If we can't read the file we have no
// language pack config. // language pack config.
diff --git a/src/vs/code/browser/workbench/workbench.ts b/src/vs/code/browser/workbench/workbench.ts diff --git a/src/vs/code/browser/workbench/workbench.ts b/src/vs/code/browser/workbench/workbench.ts
index 45f6f17ce0..79fde0b92c 100644 index 45f6f17ce0..4d1a590a7c 100644
--- a/src/vs/code/browser/workbench/workbench.ts --- a/src/vs/code/browser/workbench/workbench.ts
+++ b/src/vs/code/browser/workbench/workbench.ts +++ b/src/vs/code/browser/workbench/workbench.ts
@@ -246,12 +246,18 @@ class WorkspaceProvider implements IWorkspaceProvider { @@ -246,12 +246,18 @@ class WorkspaceProvider implements IWorkspaceProvider {
@@ -234,7 +272,26 @@ index 45f6f17ce0..79fde0b92c 100644
} }
// Append payload if any // Append payload if any
@@ -302,35 +308,6 @@ class WorkspaceProvider implements IWorkspaceProvider { @@ -290,6 +296,18 @@ class WorkspaceProvider implements IWorkspaceProvider {
const config: IWorkbenchConstructionOptions & { folderUri?: UriComponents, workspaceUri?: UriComponents } = JSON.parse(configElementAttribute);
+ // Strip the protocol from the authority if it exists.
+ const normalizeAuthority = (authority: string): string => authority.replace(/^https?:\/\//, "");
+ if (config.remoteAuthority) {
+ (config as any).remoteAuthority = normalizeAuthority(config.remoteAuthority);
+ }
+ if (config.workspaceUri) {
+ config.workspaceUri.authority = normalizeAuthority(config.workspaceUri.authority);
+ }
+ if (config.folderUri) {
+ config.folderUri.authority = normalizeAuthority(config.folderUri.authority);
+ }
+
// Revive static extension locations
if (Array.isArray(config.staticExtensions)) {
config.staticExtensions.forEach(extension => {
@@ -302,35 +320,6 @@ class WorkspaceProvider implements IWorkspaceProvider {
let workspace: IWorkspace; let workspace: IWorkspace;
let payload = Object.create(null); let payload = Object.create(null);
@@ -455,10 +512,10 @@ index eab8591492..26668701f7 100644
options.logService.error(`${logPrefix} socketFactory.connect() failed. Error:`); options.logService.error(`${logPrefix} socketFactory.connect() failed. Error:`);
diff --git a/src/vs/server/browser/client.ts b/src/vs/server/browser/client.ts diff --git a/src/vs/server/browser/client.ts b/src/vs/server/browser/client.ts
new file mode 100644 new file mode 100644
index 0000000000..4042e32f74 index 0000000000..96fbd4b0bb
--- /dev/null --- /dev/null
+++ b/src/vs/server/browser/client.ts +++ b/src/vs/server/browser/client.ts
@@ -0,0 +1,263 @@ @@ -0,0 +1,270 @@
+import { Emitter } from 'vs/base/common/event'; +import { Emitter } from 'vs/base/common/event';
+import { URI } from 'vs/base/common/uri'; +import { URI } from 'vs/base/common/uri';
+import { localize } from 'vs/nls'; +import { localize } from 'vs/nls';
@@ -477,6 +534,7 @@ index 0000000000..4042e32f74
+import { LocalizationsService } from 'vs/workbench/services/localizations/electron-browser/localizationsService'; +import { LocalizationsService } from 'vs/workbench/services/localizations/electron-browser/localizationsService';
+import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService'; +import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
+import { Options } from 'vs/server/ipc.d'; +import { Options } from 'vs/server/ipc.d';
+import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
+ +
+class TelemetryService extends TelemetryChannelClient { +class TelemetryService extends TelemetryChannelClient {
+ public constructor( + public constructor(
@@ -687,6 +745,12 @@ index 0000000000..4042e32f74
+ }; + };
+ +
+ updateLoop(); + updateLoop();
+
+ // This will be used to set the background color while VS Code loads.
+ const theme = (services.get(IStorageService) as IStorageService).get("colorThemeData", StorageScope.GLOBAL);
+ if (theme) {
+ localStorage.setItem("colorThemeData", theme);
+ }
+}; +};
+ +
+export interface Query { +export interface Query {

View File

@@ -16,9 +16,6 @@ main() {
cd lib/vscode cd lib/vscode
# Install VS Code dependencies. # Install VS Code dependencies.
yarn yarn
# NODE_MODULE_VERSION mismatch errors without this.
npm rebuild
) )
} }

View File

@@ -1,7 +1,7 @@
{ {
"name": "code-server", "name": "code-server",
"license": "MIT", "license": "MIT",
"version": "3.0.1", "version": "3.0.2",
"scripts": { "scripts": {
"clean": "ci/clean.sh", "clean": "ci/clean.sh",
"vscode": "ci/vscode.sh", "vscode": "ci/vscode.sh",

View File

@@ -100,4 +100,11 @@
<script> <script>
require(["vs/code/browser/workbench/workbench"], function() {}) require(["vs/code/browser/workbench/workbench"], function() {})
</script> </script>
<script>
try {
document.body.style.background = JSON.parse(localStorage.getItem("colorThemeData")).colorMap["editor.background"]
} catch (error) {
// Oh well.
}
</script>
</html> </html>

View File

@@ -98,8 +98,8 @@ const options: Options<Required<Args>> = {
version: { type: "boolean", short: "v", description: "Display version information." }, version: { type: "boolean", short: "v", description: "Display version information." },
_: { type: "string[]" }, _: { type: "string[]" },
"disable-ssh": { type: "boolean" }, "disable-ssh": { type: "boolean", description: "Disable the SSH server." },
"ssh-host-key": { type: "string", path: true }, "ssh-host-key": { type: "string", path: true, description: "SSH server host key." },
"user-data-dir": { type: "string", path: true, description: "Path to the user data directory." }, "user-data-dir": { type: "string", path: true, description: "Path to the user data directory." },
"extensions-dir": { type: "string", path: true, description: "Path to the extensions directory." }, "extensions-dir": { type: "string", path: true, description: "Path to the extensions directory." },

View File

@@ -14,24 +14,34 @@ import { SshProvider } from "./ssh/server"
import { generateCertificate, generatePassword, generateSshHostKey, hash, open } from "./util" import { generateCertificate, generatePassword, generateSshHostKey, hash, open } from "./util"
import { ipcMain, wrap } from "./wrapper" import { ipcMain, wrap } from "./wrapper"
process.on("uncaughtException", (error) => {
logger.error(`Uncaught exception: ${error.message}`)
if (typeof error.stack !== "undefined") {
logger.error(error.stack)
}
})
let pkg: { version?: string; commit?: string } = {}
try {
pkg = require("../../package.json")
} catch (error) {
logger.warn(error.message)
}
const version = pkg.version || "development"
const commit = pkg.commit || "development"
const main = async (args: Args): Promise<void> => { const main = async (args: Args): Promise<void> => {
const auth = args.auth || AuthType.Password const auth = args.auth || AuthType.Password
const originalPassword = auth === AuthType.Password && (process.env.PASSWORD || (await generatePassword())) const originalPassword = auth === AuthType.Password && (process.env.PASSWORD || (await generatePassword()))
let commit: string | undefined
try {
commit = require("../../package.json").commit
} catch (error) {
logger.warn(error.message)
}
// Spawn the main HTTP server. // Spawn the main HTTP server.
const options = { const options = {
auth, auth,
cert: args.cert ? args.cert.value : undefined, cert: args.cert ? args.cert.value : undefined,
certKey: args["cert-key"], certKey: args["cert-key"],
sshHostKey: args["ssh-host-key"], sshHostKey: args["ssh-host-key"],
commit: commit || "development", commit,
host: args.host || (args.auth === AuthType.Password && typeof args.cert !== "undefined" ? "0.0.0.0" : "localhost"), host: args.host || (args.auth === AuthType.Password && typeof args.cert !== "undefined" ? "0.0.0.0" : "localhost"),
password: originalPassword ? hash(originalPassword) : undefined, password: originalPassword ? hash(originalPassword) : undefined,
port: typeof args.port !== "undefined" ? args.port : process.env.PORT ? parseInt(process.env.PORT, 10) : 8080, port: typeof args.port !== "undefined" ? args.port : process.env.PORT ? parseInt(process.env.PORT, 10) : 8080,
@@ -68,20 +78,9 @@ const main = async (args: Args): Promise<void> => {
ipcMain().onDispose(() => httpServer.dispose()) ipcMain().onDispose(() => httpServer.dispose())
logger.info(`code-server ${require("../../package.json").version}`) logger.info(`code-server ${version} ${commit}`)
let sshPort = ""
if (!args["disable-ssh"] && options.sshHostKey) {
const sshProvider = httpServer.registerHttpProvider("/ssh", SshProvider, options.sshHostKey as string)
try {
sshPort = await sshProvider.listen()
} catch (error) {
logger.warn(`SSH server: ${error.message}`)
}
}
const serverAddress = await httpServer.listen() const serverAddress = await httpServer.listen()
logger.info(`Server listening on ${serverAddress}`) logger.info(`HTTP server listening on ${serverAddress}`)
if (auth === AuthType.Password && !process.env.PASSWORD) { if (auth === AuthType.Password && !process.env.PASSWORD) {
logger.info(` - Password is ${originalPassword}`) logger.info(` - Password is ${originalPassword}`)
@@ -105,19 +104,29 @@ const main = async (args: Args): Promise<void> => {
logger.info(" - Not serving HTTPS") logger.info(" - Not serving HTTPS")
} }
logger.info(` - Automatic updates are ${update.enabled ? "enabled" : "disabled"}`) logger.info(`Automatic updates are ${update.enabled ? "enabled" : "disabled"}`)
if (sshPort) { let sshPort: number | undefined
logger.info(` - SSH Server - Listening :${sshPort}`) if (!args["disable-ssh"] && options.sshHostKey) {
const sshProvider = httpServer.registerHttpProvider("/ssh", SshProvider, options.sshHostKey as string)
try {
sshPort = await sshProvider.listen()
} catch (error) {
logger.warn(`SSH server: ${error.message}`)
}
}
if (typeof sshPort !== "undefined") {
logger.info(`SSH server listening on localhost:${sshPort}`)
} else { } else {
logger.info(" - SSH Server - Disabled") logger.info("SSH server disabled")
} }
if (serverAddress && !options.socket && args.open) { if (serverAddress && !options.socket && args.open) {
// The web socket doesn't seem to work if browsing with 0.0.0.0. // The web socket doesn't seem to work if browsing with 0.0.0.0.
const openAddress = serverAddress.replace(/:\/\/0.0.0.0/, "://localhost") const openAddress = serverAddress.replace(/:\/\/0.0.0.0/, "://localhost")
await open(openAddress).catch(console.error) await open(openAddress).catch(console.error)
logger.info(` - Opened ${openAddress}`) logger.info(`Opened ${openAddress}`)
} }
} }
@@ -132,7 +141,7 @@ const tryParse = (): Args => {
const args = tryParse() const args = tryParse()
if (args.help) { if (args.help) {
console.log("code-server", require("../../package.json").version) console.log("code-server", version, commit)
console.log("") console.log("")
console.log(`Usage: code-server [options] [path]`) console.log(`Usage: code-server [options] [path]`)
console.log("") console.log("")
@@ -141,14 +150,14 @@ if (args.help) {
console.log("", description) console.log("", description)
}) })
} else if (args.version) { } else if (args.version) {
const version = require("../../package.json").version
if (args.json) { if (args.json) {
console.log({ console.log({
codeServer: version, codeServer: version,
commit,
vscode: require("../../lib/vscode/package.json").version, vscode: require("../../lib/vscode/package.json").version,
}) })
} else { } else {
console.log(version) console.log(version, commit)
} }
process.exit(0) process.exit(0)
} else if (args["list-extensions"] || args["install-extension"] || args["uninstall-extension"]) { } else if (args["list-extensions"] || args["install-extension"] || args["uninstall-extension"]) {

View File

@@ -24,11 +24,11 @@ export class SshProvider extends HttpProvider {
}) })
} }
public async listen(): Promise<string> { public async listen(): Promise<number> {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this.sshServer.once("error", reject) this.sshServer.once("error", reject)
this.sshServer.listen(() => { this.sshServer.listen(() => {
resolve(this.sshServer.address().port.toString()) resolve(this.sshServer.address().port)
}) })
}) })
} }