Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 7c27b02

Browse files
authoredAug 8, 2022
Merge branch 'main' into feature/k8s-lifecycle-hook
2 parents 9dfaf26 + 9087e0c commit 7c27b02

23 files changed

+209
-106
lines changed
 

‎.github/workflows/ci.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
node-version: "16"
4040

4141
- name: Install helm
42-
uses: azure/setup-helm@v3.1
42+
uses: azure/setup-helm@v3.3
4343

4444
- name: Fetch dependencies from cache
4545
id: cache-yarn
@@ -156,7 +156,7 @@ jobs:
156156
uses: actions/cache@v3
157157
with:
158158
path: lib/vscode-reh-web-*
159-
key: vscode-reh-package-${{ secrets.VSCODE_CACHE_VERSION }}-${{ steps.vscode-rev.outputs.rev }}-${{ steps.version.outputs.version }}-${{ hashFiles('patches/*.diff') }}
159+
key: vscode-reh-package-${{ secrets.VSCODE_CACHE_VERSION }}-${{ steps.vscode-rev.outputs.rev }}-${{ steps.version.outputs.version }}-${{ hashFiles('patches/*.diff', 'ci/build/build-vscode.sh') }}
160160

161161
- name: Build vscode
162162
if: steps.cache-vscode.outputs.cache-hit != 'true'
@@ -499,7 +499,7 @@ jobs:
499499
./test/node_modules/.bin/playwright install
500500
501501
- name: Run end-to-end tests
502-
run: yarn test:e2e
502+
run: yarn test:e2e --global-timeout 840000
503503

504504
- name: Upload test artifacts
505505
if: always()
@@ -523,7 +523,7 @@ jobs:
523523
fetch-depth: 0
524524

525525
- name: Run Trivy vulnerability scanner in repo mode
526-
uses: aquasecurity/trivy-action@503d3abc15463af68b817d685982721f134256a5
526+
uses: aquasecurity/trivy-action@cb606dfdb0d2b3698ace62192088ef4f5360b24f
527527
with:
528528
scan-type: "fs"
529529
scan-ref: "."

‎.github/workflows/trivy-docker.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
uses: actions/checkout@v3
5252

5353
- name: Run Trivy vulnerability scanner in image mode
54-
uses: aquasecurity/trivy-action@503d3abc15463af68b817d685982721f134256a5
54+
uses: aquasecurity/trivy-action@cb606dfdb0d2b3698ace62192088ef4f5360b24f
5555
with:
5656
image-ref: "docker.io/codercom/code-server:latest"
5757
ignore-unfixed: true

‎ci/build/build-release.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,6 @@ bundle_vscode() {
110110
rsync "$VSCODE_SRC_PATH/extensions/package.json" "$VSCODE_OUT_PATH/extensions/package.json"
111111
rsync "$VSCODE_SRC_PATH/extensions/yarn.lock" "$VSCODE_OUT_PATH/extensions/yarn.lock"
112112
rsync "$VSCODE_SRC_PATH/extensions/postinstall.mjs" "$VSCODE_OUT_PATH/extensions/postinstall.mjs"
113-
114-
pushd "$VSCODE_OUT_PATH"
115-
symlink_asar
116-
popd
117113
}
118114

119115
main "$@"

‎ci/build/build-standalone-release.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ main() {
2727
ln -s "./bin/code-server" "$RELEASE_PATH/code-server"
2828
ln -s "./lib/node" "$RELEASE_PATH/node"
2929

30-
cd "$RELEASE_PATH"
30+
pushd "$RELEASE_PATH"
3131
yarn --production --frozen-lockfile
32+
popd
3233
}
3334

3435
main "$@"

‎ci/build/build-vscode.sh

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,38 @@ set -euo pipefail
66
# MINIFY controls whether a minified version of vscode is built.
77
MINIFY=${MINIFY-true}
88

