Skip to content

Commit 3fd901a

Browse files
committed
Install yarn in nodejs.sh script instead of dockerfile so that it's present on all CI images
1 parent 6e6a585 commit 3fd901a

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/ci/docker/host-x86_64/tidy/Dockerfile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ RUN sh /scripts/nodejs.sh /node
2929
ENV PATH="/node/bin:${PATH}"
3030

3131
COPY host-x86_64/tidy/eslint.version /tmp/
32-
COPY host-x86_64/tidy/yarn.version /tmp/
3332

3433
COPY scripts/sccache.sh /scripts/
3534
RUN sh /scripts/sccache.sh
@@ -40,8 +39,7 @@ RUN pip3 install --no-deps --no-cache-dir --require-hashes -r /tmp/reuse-require
4039

4140
COPY host-x86_64/pr-check-1/validate-toolstate.sh /scripts/
4241

43-
# Install yarn, and then use it to install eslint
44-
RUN bash -c 'npm install -g yarn@$(cat /tmp/yarn.version)'
42+
# Install eslint
4543
RUN bash -c 'yarn global add eslint@$(cat /tmp/eslint.version)'
4644

4745
# NOTE: intentionally uses python2 for x.py so we can test it still works.

src/ci/docker/scripts/nodejs.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,13 @@
33
set -ex
44

55
NODEJS_VERSION=v20.12.2
6+
YARN_VERSION=1.22.22
67
INSTALL_PATH=${1:-/node}
78

89
url="https://nodejs.org/dist/${NODEJS_VERSION}/node-${NODEJS_VERSION}-linux-x64.tar.xz"
910
curl -sL "$url" | tar -xJ
1011
mv node-${NODEJS_VERSION}-linux-x64 "${INSTALL_PATH}"
12+
13+
# now, install yarn.
14+
# we call npm through the node binary, because otherwise npm will expect node to be in the PATH
15+
"${INSTALL_PATH}/bin/node" "${INSTALL_PATH}/bin/npm" install --global yarn@${YARN_VERSION}

0 commit comments

Comments
 (0)