Skip to content

Commit 1860aef

Browse files
committed
Stop bundling libraries in release
- Instead we now use CentOS 7 for the static build to guarantee that we only depend on libc v2.17 - For macOS we now pull in a static node binary and bundle that instead.
1 parent 7dc93dc commit 1860aef

File tree

12 files changed

+35
-111
lines changed

12 files changed

+35
-111
lines changed

.github/workflows/ci.yaml

+2-4
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
name: npm-package
5656
path: ./release-npm-package
5757
- name: Run ./ci/steps/release-packages.sh
58-
uses: ./ci/container
58+
uses: ./ci/container/centos
5959
with:
6060
args: ./ci/steps/release-packages.sh
6161
- name: Upload release artifacts
@@ -75,7 +75,7 @@ jobs:
7575
name: npm-package
7676
path: ./release-npm-package
7777
- name: Run ./ci/steps/release-packages.sh
78-
uses: ./ci/container/arm64
78+
uses: ./ci/container/centos
7979
with:
8080
args: ./ci/steps/release-packages.sh
8181
- name: Upload release artifacts
@@ -94,8 +94,6 @@ jobs:
9494
with:
9595
name: npm-package
9696
path: ./release-npm-package
97-
- run: brew unlink node@12
98-
- run: brew install node
9997
- run: ./ci/steps/release-packages.sh
10098
env:
10199
# Otherwise we get rate limited when fetching the ripgrep binary.

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ release-packages/
99
release-gcp/
1010
release-images/
1111
node_modules
12+
node-*

ci/build/build-standalone-release.sh

