Skip to content

Commit 6275520

Browse files
authored
Fix incorrect argon2 target in arm builds (#6453)
* Fix building from source on arm Not building from source causes argon2 to pull the wrong arch, so we have to build from source. But building from source is causing the new Kerberos module to fail on arm64 and keytar to fail on both. The latter has been very difficult to debug because the GitHub image provides a different result to containers based on Ubuntu 20.04. Because of this, use a container instead. Use debian:buster as the container because it is easier to set up the architecture sources (no need to modify the sources) and because it seems to come with glibc 2.28 rather than 2.31. Also use the exact version of Node (18.15.0) for reproducibility. * Set owner and group during tar to zero Otherwise you get IDs that can cause (benign) errors while extracting, which might be confusing. At the very least, I did not see these errors from previous tars (although they seem to use 1001). There is no guarantee what IDs might exist so 0 seems the most reasonable.
1 parent 2bb51a2 commit 6275520

File tree

3 files changed

+37
-32
lines changed

3 files changed

+37
-32
lines changed

.github/workflows/release.yaml

+32-27
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
- name: Install Node.js v18
3939
uses: actions/setup-node@v3
4040
with:
41-
node-version: "18"
41+
node-version: "18.15.0"
4242

4343
- name: Install development tools
4444
run: |
@@ -100,27 +100,37 @@ jobs:
100100
discussion_category_name: "📣 Announcements"
101101
files: ./release-packages/*
102102

103-
# TODO: We should use the same CentOS image to cross-compile if possible?
104103
package-linux-cross:
105104
name: Linux cross-compile builds
106-
runs-on: ubuntu-20.04
105+
runs-on: ubuntu-latest
107106
timeout-minutes: 15
108107
needs: npm-version
108+
container: "debian:buster"
109109
strategy:
110110
matrix:
111111
include:
112112
- prefix: aarch64-linux-gnu
113-
arch: arm64
113+
npm_arch: arm64
114+
apt_arch: arm64
114115
- prefix: arm-linux-gnueabihf
115-
arch: armv7l
116+
npm_arch: armv7l
117+
apt_arch: armhf
116118

117119
env:
118120
AR: ${{ format('{0}-ar', matrix.prefix) }}
121+
AS: ${{ format('{0}-as', matrix.prefix) }}
119122
CC: ${{ format('{0}-gcc', matrix.prefix) }}
123+
CPP: ${{ format('{0}-cpp', matrix.prefix) }}
120124
CXX: ${{ format('{0}-g++', matrix.prefix) }}
121-
LINK: ${{ format('{0}-g++', matrix.prefix) }}
122-
npm_config_arch: ${{ matrix.arch }}
125+
FC: ${{ format('{0}-gfortran', matrix.prefix) }}
126+
LD: ${{ format('{0}-ld', matrix.prefix) }}
127+
STRIP: ${{ format('{0}-strip', matrix.prefix) }}
128+
PKG_CONFIG_PATH: ${{ format('/usr/lib/{0}/pkgconfig', matrix.prefix) }}
129+
TARGET_ARCH: ${{ matrix.apt_arch }}
130+
npm_config_arch: ${{ matrix.npm_arch }}
123131
NODE_VERSION: v18.15.0
132+
# Not building from source results in an x86_64 argon2, as if
133+
# npm_config_arch is being ignored.
124134
npm_config_build_from_source: true
125135

126136
steps:
@@ -132,30 +142,25 @@ jobs:
132142
with:
133143
node-version: "18.15.0"
134144

145+
- name: Install cross-compiler and system dependencies
146+
run: |
147+
dpkg --add-architecture $TARGET_ARCH
148+
apt-get update && apt-get install -y --no-install-recommends \
149+
crossbuild-essential-$TARGET_ARCH \
150+
libx11-dev:$TARGET_ARCH \
151+
libx11-xcb-dev:$TARGET_ARCH \
152+
libxkbfile-dev:$TARGET_ARCH \
153+
libsecret-1-dev:$TARGET_ARCH \
154+
libkrb5-dev:$TARGET_ARCH \
155+
ca-certificates \
156+
curl wget rsync gettext-base
157+
135158
- name: Install nfpm
136159
run: |
137160
mkdir -p ~/.local/bin
138161
curl -sSfL https://github.com/goreleaser/nfpm/releases/download/v2.3.1/nfpm_2.3.1_`uname -s`_`uname -m`.tar.gz | tar -C ~/.local/bin -zxv nfpm
139162
echo "$HOME/.local/bin" >> $GITHUB_PATH
140163
141-
- name: Install cross-compiler and system dependencies (arm64)
142-
if: ${{ matrix.arch != 'armv7l' }}
143-
run: sudo apt update && sudo apt install -y $PACKAGE libkrb5-dev
144-
env:
145-
PACKAGE: ${{ format('g++-{0}', matrix.prefix) }}
146-
147-
- name: Install cross-compiler and system dependencies (armv7l)
148-
if: ${{ matrix.arch == 'armv7l' }}
149-
run: |
150-
sudo sed -i "s/^deb/deb [arch=amd64,i386]/g" /etc/apt/sources.list
151-
echo "deb [arch=arm64,armhf] http://ports.ubuntu.com/ $(lsb_release -s -c) main universe multiverse restricted" | sudo tee -a /etc/apt/sources.list
152-
echo "deb [arch=arm64,armhf] http://ports.ubuntu.com/ $(lsb_release -s -c)-updates main universe multiverse restricted" | sudo tee -a /etc/apt/sources.list
153-
sudo dpkg --add-architecture armhf
154-
sudo apt update
155-
sudo apt install -y $PACKAGE libkrb5-dev:armhf
156-
env:
157-
PACKAGE: ${{ format('g++-{0}', matrix.prefix) }}
158-
159164
- name: Download npm package
160165
uses: actions/download-artifact@v3
161166
with:
@@ -183,7 +188,7 @@ jobs:
183188
- name: Build packages with nfpm
184189
env:
185190
VERSION: ${{ env.VERSION }}
186-
run: yarn package ${npm_config_arch}
191+
run: npm run package ${npm_config_arch}
187192

188193
- uses: softprops/action-gh-release@v1
189194
with:
@@ -203,7 +208,7 @@ jobs:
203208
- name: Install Node.js v18
204209
uses: actions/setup-node@v3
205210
with:
206-
node-version: "18"
211+
node-version: "18.15.0"
207212

208213
- name: Install nfpm
209214
run: |

ci/build/build-packages.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ main() {
2727
release_archive() {
2828
local release_name="code-server-$VERSION-$OS-$ARCH"
2929
if [[ $OS == "linux" ]]; then
30-
tar -czf "release-packages/$release_name.tar.gz" --transform "s/^\.\/release-standalone/$release_name/" ./release-standalone
30+
tar -czf "release-packages/$release_name.tar.gz" --owner=0 --group=0 --transform "s/^\.\/release-standalone/$release_name/" ./release-standalone
3131
else
3232
tar -czf "release-packages/$release_name.tar.gz" -s "/^release-standalone/$release_name/" release-standalone
3333
fi

ci/build/build-standalone-release.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ main() {
99
rsync "$RELEASE_PATH/" "$RELEASE_PATH-standalone"
1010
RELEASE_PATH+=-standalone
1111

12-
# We cannot find the path to node from $PATH because yarn shims a script to ensure
13-
# we use the same version it's using so we instead run a script with yarn that
14-
# will print the path to node.
12+
# We cannot get the path to Node from $PATH (for example via `which node`)
13+
# because Yarn shims a script called `node` and we would end up just copying
14+
# that script. Instead we run Node and have it print its actual path.
1515
local node_path
16-
node_path="$(yarn -s node <<< 'console.info(process.execPath)')"
16+
node_path="$(node <<< 'console.info(process.execPath)')"
1717

1818
mkdir -p "$RELEASE_PATH/bin"
1919
mkdir -p "$RELEASE_PATH/lib"

0 commit comments

Comments
 (0)