Skip to content

Commit daa1c86

Browse files
authored
Merge pull request #2086 from nhooyr/master
Integrate Coder Cloud Agent
2 parents 9f963c7 + 9002f11 commit daa1c86

19 files changed

+195
-78
lines changed

.github/workflows/ci.yaml

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
steps:
99
- uses: actions/checkout@v1
1010
- name: Run ./ci/steps/fmt.sh
11-
uses: ./ci/images/debian8
11+
uses: ./ci/images/debian10
1212
with:
1313
args: ./ci/steps/fmt.sh
1414

@@ -17,7 +17,7 @@ jobs:
1717
steps:
1818
- uses: actions/checkout@v1
1919
- name: Run ./ci/steps/lint.sh
20-
uses: ./ci/images/debian8
20+
uses: ./ci/images/debian10
2121
with:
2222
args: ./ci/steps/lint.sh
2323

@@ -26,7 +26,7 @@ jobs:
2626
steps:
2727
- uses: actions/checkout@v1
2828
- name: Run ./ci/steps/test.sh
29-
uses: ./ci/images/debian8
29+
uses: ./ci/images/debian10
3030
with:
3131
args: ./ci/steps/test.sh
3232

@@ -35,7 +35,7 @@ jobs:
3535
steps:
3636
- uses: actions/checkout@v1
3737
- name: Run ./ci/steps/release.sh
38-
uses: ./ci/images/debian8
38+
uses: ./ci/images/debian10
3939
with:
4040
args: ./ci/steps/release.sh
4141
- name: Upload npm package artifact
@@ -116,7 +116,7 @@ jobs:
116116
name: release-packages
117117
path: ./release-packages
118118
- name: Run ./ci/steps/build-docker-image.sh
119-
uses: ./ci/images/debian8
119+
uses: ./ci/images/debian10
120120
with:
121121
args: ./ci/steps/build-docker-image.sh
122122
- name: Upload release image

.github/workflows/publish.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
steps:
1111
- uses: actions/checkout@v1
1212
- name: Run ./ci/steps/publish-npm.sh
13-
uses: ./ci/images/debian8
13+
uses: ./ci/images/debian10
1414
with:
1515
args: ./ci/steps/publish-npm.sh
1616
env:
@@ -22,7 +22,7 @@ jobs:
2222
steps:
2323
- uses: actions/checkout@v1
2424
- name: Run ./ci/steps/push-docker-manifest.sh
25-
uses: ./ci/images/debian8
25+
uses: ./ci/images/debian10
2626
with:
2727
args: ./ci/steps/push-docker-manifest.sh
2828
env:

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ release-images/
1111
node_modules
1212
node-*
1313
/plugins
14+
/lib/coder-cloud-agent
15+
.home

.gitmodules

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
[submodule "lib/vscode"]
22
path = lib/vscode
33
url = https://github.com/microsoft/vscode
4+
ignore = dirty

ci/build/build-code-server.sh