-21
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,6 @@ main() {
1717
mkdir -p "$RELEASE_PATH/bin"
1818
rsync ./ci/build/code-server.sh "$RELEASE_PATH/bin/code-server"
1919
rsync "$node_path" "$RELEASE_PATH/lib/node"
20-
if [[ $OS == "linux" ]]; then
21-
bundle_dynamic_lib libstdc++
22-
bundle_dynamic_lib libgcc_s
23-
elif [[ $OS == "macos" ]]; then
24-
bundle_dynamic_lib libicui18n
25-
bundle_dynamic_lib libicuuc
26-
bundle_dynamic_lib libicudata
27-
fi
2820

2921
ln -s "./bin/code-server" "$RELEASE_PATH/code-server"
3022
ln -s "./lib/node" "$RELEASE_PATH/node"
@@ -33,17 +25,4 @@ main() {
3325
yarn --production --frozen-lockfile
3426
}
3527

36-
bundle_dynamic_lib() {
37-
local lib_name="$1"
38-
local lib_path
39-
40-
if [[ $OS == "linux" ]]; then
41-
lib_path="$(ldd "$RELEASE_PATH/lib/node" | grep "$lib_name" | awk '{print $3 }')"
42-
elif [[ $OS == "macos" ]]; then
43-
lib_path="$(otool -L "$RELEASE_PATH/lib/node" | grep "$lib_name" | awk '{print $1 }')"
44-
fi
45-
46-
cp "$lib_path" "$RELEASE_PATH/lib"
47-
}
48-
4928
main "$@"

ci/build/code-server.sh

+1-6
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ _realpath() {
1212

1313
# See https://github.com/cdr/code-server/issues/1537
1414
if [ "$(uname)" = "Darwin" ]; then
15-
# We read the symlink, which may be relative from $1.
1615
script="$1"
1716
if [ -L "$script" ]; then
1817
while [ -L "$script" ]; do
18+
# We recursively read the symlink, which may be relative from $script.
1919
script="$(readlink "$script")"
2020
cd "$(dirname "$script")"
2121
done
@@ -32,9 +32,4 @@ _realpath() {
3232
}
3333

3434
ROOT="$(dirname "$(dirname "$(_realpath "$0")")")"
35-
if [ "$(uname)" = "Linux" ]; then
36-
export LD_LIBRARY_PATH="$ROOT/lib:${LD_LIBRARY_PATH-}"
37-
elif [ "$(uname)" = "Darwin" ]; then
38-
export DYLD_LIBRARY_PATH="$ROOT/lib:${DYLD_LIBRARY_PATH-}"
39-
fi
4035
exec "$ROOT/lib/node" "$ROOT" "$@"

ci/build/test-standalone-release.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ main() {
1515
./release-standalone/bin/code-server --extensions-dir "$EXTENSIONS_DIR" --install-extension ms-python.python
1616
local installed_extensions
1717
installed_extensions="$(./release-standalone/bin/code-server --extensions-dir "$EXTENSIONS_DIR" --list-extensions 2>&1)"
18-
if [[ $installed_extensions != "ms-python.python" ]]; then
18+
if [[ "$installed_extensions" != "info Using config file ~/.config/code-server/config.yaml
19+
ms-python.python" ]]; then
1920
echo "Unexpected output from listing extensions:"
2021
echo "$installed_extensions"
2122
exit 1

ci/container/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ RUN ARCH="$(dpkg --print-architecture)" && \
4343
# rm -R shellcheck*
4444

4545
# Install Go dependencies
46-
RUN ARCH="$(dpkg --print-architecture)" && \
46+
RUN ARCH="$(uname -m | sed 's/x86_64/amd64/; s/aarch64/arm64/')" && \
4747
curl -fsSL "https://dl.google.com/go/go1.14.3.linux-$ARCH.tar.gz" | tar -C /usr/local -xz
4848
ENV PATH=/usr/local/go/bin:/root/go/bin:$PATH
4949
ENV GO111MODULE=on

ci/container/arm64/Dockerfile

-53
This file was deleted.

ci/container/arm64/README.md

-6
This file was deleted.

ci/container/centos/Dockerfile

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
FROM centos:7
2+
3+
RUN curl -sL https://rpm.nodesource.com/setup_14.x | bash - && \
4+
yum install -y nodejs &&
5+
npm install -g yarn
6+
7+
RUN yum groupinstall -y 'Development Tools'
8+
RUN yum install -y python2 libsecret-devel libX11-devel libxkbfile-devel
9+
10+
RUN npm config set python python2
11+
12+
RUN yum install -y epel-release && yum install -y jq
13+
RUN yum install -y rsync
14+
15+
# Copied from ../Dockerfile
16+
# Install Go dependencies
17+
RUN ARCH="$(uname -m | sed 's/x86_64/amd64/; s/aarch64/arm64/')" && \
18+
curl -fsSL "https://dl.google.com/go/go1.14.3.linux-$ARCH.tar.gz" | tar -C /usr/local -xz
19+
ENV PATH=/usr/local/go/bin:/root/go/bin:$PATH
20+
ENV GO111MODULE=on
21+
RUN go get mvdan.cc/sh/v3/cmd/shfmt
22+
RUN go get github.com/goreleaser/nfpm/cmd/nfpm

ci/steps/release-packages.sh

+5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ set -euo pipefail
44
main() {
55
cd "$(dirname "$0")/../.."
66

7+
if [[ "$OSTYPE" == darwin* ]]; then
8+
curl -L https://nodejs.org/dist/v14.4.0/node-v14.4.0-darwin-x64.tar.gz | tar -xz
9+
PATH="$PATH:node-v14.4.0-darwin-x64/bin"
10+
fi
11+
712
# https://github.com/actions/upload-artifact/issues/38
813
tar -xzf release-npm-package/package.tar.gz
914

doc/npm.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ sudo apt-get install -y \
2020

2121
```bash
2222
sudo yum groupinstall -y 'Development Tools'
23-
sudo yum config-manager --set-enabled PowerTools
23+
sudo yum config-manager --set-enabled PowerTools # unnecessary on CentOS 7
2424
sudo yum install -y python2 libsecret-devel libX11-devel libxkbfile-devel
2525
npm config set python python2
2626
```

src/node/entry.ts

-18
Original file line numberDiff line numberDiff line change
@@ -122,25 +122,7 @@ const main = async (args: Args, cliArgs: Args, configArgs: Args): Promise<void>
122122
}
123123
}
124124

125-
function trimLDLibraryPath(): void {
126-
let ldVar: string
127-
if (process.platform === "linux") {
128-
ldVar = "LD_LIBRARY_PATH"
129-
} else if (process.platform === "darwin") {
130-
ldVar = "DYLD_LIBRARY_PATH"
131-
} else {
132-
return
133-
}
134-
135-
// Removes the leading path added by ./ci/build/code-server.sh to use our bundled
136-
// dynamic libraries. See ci/build/build-standalone-release.sh
137-
// This is required to avoid child processes using our bundled libraries.
138-
process.env[ldVar] = process.env[ldVar]?.replace(path.dirname(process.execPath) + ":", "")
139-
}
140-
141125
async function entry(): Promise<void> {
142-
trimLDLibraryPath()
143-
144126
const tryParse = async (): Promise<[Args, Args, Args]> => {
145127
try {
146128
const cliArgs = parse(process.argv.slice(2))

0 commit comments

Comments
 (0)