9+
delete-bin-script() {
10+
rm -f "lib/vscode-reh-web-linux-x64/bin/$1"
11+
}
12+
13+
copy-bin-script() {
14+
local script="$1"
15+
local dest="lib/vscode-reh-web-linux-x64/bin/$script"
16+
cp "lib/vscode/resources/server/bin/$script" "$dest"
17+
sed -i.bak "s/@@VERSION@@/$(vscode_version)/g" "$dest"
18+
sed -i.bak "s/@@COMMIT@@/$VSCODE_DISTRO_COMMIT/g" "$dest"
19+
sed -i.bak "s/@@APPNAME@@/code-server/g" "$dest"
20+
21+
# Fix Node path on Darwin and Linux.
22+
# We do not want expansion here; this text should make it to the file as-is.
23+
# shellcheck disable=SC2016
24+
sed -i.bak 's/^ROOT=\(.*\)$/VSROOT=\1\nROOT="$(dirname "$(dirname "$VSROOT")")"/g' "$dest"
25+
sed -i.bak 's/ROOT\/out/VSROOT\/out/g' "$dest"
26+
27+
# Fix Node path on Windows.
28+
sed -i.bak 's/^set ROOT_DIR=\(.*\)$/set ROOT_DIR=%~dp0..\\..\\..\\..\r\nset VSROOT_DIR=\1/g' "$dest"
29+
sed -i.bak 's/%ROOT_DIR%\\out/%VSROOT_DIR%\\out/g' "$dest"
30+
31+
chmod +x "$dest"
32+
rm "$dest.bak"
33+
}
34+
935
main() {
1036
cd "$(dirname "${0}")/../.."
1137

1238
source ./ci/lib.sh
1339

14-
cd lib/vscode
40+
pushd lib/vscode
1541

1642
# Set the commit Code will embed into the product.json. We need to do this
1743
# since Code tries to get the commit from the `.git` directory which will fail
@@ -58,13 +84,31 @@ main() {
5884
EOF
5985
) > product.json
6086

61-
# Any platform works since we have our own packaging step (for now).
87+
# Any platform here works since we will do our own packaging. We have to do
88+
# this because we have an NPM package that could be installed on any platform.
89+
# The correct platform dependencies and scripts will be installed as part of
90+
# the post-install during `npm install` or when building a standalone release.
6291
yarn gulp "vscode-reh-web-linux-x64${MINIFY:+-min}"
6392

6493
# Reset so if you develop after building you will not be stuck with the wrong
6594
# commit (the dev client will use `oss-dev` but the dev server will still use
6695
# product.json which will have `stable-$commit`).
6796
git checkout product.json
97+
98+
popd
99+
100+
# These provide a `code-server` command in the integrated terminal to open
101+
# files in the current instance.
102+
delete-bin-script remote-cli/code-server
103+
copy-bin-script remote-cli/code-darwin.sh
104+
copy-bin-script remote-cli/code-linux.sh
105+
copy-bin-script remote-cli/code.cmd
106+
107+
# These provide a way for terminal applications to open browser windows.
108+
delete-bin-script helpers/browser.sh
109+
copy-bin-script helpers/browser-darwin.sh
110+
copy-bin-script helpers/browser-linux.sh
111+
copy-bin-script helpers/browser.cmd
68112
}
69113

70114
main "$@"

‎ci/build/npm-postinstall.sh

Lines changed: 62 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,69 @@
11
#!/usr/bin/env sh
22
set -eu
33

4-
# Copied from arch() in ci/lib.sh.
5-
detect_arch() {
6-
case "$(uname -m)" in
7-
aarch64)
8-
echo arm64
9-
;;
10-
x86_64 | amd64)
11-
echo amd64
12-
;;
13-
*)
14-
# This will cause the download to fail, but is intentional
15-
uname -m
16-
;;
4+
# Copied from ../lib.sh.
5+
arch() {
6+
cpu="$(uname -m)"
7+
case "$cpu" in
8+
aarch64) cpu=arm64 ;;
9+
x86_64) cpu=amd64 ;;
1710
esac
11+
echo "$cpu"
1812
}
1913

