Revert "SERVER-110631: add asp-js-engine to mongostream container (#42451)" (#42787)

Co-authored-by: auto-revert-processor <devprod-si-team@mongodb.com>
GitOrigin-RevId: c6de54be67897960e3ba69dd035b44d89172fb15
This commit is contained in:
auto-revert-app[bot] 2025-10-17 04:32:08 +00:00 committed by MongoDB Bot
parent 9b9e2f8475
commit f0c7c73645
7 changed files with 3 additions and 385 deletions

View File

@ -36,7 +36,7 @@ def make_task(compile_variant: str, additional_dependencies: set[str], push: str
commands = [ commands = [
BuiltInCommand("manifest.load", {}), BuiltInCommand("manifest.load", {}),
FunctionCall("git get streams project and add git tag"), FunctionCall("git get project and add git tag"),
FunctionCall("f_expansions_write"), FunctionCall("f_expansions_write"),
FunctionCall("set up venv"), FunctionCall("set up venv"),
FunctionCall("fetch binaries"), FunctionCall("fetch binaries"),

View File

@ -87,13 +87,6 @@ modules:
prefix: "${workdir}/devprodCoveritySrc" prefix: "${workdir}/devprodCoveritySrc"
branch: main branch: main
auto_update: true auto_update: true
- name: asp-js-engine
owner: 10gen
# repo: git@github.com:10gen/asp-js-engine.git
repo: asp-js-engine
prefix: asp-js-engine
branch: master
auto_update: true
# Pre task steps # Pre task steps
pre: pre:

View File

@ -87,16 +87,6 @@ functions:
wtdevelop: ${wtdevelop_rev} wtdevelop: ${wtdevelop_rev}
clone_depth: 1000 clone_depth: 1000
"git get shallow streams project": &git_get_shallow_streams_project
command: git.get_project
display_name: "git get shallow project"
params:
directory: ${git_project_directory|src}
revisions: # for each module include revision as <module_name> : ${<module_name>_rev}
wtdevelop: ${wtdevelop_rev}
asp-js-engine: ${asp-js-engine_rev}
clone_depth: 1000
"restore git history and tags": &restore_git_history_and_tags "restore git history and tags": &restore_git_history_and_tags
command: subprocess.exec command: subprocess.exec
display_name: "restore git history and tags" display_name: "restore git history and tags"
@ -134,12 +124,6 @@ functions:
- *restore_git_history_and_tags - *restore_git_history_and_tags
- *add_git_tag - *add_git_tag
"git get streams project and add git tag":
- *f_expansions_write
- *git_get_shallow_streams_project
- *restore_git_history_and_tags
- *add_git_tag
"gen feature flags": "gen feature flags":
command: subprocess.exec command: subprocess.exec
display_name: "gen feature flags" display_name: "gen feature flags"

View File

@ -179,7 +179,6 @@ buildvariants:
- <<: *enterprise-amazon-linux2023-arm64-all-feature-flags-template - <<: *enterprise-amazon-linux2023-arm64-all-feature-flags-template
name: enterprise-amazon-linux2023-arm64-all-feature-flags-extra-system-deps name: enterprise-amazon-linux2023-arm64-all-feature-flags-extra-system-deps
display_name: "! Amazon Linux 2023 arm64 Atlas Enterprise (all feature flags, extra system deps)" display_name: "! Amazon Linux 2023 arm64 Atlas Enterprise (all feature flags, extra system deps)"
modules: ["asp-js-engine"]
run_on: run_on:
- amazon2023-arm64-latest-small - amazon2023-arm64-latest-small
expansions: expansions:

View File

@ -482,7 +482,6 @@ buildvariants:
- name: enterprise-amazon2023-streams - name: enterprise-amazon2023-streams
display_name: "Amazon Linux 2023 enterprise build with streams" display_name: "Amazon Linux 2023 enterprise build with streams"
cron: "0 3 * * *" # From the ${project_nightly_cron} parameter. cron: "0 3 * * *" # From the ${project_nightly_cron} parameter.
modules: ["asp-js-engine"]
run_on: run_on:
- amazon2023-latest-small - amazon2023-latest-small
expansions: expansions:
@ -526,7 +525,6 @@ buildvariants:
- name: enterprise-amazon2023-streams-arm64 - name: enterprise-amazon2023-streams-arm64
display_name: "Amazon Linux 2023 enterprise build with streams arm64" display_name: "Amazon Linux 2023 enterprise build with streams arm64"
cron: "0 3 * * *" # From the ${project_nightly_cron} parameter. cron: "0 3 * * *" # From the ${project_nightly_cron} parameter.
modules: ["asp-js-engine"]
run_on: run_on:
- amazon2023-arm64-latest-small - amazon2023-arm64-latest-small
expansions: expansions:
@ -573,7 +571,6 @@ buildvariants:
- name: enterprise-amazon2-streams - name: enterprise-amazon2-streams
display_name: "Amazon Linux 2 enterprise build with streams" display_name: "Amazon Linux 2 enterprise build with streams"
cron: "0 3 * * *" # From the ${project_nightly_cron} parameter. cron: "0 3 * * *" # From the ${project_nightly_cron} parameter.
modules: ["asp-js-engine"]
run_on: run_on:
- amazon2-latest-small - amazon2-latest-small
expansions: expansions:
@ -617,7 +614,6 @@ buildvariants:
- name: enterprise-amazon2-streams-arm64 - name: enterprise-amazon2-streams-arm64
display_name: "Amazon Linux 2 enterprise build with streams arm64" display_name: "Amazon Linux 2 enterprise build with streams arm64"
cron: "0 3 * * *" # From the ${project_nightly_cron} parameter. cron: "0 3 * * *" # From the ${project_nightly_cron} parameter.
modules: ["asp-js-engine"]
run_on: run_on:
- amazon2-arm64-latest-small - amazon2-arm64-latest-small
expansions: expansions:

View File

@ -1,335 +0,0 @@
#!/bin/bash
# Build JS Engine Shell Script
# Converted from Docker commands to standalone shell script
set -euo pipefail # Exit on error, undefined variables, and pipe failures
# Default Node.js version
NODE_VERSION="${NODE_VERSION:-16}"
# Function to show usage
usage() {
cat <<EOF
Usage: $0 [OPTIONS]
Build and setup JS Engine with Node.js
OPTIONS:
-n, --node-version VERSION Node.js major version to install (default: 16)
-b, --build-dir DIR Build directory (JS engine source path)
-t, --target-dir DIR Target directory to copy JS engine files to
-h, --help Show this help message
EXAMPLES:
$0 # Install Node.js 16.x (default)
$0 -n 18 # Install Node.js 18.x
$0 --node-version 20 -t /app # Install Node.js 20.x and copy files to /app
$0 -b /path/to/source -t /app # Use custom build dir and copy to /app
$0 -n 18 -b ./js-engine -t /opt/app # Full example with all options
ENVIRONMENT VARIABLES:
NODE_VERSION Default Node.js version if -n not specified (default: 16)
NOTES:
- Build directory (-b) is required when building/copying the JS engine
- Target directory (-t) is optional; if not specified, files won't be copied
- The script will verify that package.json exists in the build directory
EOF
exit 0
}
# Function to log messages
log() {
echo "[$(date '+%Y-%m-%d %H:%M:%S')] $*"
}
# Function to check if running as root (needed for package installation)
check_root() {
if [[ $EUID -ne 0 ]]; then
echo "Error: This script must be run as root for package installation"
echo "Please run with sudo: sudo $0"
exit 1
fi
}
# Function to detect package manager
detect_package_manager() {
if command -v yum >/dev/null 2>&1; then
echo "yum"
elif command -v apt-get >/dev/null 2>&1; then
echo "apt"
elif command -v dnf >/dev/null 2>&1; then
echo "dnf"
else
echo "unknown"
fi
}
# Main installation function
# Add NodeSource repository via https://nodesource.com/products/distributions
install_nodejs() {
local pkg_manager
pkg_manager=$(detect_package_manager)
log "Detected package manager: $pkg_manager"
log "Installing Node.js version: ${NODE_VERSION}.x"
case $pkg_manager in
"yum")
log "Adding NodeSource repository via https://nodesource.com/products/distributions"
wget -qO- "https://rpm.nodesource.com/setup_${NODE_VERSION}.x" | bash -
log "Installing Node.js and npm"
yum install -y nodejs npm
log "Cleaning up"
yum clean all
;;
"dnf")
log "Adding NodeSource repository via https://nodesource.com/products/distributions"
wget -qO- "https://rpm.nodesource.com/setup_${NODE_VERSION}.x" | bash -
log "Installing Node.js and npm"
dnf install -y nodejs npm
log "Cleaning up"
dnf clean all
;;
"apt")
log "Adding NodeSource repository via https://nodesource.com/products/distributions"
wget -qO- "https://deb.nodesource.com/setup_${NODE_VERSION}.x" | bash -
log "Installing Node.js and npm"
apt-get install -y nodejs npm
log "Cleaning up"
apt-get clean
;;
*)
log "Error: Unsupported package manager. Please install Node.js manually."
exit 1
;;
esac
}
# Function to verify Node.js installation
verify_nodejs() {
log "Verifying Node.js installation"
if ! command -v node >/dev/null 2>&1; then
log "Error: node command not found"
exit 1
fi
if ! command -v npm >/dev/null 2>&1; then
log "Error: npm command not found"
exit 1
fi
local node_version
local npm_version
node_version=$(node -v)
npm_version=$(npm -v)
log "Node.js version: $node_version"
log "npm version: $npm_version"
}
# Function to verify build directory
verify_build_dir() {
local build_dir="$1"
log "Verifying build directory: $build_dir"
if [[ -z "$build_dir" ]]; then
log "Error: Build directory is empty or unset"
log "Please specify with -b/--build-dir argument"
return 1
fi
if [[ ! -d "$build_dir" ]]; then
log "Error: Build directory does not exist: $build_dir"
return 1
fi
if [[ ! -f "$build_dir/package.json" ]]; then
log "Error: No package.json found in $build_dir"
return 1
fi
log "✓ Build directory verified: $build_dir"
return 0
}
# Function to build JS engine production output
build_js_engine() {
local build_dir="$1"
log "Building JS engine production output in $build_dir"
# Change to build directory
pushd "$build_dir" >/dev/null
# Install dependencies
log "Running npm ci to install dependencies..."
npm ci
# Build production output
log "Running npm run build to create production output..."
npm run build
# Verify dist directory was created
if [[ ! -d "dist" ]]; then
log "Error: dist directory not found after build"
popd >/dev/null
exit 1
fi
log "✓ JS engine built successfully"
# Return to original directory
popd >/dev/null
}
# Function to copy JS engine production output
copy_js_engine() {
local build_dir="$1"
local target_dir="$2"
log "Copying JS engine production output from $build_dir/dist to $target_dir"
# Create target directory if it doesn't exist
mkdir -p "$target_dir"
# Copy only the dist folder contents with proper permissions
cp -r "$build_dir/dist"/* "$target_dir/"
chmod -R 755 "$target_dir"
log "✓ JS engine production output copied successfully"
}
# Parse command line arguments
parse_args() {
local build_dir=""
local target_dir=""
local node_version="$NODE_VERSION" # Start with default/global value
while [[ $# -gt 0 ]]; do
case $1 in
-n | --node-version)
if [[ -z "${2:-}" ]] || [[ "$2" =~ ^- ]]; then
echo "Error: --node-version requires a version number"
exit 1
fi
node_version="$2"
echo "DEBUG: Setting NODE_VERSION to $node_version" >&2
shift 2
;;
-b | --build-dir)
if [[ -z "${2:-}" ]] || [[ "$2" =~ ^- ]]; then
echo "Error: --build-dir requires a directory path"
exit 1
fi
build_dir="$2"
shift 2
;;
-t | --target-dir)
if [[ -z "${2:-}" ]] || [[ "$2" =~ ^- ]]; then
echo "Error: --target-dir requires a directory path"
exit 1
fi
target_dir="$2"
shift 2
;;
-h | --help)
usage
;;
-*)
echo "Error: Unknown option: $1"
usage
;;
*)
echo "Error: Unexpected argument: $1"
echo "Use -t/--target-dir for target directory and -b/--build-dir for build directory"
usage
;;
esac
done
# Return all three values separated by delimiters
echo "${node_version}|${build_dir}|${target_dir}"
}
# Main execution
main() {
log "Starting JS Engine build script"
log "Arguments received: $*"
log "NODE_VERSION before parsing: $NODE_VERSION"
# Parse arguments
local args_result
local build_dir
local target_dir
args_result=$(parse_args "$@")
# Extract values: node_version|build_dir|target_dir
NODE_VERSION="${args_result%%|*}"
local remaining="${args_result#*|}"
build_dir="${remaining%%|*}"
target_dir="${remaining#*|}"
log "NODE_VERSION after parsing: $NODE_VERSION"
log "Build directory: $build_dir"
log "Target directory: $target_dir"
# Check if we need to install Node.js (skip if already installed and correct version)
if command -v node >/dev/null 2>&1; then
local current_version
local major_version
current_version=$(node -v | sed 's/v//')
major_version=$(echo "$current_version" | cut -d. -f1)
if [[ "$major_version" == "$NODE_VERSION" ]]; then
log "Node.js ${NODE_VERSION}.x already installed: v$current_version"
else
log "Different Node.js version detected: v$current_version. Installing Node.js ${NODE_VERSION}.x..."
check_root
install_nodejs
fi
else
log "Node.js not found. Installing Node.js ${NODE_VERSION}.x..."
check_root
install_nodejs
fi
verify_nodejs
log "Verifying build directory: $build_dir"
# Verify the build directory
if ! verify_build_dir "$build_dir"; then
log "Build directory verification failed"
exit 1
fi
log "Verified build directory"
# Build the JS engine production output
build_js_engine "$build_dir"
# Copy JS engine production output if target directory is specified
if [[ -n "$target_dir" ]]; then
copy_js_engine "$build_dir" "$target_dir"
else
log "No target directory specified. Skipping file copy."
log "Production output is available in: $build_dir/dist"
log "To copy files, use: $0 -t <target_directory>"
fi
log "JS Engine build script completed successfully"
}
# Run main function with all arguments
main "$@"

View File

@ -56,34 +56,15 @@ mkdir -p ./src/bin
mv "$MONGOD_PATH" ./src/bin/mongod mv "$MONGOD_PATH" ./src/bin/mongod
mv "$MONGO_PATH" ./src/bin/mongo mv "$MONGO_PATH" ./src/bin/mongo
# track asp-js-engine repo clone from evergreen modules
JS_ENGINE_PATH_ABS="$(pwd)"/src/asp-js-engine/asp-js-engine
cd src cd src
activate_venv activate_venv
setup_db_contrib_tool setup_db_contrib_tool
# Build docker build args array
BUILD_ARGS=(--build-arg "BUILD_VERSION=$GITSHA-$TAG_SUFFIX")
# Only add JS_ENGINE_PATH build arg if the path exists
# Note: Path must be relative to the build context (src directory)
if [ -d "$JS_ENGINE_PATH_ABS" ]; then
# Make path relative to src directory (current directory after cd src)
JS_ENGINE_PATH_REL="asp-js-engine/asp-js-engine"
echo "JS_ENGINE_PATH exists: $JS_ENGINE_PATH_ABS"
echo "Using relative path for Docker: $JS_ENGINE_PATH_REL"
BUILD_ARGS+=(--build-arg "JS_ENGINE_PATH=$JS_ENGINE_PATH_REL")
else
echo "JS_ENGINE_PATH does not exist: $JS_ENGINE_PATH_ABS (skipping build arg)"
fi
if [ "$DISTRO" == "amazon2" ]; then if [ "$DISTRO" == "amazon2" ]; then
docker build "${BUILD_ARGS[@]}" -t "$IMAGE" -f ./src/mongo/db/modules/enterprise/src/streams/build/Dockerfile . docker build --build-arg BUILD_VERSION=$GITSHA-$TAG_SUFFIX -t "$IMAGE" -f ./src/mongo/db/modules/enterprise/src/streams/build/Dockerfile .
else else
docker build "${BUILD_ARGS[@]}" -t "$IMAGE" -f ./src/mongo/db/modules/enterprise/src/streams/build/Dockerfile.al2023 . docker build --build-arg BUILD_VERSION=$GITSHA-$TAG_SUFFIX -t "$IMAGE" -f ./src/mongo/db/modules/enterprise/src/streams/build/Dockerfile.al2023 .
fi fi
docker tag "$IMAGE" "$IMAGE:$GITSHA-$TAG_SUFFIX" docker tag "$IMAGE" "$IMAGE:$GITSHA-$TAG_SUFFIX"
docker images docker images