+6
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ main() {
1818
chmod +x out/node/entry.js
1919
fi
2020

21+
if ! [ -f ./lib/coder-cloud-agent ]; then
22+
OS="$(uname | tr '[:upper:]' '[:lower:]')"
23+
curl -fsSL "https://storage.googleapis.com/coder-cloud-releases/agent/latest/$OS/cloud-agent" -o ./lib/coder-cloud-agent
24+
chmod +x ./lib/coder-cloud-agent
25+
fi
26+
2127
parcel build \
2228
--public-url "." \
2329
--out-dir dist \

ci/build/build-packages.sh

-15
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,6 @@ main() {
1111
mkdir -p release-packages
1212

1313
release_archive
14-
# Will stop the auto update issues and allow people to upgrade their scripts
15-
# for the new release structure.
16-
if [[ $ARCH == "amd64" ]]; then
17-
if [[ $OS == "linux" ]]; then
18-
ARCH=x86_64 release_archive
19-
elif [[ $OS == "macos" ]]; then
20-
OS=darwin ARCH=x86_64 release_archive
21-
fi
22-
fi
2314

2415
if [[ $OS == "linux" ]]; then
2516
release_nfpm
@@ -30,12 +21,6 @@ release_archive() {
3021
local release_name="code-server-$VERSION-$OS-$ARCH"
3122
if [[ $OS == "linux" ]]; then
3223
tar -czf "release-packages/$release_name.tar.gz" --transform "s/^\.\/release-standalone/$release_name/" ./release-standalone
33-
elif [[ $OS == "darwin" && $ARCH == "x86_64" ]]; then
34-
# Just exists to make autoupdating from 3.2.0 work again.
35-
mv ./release-standalone "./$release_name"
36-
zip -r "release-packages/$release_name.zip" "./$release_name"
37-
mv "./$release_name" ./release-standalone
38-
return
3924
else
4025
tar -czf "release-packages/$release_name.tar.gz" -s "/^release-standalone/$release_name/" release-standalone
4126
fi

ci/build/build-release.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ main() {
2525
rsync README.md "$RELEASE_PATH"
2626
rsync LICENSE.txt "$RELEASE_PATH"
2727
rsync ./lib/vscode/ThirdPartyNotices.txt "$RELEASE_PATH"
28+
rsync ./lib/coder-cloud-agent "$RELEASE_PATH/lib"
2829

2930
# code-server exports types which can be imported and used by plugins. Those
3031
# types import ipc.d.ts but it isn't included in the final vscode build so
@@ -57,7 +58,6 @@ EOF
5758
rsync yarn.lock "$RELEASE_PATH"
5859
rsync ci/build/npm-postinstall.sh "$RELEASE_PATH/postinstall.sh"
5960

60-
6161
if [ "$KEEP_MODULES" = 1 ]; then
6262
rsync node_modules/ "$RELEASE_PATH/node_modules"
6363
fi

ci/build/clean.sh

+1-10
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,7 @@ main() {
55
cd "$(dirname "${0}")/../.."
66
source ./ci/lib.sh
77

8-
rm -rf \
9-
out \
10-
release \
11-
release-standalone \
12-
release-packages \
13-
release-gcp \
14-
release-images \
15-
dist \
16-
.cache \
17-
node-*
8+
git clean -Xffd
189

1910
pushd lib/vscode
2011
git clean -xffd

ci/dev/image/run.sh

+7-1
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,22 @@ set -euo pipefail
44
main() {
55
cd "$(dirname "$0")/../../.."
66
source ./ci/lib.sh
7+
mkdir -p .home
78

89
docker run \
910
-it \
1011
--rm \
1112
-v "$PWD:/src" \
13+
-e HOME="/src/.home" \
14+
-e USER="coder" \
15+
-e GITHUB_TOKEN \
16+
-e KEEP_MODULES \
17+
-e MINIFY \
1218
-w /src \
1319
-p 127.0.0.1:8080:8080 \
1420
-u "$(id -u):$(id -g)" \
1521
-e CI \
16-
"$(docker_build ./ci/images/debian8)" \
22+
"$(docker_build ./ci/images/"${IMAGE-debian10}")" \
1723
"$@"
1824
}
1925

ci/dev/lint.sh

+1-4
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@ main() {
77
eslint --max-warnings=0 --fix $(git ls-files "*.ts" "*.tsx" "*.js")
88
stylelint $(git ls-files "*.css")
99
tsc --noEmit
10-
# See comment in ./ci/image/debian8
11-
if [[ ! ${CI-} ]]; then
12-
shellcheck -e SC2046,SC2164,SC2154,SC1091,SC1090,SC2002 $(git ls-files "*.sh")
13-
fi
10+
shellcheck -e SC2046,SC2164,SC2154,SC1091,SC1090,SC2002 $(git ls-files "*.sh")
1411
}
1512

1613
main "$@"

ci/images/centos7/Dockerfile

+8-3
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,16 @@ RUN npm config set python python2
1515
RUN yum install -y epel-release && yum install -y jq
1616
RUN yum install -y rsync
1717

18-
# Copied from ../debian8/Dockerfile
19-
# Install Go dependencies
18+
# Copied from ../debian10/Dockerfile
19+
# Install Go.
2020
RUN ARCH="$(uname -m | sed 's/x86_64/amd64/; s/aarch64/arm64/')" && \
2121
curl -fsSL "https://dl.google.com/go/go1.14.3.linux-$ARCH.tar.gz" | tar -C /usr/local -xz
22-
ENV PATH=/usr/local/go/bin:/root/go/bin:$PATH
22+
ENV GOPATH=/gopath
23+
# Ensures running this image as another user works.
24+
RUN mkdir -p $GOPATH && chmod -R 777 $GOPATH
25+
ENV PATH=/usr/local/go/bin:$GOPATH/bin:$PATH
26+
27+
# Install Go dependencies
2328
ENV GO111MODULE=on
2429
RUN go get mvdan.cc/sh/v3/cmd/shfmt
2530
RUN go get github.com/goreleaser/nfpm/cmd/nfpm

ci/images/debian8/Dockerfile renamed to ci/images/debian10/Dockerfile

+13-18
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM debian:8
1+
FROM debian:10
22

33
RUN apt-get update
44

@@ -24,28 +24,23 @@ RUN apt-get install -y build-essential \
2424
RUN apt-get install -y gettext-base
2525

2626
# Misc build dependencies.
27-
RUN apt-get install -y git rsync unzip
28-
29-
# We need latest jq from debian buster for date support.
30-
RUN ARCH="$(dpkg --print-architecture)" && \
31-
curl -fsSOL http://http.us.debian.org/debian/pool/main/libo/libonig/libonig5_6.9.1-1_$ARCH.deb && \
32-
dpkg -i libonig*.deb && \
33-
curl -fsSOL http://http.us.debian.org/debian/pool/main/j/jq/libjq1_1.5+dfsg-2+b1_$ARCH.deb && \
34-
dpkg -i libjq*.deb && \
35-
curl -fsSOL http://http.us.debian.org/debian/pool/main/j/jq/jq_1.5+dfsg-2+b1_$ARCH.deb && \
36-
dpkg -i jq*.deb && rm *.deb
27+
RUN apt-get install -y git rsync unzip jq
3728

3829
# Installs shellcheck.
39-
# Unfortunately coredumps on debian:8 so disabled for now.
40-
#RUN curl -fsSL https://github.com/koalaman/shellcheck/releases/download/v0.7.1/shellcheck-v0.7.1.linux.$(uname -m).tar.xz | \
41-
# tar -xJ && \
42-
# mv shellcheck*/shellcheck /usr/local/bin && \
43-
# rm -R shellcheck*
30+
RUN curl -fsSL https://github.com/koalaman/shellcheck/releases/download/v0.7.1/shellcheck-v0.7.1.linux.$(uname -m).tar.xz | \
31+
tar -xJ && \
32+
mv shellcheck*/shellcheck /usr/local/bin && \
33+
rm -R shellcheck*
4434

45-
# Install Go dependencies
35+
# Install Go.
4636
RUN ARCH="$(uname -m | sed 's/x86_64/amd64/; s/aarch64/arm64/')" && \
4737
curl -fsSL "https://dl.google.com/go/go1.14.3.linux-$ARCH.tar.gz" | tar -C /usr/local -xz
48-
ENV PATH=/usr/local/go/bin:/root/go/bin:$PATH
38+
ENV GOPATH=/gopath
39+
# Ensures running this image as another user works.
40+
RUN mkdir -p $GOPATH && chmod -R 777 $GOPATH
41+
ENV PATH=/usr/local/go/bin:$GOPATH/bin:$PATH
42+
43+
# Install Go dependencies
4944
ENV GO111MODULE=on
5045
RUN go get mvdan.cc/sh/v3/cmd/shfmt
5146
RUN go get github.com/goreleaser/nfpm/cmd/nfpm

ci/release-image/entrypoint.sh

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
set -eu
33

44
# This isn't set by default.
5-
export USER="$(whoami)"
5+
USER="$(whoami)"
6+
export USER
67

78
if [ "${DOCKER_USER-}" != "$USER" ]; then
89
echo "$DOCKER_USER ALL=(ALL) NOPASSWD:ALL" | sudo tee -a /etc/sudoers.d/nopasswd > /dev/null
@@ -11,7 +12,7 @@ if [ "${DOCKER_USER-}" != "$USER" ]; then
1112
sudo usermod --login "$DOCKER_USER" coder
1213
sudo groupmod -n "$DOCKER_USER" coder
1314

14-
export USER="$(whoami)"
15+
USER="$DOCKER_USER"
1516

1617
sudo sed -i "/coder/d" /etc/sudoers.d/nopasswd
1718
sudo sed -i "s/coder/$DOCKER_USER/g" /etc/fixuid/config.yml

doc/CONTRIBUTING.md

+9-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Differences:
3232
- We require a minimum of node v12 but later versions should work.
3333
- We use [nfpm](https://github.com/goreleaser/nfpm) to build `.deb` and `.rpm` packages.
3434
- We use [jq](https://stedolan.github.io/jq/) to build code-server releases.
35-
- The [CI container](../ci/images/debian8/Dockerfile) is a useful reference for all our dependencies.
35+
- The [CI container](../ci/images/debian10/Dockerfile) is a useful reference for all our dependencies.
3636

3737
## Development Workflow
3838

@@ -76,7 +76,7 @@ node .
7676
Build release packages (make sure you run `./ci/steps/release.sh` first):
7777

7878
```
79-
./ci/dev/image/run.sh ./ci/steps/release-packages.sh
79+
IMAGE=centos7 ./ci/dev/image/run.sh ./ci/steps/release-packages.sh
8080
# The standalone release is in ./release-standalone
8181
# .deb, .rpm and the standalone archive are in ./release-packages
8282
```
@@ -99,6 +99,13 @@ yarn test:standalone-release
9999
yarn package
100100
```
101101

102+
For a faster release build you can also run:
103+
104+
```
105+
KEEP_MODULES=1 ./ci/steps/release.sh
106+
node ./release
107+
```
108+
102109
## Structure
103110

104111
The `code-server` script serves an HTTP API to login and start a remote VS Code process.

package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "code-server",
33
"license": "MIT",
4-
"version": "3.5.0",
4+
"version": "3.6.0",
55
"description": "Run VS Code on a remote server.",
66
"homepage": "https://github.com/cdr/code-server",
77
"bugs": {
@@ -39,6 +39,7 @@
3939
"@types/pem": "^1.9.5",
4040
"@types/safe-compare": "^1.1.0",
4141
"@types/semver": "^7.1.0",
42+
"@types/split2": "^2.1.6",
4243
"@types/tar-fs": "^2.0.0",
4344
"@types/tar-stream": "^2.1.0",
4445
"@types/ws": "^7.2.6",
@@ -76,6 +77,7 @@
7677
"safe-buffer": "^5.1.1",
7778
"safe-compare": "^1.1.4",
7879
"semver": "^7.1.3",
80+
"split2": "^3.2.2",
7981
"tar": "^6.0.1",
8082
"tar-fs": "^2.0.0",
8183
"ws": "^7.2.0",

0 commit comments

Comments
 (0)