20-
ARCH="${NPM_CONFIG_ARCH:-$(detect_arch)}"
14+
# Copied from ../lib.sh except we do not rename Darwin since the cloud agent
15+
# uses "darwin" in the release names and we do not need to detect Alpine.
16+
os() {
17+
osname=$(uname | tr '[:upper:]' '[:lower:]')
18+
case $osname in
19+
cygwin* | mingw*) osname="windows" ;;
20+
esac
21+
echo "$osname"
22+
}
23+
24+
# Create a symlink at $2 pointing to $1 on any platform. Anything that
25+
# currently exists at $2 will be deleted.
26+
symlink() {
27+
source="$1"
28+
dest="$2"
29+
rm -rf "$dest"
30+
case $OS in
31+
windows) mklink /J "$dest" "$source" ;;
32+
*) ln -s "$source" "$dest" ;;
33+
esac
34+
}
35+
36+
# VS Code bundles some modules into an asar which is an archive format that
37+
# works like tar. It then seems to get unpacked into node_modules.asar.
38+
#
39+
# I don't know why they do this but all the dependencies they bundle already
40+
# exist in node_modules so just symlink it. We have to do this since not only
41+
# Code itself but also extensions will look specifically in this directory for
42+
# files (like the ripgrep binary or the oniguruma wasm).
43+
symlink_asar() {
44+
symlink node_modules node_modules.asar
45+
}
46+
47+
# Make a symlink at bin/$1/$3 pointing to the platform-specific version of the
48+
# script in $2. The extension of the link will be .cmd for Windows otherwise it
49+
# will be whatever is in $4 (or no extension if $4 is not set).
50+
symlink_bin_script() {
51+
oldpwd="$(pwd)"
52+
cd "bin/$1"
53+
source="$2"
54+
dest="$3"
55+
ext="${4-}"
56+
case $OS in
57+
windows) symlink "$source.cmd" "$dest.cmd" ;;
58+
darwin | macos) symlink "$source-darwin.sh" "$dest$ext" ;;
59+
*) symlink "$source-linux.sh" "$dest$ext" ;;
60+
esac
61+
cd "$oldpwd"
62+
}
63+
64+
ARCH="${NPM_CONFIG_ARCH:-$(arch)}"
65+
OS="$(os)"
66+
2167
# This is due to an upstream issue with RHEL7/CentOS 7 comptability with node-argon2
2268
# See: https://github.com/cdr/code-server/pull/3422#pullrequestreview-677765057
2369
export npm_config_build_from_source=true
@@ -56,8 +102,6 @@ main() {
56102
;;
57103
esac
58104

59-
OS="$(uname | tr '[:upper:]' '[:lower:]')"
60-
61105
mkdir -p ./lib
62106

63107
if curl -fsSL "https://github.com/coder/cloud-agent/releases/latest/download/cloud-agent-$OS-$ARCH" -o ./lib/coder-cloud-agent; then
@@ -79,22 +123,14 @@ main() {
79123
fi
80124
}
81125

82-
# This is a copy of symlink_asar in ../lib.sh. Look there for details.
83-
symlink_asar() {
84-
rm -rf node_modules.asar
85-
if [ "${WINDIR-}" ]; then
86-
mklink /J node_modules.asar node_modules
87-
else
88-
ln -s node_modules node_modules.asar
89-
fi
90-
}
91-
92126
vscode_yarn() {
93127
echo 'Installing Code dependencies...'
94128
cd lib/vscode
95129
yarn --production --frozen-lockfile --no-default-rc
96130

97131
symlink_asar
132+
symlink_bin_script remote-cli code code-server
133+
symlink_bin_script helpers browser browser .sh
98134

99135
cd extensions
100136
yarn --production --frozen-lockfile

‎ci/helm-chart/values.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,25 @@ extraContainers: |
156156
# - name: DOCKER_DRIVER
157157
# value: "overlay2"
158158

159+
extraInitContainers: |
160+
# - name: customization
161+
# image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
162+
# imagePullPolicy: IfNotPresent
163+
# env:
164+
# - name: SERVICE_URL
165+
# value: https://open-vsx.org/vscode/gallery
166+
# - name: ITEM_URL
167+
# value: https://open-vsx.org/vscode/item
168+
# command:
169+
# - sh
170+
# - -c
171+
# - |
172+
# code-server --install-extension ms-python.python
173+
# code-server --install-extension golang.Go
174+
# volumeMounts:
175+
# - name: data
176+
# mountPath: /home/coder
177+
159178
## Additional code-server secret mounts
160179
extraSecretMounts: []
161180
# - name: secret-files

‎ci/lib.sh

Lines changed: 18 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -18,35 +18,30 @@ vscode_version() {
1818
}
1919

2020
os() {
21-
local os
22-
os=$(uname | tr '[:upper:]' '[:lower:]')
23-
if [[ $os == "linux" ]]; then
24-
# Alpine's ldd doesn't have a version flag but if you use an invalid flag
25-
# (like --version) it outputs the version to stderr and exits with 1.
26-
local ldd_output
27-
ldd_output=$(ldd --version 2>&1 || true)
28-
if echo "$ldd_output" | grep -iq musl; then
29-
os="alpine"
30-
fi
31-
elif [[ $os == "darwin" ]]; then
32-
os="macos"
33-
fi
34-
echo "$os"
21+
osname=$(uname | tr '[:upper:]' '[:lower:]')
22+
case $osname in
23+
linux)
24+
# Alpine's ldd doesn't have a version flag but if you use an invalid flag
25+
# (like --version) it outputs the version to stderr and exits with 1.
26+
# TODO: Better to check /etc/os-release; see ../install.sh.
27+
ldd_output=$(ldd --version 2>&1 || true)
28+
if echo "$ldd_output" | grep -iq musl; then
29+
osname="alpine"
30+
fi
31+
;;
32+
darwin) osname="macos" ;;
33+
cygwin* | mingw*) osname="windows" ;;
34+
esac
35+
echo "$osname"
3536
}
3637

