diff --git a/.evergreen.yml b/.evergreen.yml index 4cd885d65d..4cfce45453 100644 --- a/.evergreen.yml +++ b/.evergreen.yml @@ -4105,16 +4105,18 @@ functions: working_dir: src shell: bash env: - NODE_JS_VERSION: ${node_js_version} DOCKERHUB_USERNAME: ${dockerhub_username} DOCKERHUB_PASSWORD: ${dockerhub_password} script: | set -e { source .evergreen/setup-env.sh - (cd scripts/docker && docker build -t ubuntu22.04-xvfb -f ubuntu22.04-xvfb.Dockerfile .) + # Fetch Node.js version from VS Code's .nvmrc, default to 22.20.0 if unavailable + export NODE_VERSION=$(curl -fsSL https://raw.githubusercontent.com/microsoft/vscode/refs/heads/main/.nvmrc | tr -d '[:space:]' || echo "22.20.0") + echo "Using Node.js version for VS Code extension tests: $NODE_VERSION" + (cd scripts/docker && docker build --build-arg NODE_JS_VERSION="$NODE_VERSION" -t ubuntu24.04-xvfb -f ubuntu24.04-xvfb.Dockerfile .) docker run \ - --rm -v $PWD:/tmp/build ubuntu22.04-xvfb \ + --rm -v $PWD:/tmp/build ubuntu24.04-xvfb \ -c 'cd /tmp/build && ./testing/test-vscode.sh' } test_connectivity: @@ -6046,7 +6048,6 @@ tasks: node_js_version: "20.19.5" - func: test_vscode vars: - node_js_version: "20.19.5" task_name: ${task_name} - name: test_connectivity tags: ["extra-integration-test", "assigned_to_jira_team_mongosh_mongosh"] @@ -12458,6 +12459,8 @@ buildvariants: display_name: "Ubuntu 20.04 x64 (Other Tests)" run_on: ubuntu2004-small tags: ["nightly-driver"] + expansions: + node_js_version: "20.19.5" tasks: - name: test_vscode - name: test_connectivity diff --git a/.evergreen/evergreen.yml.in b/.evergreen/evergreen.yml.in index b3d3ddfbde..349318a047 100644 --- a/.evergreen/evergreen.yml.in +++ b/.evergreen/evergreen.yml.in @@ -324,16 +324,18 @@ functions: working_dir: src shell: bash env: - NODE_JS_VERSION: ${node_js_version} DOCKERHUB_USERNAME: ${dockerhub_username} DOCKERHUB_PASSWORD: ${dockerhub_password} script: | set -e { source .evergreen/setup-env.sh - (cd scripts/docker && docker build -t ubuntu22.04-xvfb -f ubuntu22.04-xvfb.Dockerfile .) + # Fetch Node.js version from VS Code's .nvmrc, default to 22.20.0 if unavailable + export NODE_VERSION=$(curl -fsSL https://raw.githubusercontent.com/microsoft/vscode/refs/heads/main/.nvmrc | tr -d '[:space:]' || echo "22.20.0") + echo "Using Node.js version for VS Code extension tests: $NODE_VERSION" + (cd scripts/docker && docker build --build-arg NODE_JS_VERSION="$NODE_VERSION" -t ubuntu24.04-xvfb -f ubuntu24.04-xvfb.Dockerfile .) docker run \ - --rm -v $PWD:/tmp/build ubuntu22.04-xvfb \ + --rm -v $PWD:/tmp/build ubuntu24.04-xvfb \ -c 'cd /tmp/build && ./testing/test-vscode.sh' } test_connectivity: @@ -1189,7 +1191,6 @@ tasks: node_js_version: "<% out(NODE_JS_VERSION_20) %>" - func: test_vscode vars: - node_js_version: "<% out(NODE_JS_VERSION_20) %>" task_name: ${task_name} - name: test_connectivity tags: ["extra-integration-test", "assigned_to_jira_team_mongosh_mongosh"] @@ -1611,6 +1612,8 @@ buildvariants: display_name: "Ubuntu 20.04 x64 (Other Tests)" run_on: ubuntu2004-small tags: ["nightly-driver"] + expansions: + node_js_version: "<% out(NODE_JS_VERSION_20) %>" tasks: - name: test_vscode - name: test_connectivity diff --git a/scripts/docker/ubuntu22.04-xvfb.Dockerfile b/scripts/docker/ubuntu22.04-xvfb.Dockerfile deleted file mode 100644 index ce599c03d9..0000000000 --- a/scripts/docker/ubuntu22.04-xvfb.Dockerfile +++ /dev/null @@ -1,16 +0,0 @@ -FROM ubuntu:22.04 - -ENV DEBIAN_FRONTEND=noninteractive -RUN apt-get update -RUN apt-get -y -qq install git curl apt-transport-https ca-certificates apt-utils software-properties-common - -# Add Node.js -RUN curl -sSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - -RUN echo "deb https://deb.nodesource.com/node_20.x jammy main" | tee /etc/apt/sources.list.d/nodesource.list -RUN echo "deb-src https://deb.nodesource.com/node_20.x jammy main" | tee -a /etc/apt/sources.list.d/nodesource.list - -# Install Node.js and vscode dependencies -RUN apt-get update -RUN apt-get -y -qq install nodejs libnss3 gnupg libxkbfile1 libsecret-1-0 libsecret-1-dev libgtk-3-0 libxss1 libgbm1 libasound2 xvfb build-essential pkg-config - -ENTRYPOINT [ "bash" ] diff --git a/scripts/docker/ubuntu24.04-xvfb.Dockerfile b/scripts/docker/ubuntu24.04-xvfb.Dockerfile new file mode 100644 index 0000000000..0ce7d46a86 --- /dev/null +++ b/scripts/docker/ubuntu24.04-xvfb.Dockerfile @@ -0,0 +1,26 @@ +FROM ubuntu:24.04 + +ARG NODE_JS_VERSION + +RUN if [ -z "$NODE_JS_VERSION" ]; then echo "Error: NODE_JS_VERSION is not defined"; exit 1; fi + +ENV NODE_JS_VERSION=${NODE_JS_VERSION} +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update +RUN apt-get -y -qq install git curl apt-transport-https ca-certificates apt-utils software-properties-common + +# Install Node.js using nvm (reusing pattern from .evergreen/install-node.sh) +ENV NVM_DIR="/root/.nvm" +RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash && \ + . "$NVM_DIR/nvm.sh" && \ + [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" && \ + nvm install --no-progress $NODE_JS_VERSION && \ + nvm alias default $NODE_JS_VERSION && \ + nvm use $NODE_JS_VERSION +# Set PATH so node/npm are available in all contexts +ENV PATH="$NVM_DIR/versions/node/v${NODE_JS_VERSION}/bin:$PATH" + +# Install vscode dependencies +RUN apt-get -y -qq install libnss3 gnupg libxkbfile1 libsecret-1-0 libsecret-1-dev libgtk-3-0t64 libxss1 libgbm1 libasound2t64 xvfb build-essential pkg-config + +ENTRYPOINT [ "bash" ] diff --git a/testing/test-vscode.sh b/testing/test-vscode.sh index 9c97f88c2f..d6b858d4bc 100755 --- a/testing/test-vscode.sh +++ b/testing/test-vscode.sh @@ -21,6 +21,6 @@ rm -rf node_modules/@mongosh node_modules/mongodb node_modules/@mongodb-js/devto ln -s "$mongosh_root_dir/node_modules/@mongodb-js/devtools-connect" devtools-connect && \ ln -s "$mongosh_root_dir/node_modules/@mongodb-js/devtools-proxy-support" devtools-proxy-support) # This test can require a lot of memory so we bump the maximum size. -NODE_OPTIONS=--max-old-space-size=4096 npm test +NODE_OPTIONS='--max-old-space-size=4096 --no-experimental-strip-types' npm test cd /tmp rm -rf "$test_root_dir"