about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-04-21 01:06:10 +0000
committerbors <bors@rust-lang.org>2024-04-21 01:06:10 +0000
commit426a698606ca94d4c4a674a346c701bf44b0aeb3 (patch)
treeb0587b3ba5ddb0abe7e5ed8163075d6381f1f3d9
parent453ceafce32ef8108c604bca5e165ab41d3d6d8c (diff)
parenta920ed4136317cc8a44f3e62ac86143859507772 (diff)
Auto merge of #123981 - Kobzol:update-nodejs, r=Mark-Simulacrum
CI: add script for installing NodeJS and update it to v20

I centralized the installation on a single place to make it simple to update the NodeJS version across the board.

Fixes: https://github.com/rust-lang/rust/issues/123965

r? `@Mark-Simulacrum`
-rw-r--r--src/ci/docker/host-x86_64/mingw-check/Dockerfile6
-rw-r--r--src/ci/docker/host-x86_64/test-various/Dockerfile6
-rw-r--r--src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile6
-rw-r--r--src/ci/docker/scripts/nodejs.sh10
4 files changed, 20 insertions, 8 deletions
diff --git a/src/ci/docker/host-x86_64/mingw-check/Dockerfile b/src/ci/docker/host-x86_64/mingw-check/Dockerfile
index ae8dfadec73..5497d57754d 100644
--- a/src/ci/docker/host-x86_64/mingw-check/Dockerfile
+++ b/src/ci/docker/host-x86_64/mingw-check/Dockerfile
@@ -21,10 +21,12 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
   mingw-w64 \
   && rm -rf /var/lib/apt/lists/*
 
-RUN curl -sL https://nodejs.org/dist/v16.9.0/node-v16.9.0-linux-x64.tar.xz | tar -xJ
-ENV PATH="/node-v16.9.0-linux-x64/bin:${PATH}"
 ENV RUST_CONFIGURE_ARGS="--set rust.validate-mir-opts=3"
 
+COPY scripts/nodejs.sh /scripts/
+RUN sh /scripts/nodejs.sh /node
+ENV PATH="/node/bin:${PATH}"
+
 # Install es-check
 # Pin its version to prevent unrelated CI failures due to future es-check versions.
 RUN npm install es-check@6.1.1 eslint@8.6.0 -g
diff --git a/src/ci/docker/host-x86_64/test-various/Dockerfile b/src/ci/docker/host-x86_64/test-various/Dockerfile
index 8875e226fd8..f874b2ed475 100644
--- a/src/ci/docker/host-x86_64/test-various/Dockerfile
+++ b/src/ci/docker/host-x86_64/test-various/Dockerfile
@@ -28,8 +28,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
   qemu-system-x86 \
   && rm -rf /var/lib/apt/lists/*
 
-RUN curl -sL https://nodejs.org/dist/v18.12.0/node-v18.12.0-linux-x64.tar.xz | \
-  tar -xJ
+COPY scripts/nodejs.sh /scripts/
+RUN sh /scripts/nodejs.sh /node
+ENV PATH="/node/bin:${PATH}"
 
 WORKDIR /build/
 COPY scripts/musl-toolchain.sh /build/
@@ -45,7 +46,6 @@ ENV WASI_SDK_PATH=/wasi-sdk-22.0
 
 ENV RUST_CONFIGURE_ARGS \
   --musl-root-x86_64=/usr/local/x86_64-linux-musl \
-  --set build.nodejs=/node-v18.12.0-linux-x64/bin/node \
   --set rust.lld
 
 # Some run-make tests have assertions about code size, and enabling debug
diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile
index a3e8f6176a3..6a09ab3065f 100644
--- a/src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile
+++ b/src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile
@@ -72,9 +72,9 @@ ENV GCC_EXEC_PREFIX="/usr/lib/gcc/"
 
 COPY host-x86_64/x86_64-gnu-tools/checktools.sh /tmp/
 
-RUN curl -sL https://nodejs.org/dist/v14.20.0/node-v14.20.0-linux-x64.tar.xz | tar -xJ
-ENV NODE_FOLDER=/node-v14.20.0-linux-x64/bin
-ENV PATH="$NODE_FOLDER:${PATH}"
+COPY scripts/nodejs.sh /scripts/
+RUN sh /scripts/nodejs.sh /node
+ENV PATH="/node/bin:${PATH}"
 
 COPY host-x86_64/x86_64-gnu-tools/browser-ui-test.version /tmp/
 
diff --git a/src/ci/docker/scripts/nodejs.sh b/src/ci/docker/scripts/nodejs.sh
new file mode 100644
index 00000000000..ae28da0bdc7
--- /dev/null
+++ b/src/ci/docker/scripts/nodejs.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+set -ex
+
+NODEJS_VERSION=v20.12.2
+INSTALL_PATH=${1:-/node}
+
+url="https://nodejs.org/dist/${NODEJS_VERSION}/node-${NODEJS_VERSION}-linux-x64.tar.xz"
+curl -sL "$url" | tar -xJ
+mv node-${NODEJS_VERSION}-linux-x64 "${INSTALL_PATH}"