3738
arch() {
3839
cpu="$(uname -m)"
3940
case "$cpu" in
40-
aarch64)
41-
echo arm64
42-
;;
43-
x86_64 | amd64)
44-
echo amd64
45-
;;
46-
*)
47-
echo "$cpu"
48-
;;
41+
aarch64) cpu=arm64 ;;
42+
x86_64) cpu=amd64 ;;
4943
esac
44+
echo "$cpu"
5045
}
5146

5247
# Grabs the most recent ci.yaml github workflow run that was triggered from the
@@ -104,21 +99,3 @@ export OS
10499
# RELEASE_PATH is the destination directory for the release from the root.
105100
# Defaults to release
106101
RELEASE_PATH="${RELEASE_PATH-release}"
107-
108-
# VS Code bundles some modules into an asar which is an archive format that
109-
# works like tar. It then seems to get unpacked into node_modules.asar.
110-
#
111-
# I don't know why they do this but all the dependencies they bundle already
112-
# exist in node_modules so just symlink it. We have to do this since not only VS
113-
# Code itself but also extensions will look specifically in this directory for
114-
# files (like the ripgrep binary or the oniguruma wasm).
115-
symlink_asar() {
116-
rm -rf node_modules.asar
117-
if [ "${WINDIR-}" ]; then
118-
# mklink takes the link name first.
119-
mklink /J node_modules.asar node_modules
120-
else
121-
# ln takes the link name second.
122-
ln -s node_modules node_modules.asar
123-
fi
124-
}

‎ci/steps/publish-npm.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,6 @@ main() {
8181
# https://github.com/actions/upload-artifact/issues/38
8282
tar -xzf release-npm-package/package.tar.gz
8383

84-
# Ignore symlink when publishing npm package
85-
# See: https://github.com/coder/code-server/pull/3935
86-
echo "node_modules.asar" > release/.npmignore
87-
8884
# We use this to set the name of the package in the
8985
# package.json
9086
PACKAGE_NAME="code-server"

‎docs/assets/images/icons/collab.svg

Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 1 addition & 0 deletions
Loading

‎docs/assets/images/icons/faq.svg

Lines changed: 1 addition & 0 deletions
Loading

‎docs/assets/images/icons/home.svg

Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 1 addition & 0 deletions
Loading

‎docs/assets/images/icons/upgrade.svg

Lines changed: 1 addition & 0 deletions
Loading

‎docs/assets/images/icons/usage.svg

Lines changed: 1 addition & 0 deletions
Loading

‎docs/assets/images/icons/wrench.svg

Lines changed: 1 addition & 0 deletions
Loading

‎docs/guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ access code-server on an iPad or do not want to use SSH port forwarding.
126126

127127
```console
128128
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https
129-
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo apt-key add -
129+
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
130130
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
131131
sudo apt update
132132
sudo apt install caddy

‎docs/install.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,8 @@ We currently [do not publish Windows releases](https://github.com/coder/code-ser
237237
We recommend installing code-server onto Raspberry Pi with [`yarn` or
238238
`npm`](#yarn-npm).
239239

240+
If you see an error related to `node-gyp` during installation, See [#5174](https://github.com/coder/code-server/issues/5174) for more information.
241+
240242
## Termux
241243

242244
Please see code-server's [Termux docs](./termux.md#installation) for more

‎docs/manifest.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@
55
"title": "Home",
66
"description": "Learn how to install and run code-server.",
77
"path": "./README.md",
8-
"icon": "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16px\" xml:space=\"preserve\"><path d=\"M15.45,7L14,5.551V2c0-0.55-0.45-1-1-1h-1c-0.55,0-1,0.45-1,1v0.553L9,0.555C8.727,0.297,8.477,0,8,0S7.273,0.297,7,0.555 L0.55,7C0.238,7.325,0,7.562,0,8c0,0.563,0.432,1,1,1h1v6c0,0.55,0.45,1,1,1h3v-5c0-0.55,0.45-1,1-1h2c0.55,0,1,0.45,1,1v5h3 c0.55,0,1-0.45,1-1V9h1c0.568,0,1-0.437,1-1C16,7.562,15.762,7.325,15.45,7z\"></path></svg>"
8+
"icon_path": "assets/images/icons/home.svg"
99
},
1010
{
1111
"title": "Requirements",
1212
"description": "Learn about what you need to run code-server.",
13-
"icon": "<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M6 2V11H2V15C2 16.7 3.3 18 5 18H15C16.7 18 18 16.7 18 15V2H6ZM16 15C16 15.6 15.6 16 15 16H8V4H16V15Z\" /><path d=\"M14 7H10V9H14V7Z\" /><path d=\"M14 11H10V13H14V11Z\" /></svg>",
13+
"icon_path": "assets/images/icons/requirements.svg",
1414
"path": "./requirements.md"
1515
},
1616
{
1717
"title": "Install",
1818
"description": "How to install code-server.",
19-
"icon": "<svg class=\"MuiSvgIcon-root jss172\" focusable=\"false\" viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M22.7 19l-9.1-9.1c.9-2.3.4-5-1.5-6.9-2-2-5-2.4-7.4-1.3L9 6 6 9 1.6 4.7C.4 7.1.9 10.1 2.9 12.1c1.9 1.9 4.6 2.4 6.9 1.5l9.1 9.1c.4.4 1 .4 1.4 0l2.3-2.3c.5-.4.5-1.1.1-1.4z\"></path></svg>",
19+
"icon_path": "assets/images/icons/wrench.svg",
2020
"path": "./install.md",
2121
"children": [
2222
{
@@ -34,7 +34,7 @@
3434
{
3535
"title": "Usage",
3636
"description": "How to set up and use code-server.",
37-
"icon": "<svg viewBox=\"0 0 16 16\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm16-4H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 10l-2.5-1.5L15 12V4h5v8z\"></path></svg>",
37+
"icon_path": "assets/images/icons/usage.svg",
3838
"path": "./guide.md",
3939
"children": [
4040
{
@@ -67,25 +67,25 @@
6767
{
6868
"title": "Collaboration",
6969
"description": "How to setup real time collaboration using code server.",
70-
"icon": "<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"> <path d=\"M12.2 13.4357L9.5 11.4357C10.4 10.7357 11 9.7357 11 8.5357V7.7357C11 5.8357 9.6 4.1357 7.7 4.0357C5.7 3.9357 4 5.5357 4 7.5357V8.5357C4 9.7357 4.6 10.7357 5.5 11.4357L2.8 13.5357C2.3 13.9357 2 14.5357 2 15.1357V17.0357C2 17.6357 2.4 18.0357 3 18.0357H12C12.6 18.0357 13 17.6357 13 17.0357V15.0357C13 14.4357 12.7 13.8357 12.2 13.4357Z\"/> <path d=\"M17.1 8.43436L15.3 7.23436C15.7 6.83436 16 6.23436 16 5.53436V4.63436C16 3.43436 15.1 2.23436 13.9 2.03436C12.7 1.83436 11.7 2.53436 11.2 3.43436C12.3 4.43436 13 5.83436 13 7.43436V8.43436C13 9.33436 12.8 10.2344 12.4 10.9344C12.4 10.9344 13.6 11.8344 13.6 11.9344H17C17.6 11.9344 18 11.5344 18 10.9344V10.1344C18 9.43436 17.7 8.83436 17.1 8.43436Z\"/></svg>",
70+
"icon_path": "assets/images/icons/collab.svg",
7171
"path": "./collaboration.md"
7272
},
7373
{
7474
"title": "Upgrade",
7575
"description": "How to upgrade code-server.",
76-
"icon": "<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M17.8049 2.19795C17.7385 2.1311 17.6587 2.07899 17.5708 2.04504C17.4829 2.01108 17.3889 1.99604 17.2948 2.00089C7.89216 2.49153 4.4188 10.8673 4.38528 10.9517C4.33624 11.0736 4.32406 11.2071 4.5.028 11.3358C4.3765 11.4645 4.43995 11.5827 4.53274 11.6756L8.32449 15.4674C8.41787 15.5606 8.53669 15.6242 8.66606 15.6502C8.79543 15.6762 8.92959 15.6634 9.05174 15.6135C9.13552 15.5793 17.4664 12.0671 17.9986 2.7087C18.0039 2.61474 17.9895 2.5207 17.9561 2.4327C17.9227 2.3447 17.8712 2.26471 17.8049 2.19795ZM12.3314 9.56427C12.1439 9.75179 11.9051 9.87951 11.645 9.93126C11.385 9.98302 11.1154 9.9565 10.8704 9.85505C10.6254 9.7536 10.4161 9.58178 10.2687 9.36131C10.1214 9.14085 10.0428 8.88166 10.0428 8.6165C10.0428 8.35135 10.1214 8.09215 10.2687 7.87169C10.4161 7.65123 10.6254 7.47941 10.8704 7.37796C11.1154 7.27651 11.385 7.24998 11.645 7.30174C11.9051 7.3535 12.1439 7.48121 12.3314 7.66873C12.5827 7.92012 12.7239 8.26104 12.7239 8.6165C12.7239 8.97197 12.5827 9.31288 12.3314 9.56427Z\"/><path d=\"M2.74602 14.5444C2.92281 14.3664 3.133 14.2251 3.36454 14.1285C3.59608 14.0319 3.8444 13.9819 4.09529 13.9815C4.34617 13.9811 4.59466 14.0.12 4.82653 14.126C5.05839 14.2218 5.26907 14.3624 5.44647 14.5398C5.62386 14.7172 5.7645 14.9279 5.86031 15.1598C5.95612 15.3916 6.00522 15.6401 6.00479 15.891C6.00437 16.1419 5.95442 16.3902 5.85782 16.6218C5.76122 16.8533 5.61987 17.0635 5.44186 17.2403C4.69719 17.985 2 18.0004 2 18.0004C2 18.0004 2 15.2884 2.74602 14.5444Z\"/><path d=\"M8.9416 3.48269C7.99688 3.31826 7.02645 3.38371 6.11237 3.67352C5.19828 3.96332 4.36741 4.46894 3.68999 5.14765C3.33153 5.50944.5.01988 5.91477 2.76233 6.35415C2.68692 6.4822 2.6562 6.63169 2.67501 6.77911C2.69381 6.92652 2.76108 7.06351 2.86623 7.16853L4.1994 8.50238C5.43822 6.53634 7.04911 4.83119 8.9416 3.48269Z\"/><path d=\"M16.5181 11.0585C16.6825 12.0033 16.6171 12.9737 16.3273 13.8878C16.0375 14.8019 15.5318 15.6327 14.8531 16.3101C14.4914 16.6686 14.086 16.9803 13.6466 17.2378C13.5186 17.3132 13.3691 17.3439 13.2217 17.3251C13.0743 17.3063 12.9373 17.2391 12.8323 17.1339L11.4984 15.8007C13.4645 14.5619 15.1696 12.951 16.5181 11.0585Z\"/></svg>",
76+
"icon_path": "assets/images/icons/upgrade.svg",
7777
"path": "./upgrade.md"
7878
},
7979
{
8080
"title": "FAQ",
8181
"description": "Frequently asked questions on installing and running code-server.",
82-
"icon": "<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M10.0001 18.3333C14.6025 18.3333 18.3334 14.6024 18.3334 10C18.3334 5.39762 14.6025 1.66666 10.0001 1.66666C5.39771 1.66666 1.66675 5.39762 1.66675 10C1.66675 14.6024 5.39771 18.3333 10.0001 18.3333Z\" stroke=\"currentColor\" fill=\"none\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path d=\"M7.57495 7.5C7.77087 6.94306 8.15758 6.47342 8.66658 6.17428C9.17558 5.87513 9.77403 5.76578 10.3559 5.86559C10.9378 5.96541 11.4656 6.26794 11.8458 6.71961C12.2261 7.17128 12.4342 7.74294 12.4333 8.33333C12.4333 10 9.93328 10.8333 9.93328 10.8333\" stroke=\"currentColor\" fill=\"none\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path d=\"M10 14.1667H10.0083\" stroke=\"currentColor\" fill=\"none\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>",
82+
"icon_path": "assets/images/icons/faq.svg",
8383
"path": "./FAQ.md"
8484
},
8585
{
8686
"title": "Contributing",
8787
"description": "How to contribute to code-server.",
88-
"icon": "<svg width=\"20\" height=\"20\" fill=\"none\" viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M5 2.5V12.5\" stroke=\"currentColor\" fill=\"none\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path d=\"M15 7.5C16.3807 7.5 17.5 6.38071 17.5 5C17.5 3.61929 16.3807 2.5 15 2.5C13.6193 2.5 12.5 3.61929 12.5 5C12.5 6.38071 13.6193 7.5 15 7.5Z\" stroke=\"currentColor\" fill=\"none\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path d=\"M5 17.5C6.38071 17.5 7.5 16.3807 7.5 15C7.5 13.6193 6.38071 12.5 5 12.5C3.61929 12.5 2.5 13.6193 2.5 15C2.5 16.3807 3.61929 17.5 5 17.5Z\" stroke=\"currentColor\" fill=\"none\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path d=\"M15 7.5C15 9.48912 14.2098 11.3968 12.8033 12.8033C11.3968 14.2098 9.48912 15 7.5 15\" stroke=\"currentColor\" fill=\"none\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>",
88+
"icon_path": "assets/images/icons/contributing.svg",
8989
"path": "./CONTRIBUTING.md",
9090
"children": [
9191
{

‎docs/requirements.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ for communication between the browser and the server.
2121
The following steps walk you through setting up a VM running Debian using Google
2222
Cloud (though you are welcome to use any machine or VM provider).
2323

24-
If you're [signing up with Google](https://console.cloud.google.com/getting-started) for the first time, you should get a 12-month trial with
24+
If you're [signing up with Google](https://console.cloud.google.com/getting-started) for the first time, you should get a 3-month trial with
2525
$300 of credits.
2626

2727
After you sign up and create a new Google Cloud Provider (GCP) project, create a

‎test/e2e/models/CodeServer.ts

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -283,19 +283,31 @@ export class CodeServerPage {
283283
}
284284

285285
/**
286-
* Focuses Integrated Terminal
287-
* by using "Terminal: Focus Terminal"
288-
* from the Command Palette
286+
* Focuses the integrated terminal by navigating through the command palette.
289287
*
290-
* This should focus the terminal no matter
291-
* if it already has focus and/or is or isn't
292-
* visible already.
288+
* This should focus the terminal no matter if it already has focus and/or is
289+
* or isn't visible already. It will always create a new terminal to avoid
290+
* clobbering parallel tests.
293291
*/
294292
async focusTerminal() {
295-
await this.executeCommandViaMenus("Terminal: Focus Terminal")
293+
const doFocus = async (): Promise<boolean> => {
294+
await this.executeCommandViaMenus("Terminal: Create New Terminal")
295+
try {
296+
await this.page.waitForLoadState("load")
297+
await this.page.waitForSelector("textarea.xterm-helper-textarea:focus-within", { timeout: 5000 })
298+
return true
299+
} catch (error) {
300+
return false
301+
}
302+
}
303+
304+
let attempts = 1
305+
while (!(await doFocus())) {
306+
++attempts
307+
this.codeServer.logger.debug(`no focused terminal textarea, retrying (${attempts}/∞)`)
308+
}
296309

297-
// Wait for terminal textarea to show up
298-
await this.page.waitForSelector("textarea.xterm-helper-textarea")
310+
this.codeServer.logger.debug(`opening terminal took ${attempts} ${plural(attempts, "attempt")}`)
299311
}
300312

301313
/**
@@ -423,7 +435,7 @@ export class CodeServerPage {
423435
let context = new Context()
424436
while (!(await Promise.race([openThenWaitClose(context), navigate(context)]))) {
425437
++attempts
426-
logger.debug("closed, retrying (${attempt}/∞)")
438+
logger.debug(`closed, retrying (${attempts}/∞)`)
427439
context.cancel()
428440
context = new Context()
429441
}

‎test/e2e/terminal.test.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as cp from "child_process"
2+
import { promises as fs } from "fs"
23
import * as path from "path"
34
import util from "util"
45
import { clean, tmpdir } from "../utils/helpers"
@@ -21,13 +22,24 @@ describe("Integrated Terminal", true, [], {}, () => {
2122
// Open terminal and type in value
2223
await codeServerPage.focusTerminal()
2324

24-
await codeServerPage.page.waitForLoadState("load")
2525
await codeServerPage.page.keyboard.type(`printenv VSCODE_PROXY_URI > ${tmpFile}`)
2626
await codeServerPage.page.keyboard.press("Enter")
27-
// It may take a second to process
28-
await codeServerPage.page.waitForTimeout(1000)
2927

3028
const { stdout } = await output
3129
expect(stdout).toMatch(await codeServerPage.address())
3230
})
31+
32+
test("should be able to invoke `code-server` to open a file", async ({ codeServerPage }) => {
33+
const tmpFolderPath = await tmpdir(testName)
34+
const tmpFile = path.join(tmpFolderPath, "test-file")
35+
await fs.writeFile(tmpFile, "test")
36+
const fileName = path.basename(tmpFile)
37+
38+
await codeServerPage.focusTerminal()
39+
40+
await codeServerPage.page.keyboard.type(`code-server ${tmpFile}`)
41+
await codeServerPage.page.keyboard.press("Enter")
42+
43+
await codeServerPage.waitForTab(fileName)
44+
})
3345
})

0 commit comments

Comments
 (0)
Please sign in to comment.