SERVER-127034 fix mongo version on macos (#53989)

GitOrigin-RevId: 8e1417963aaf3488365d23403a46e84f7d5313b9
This commit is contained in:
Daniel Moody 2026-05-18 20:49:10 -05:00 committed by MongoDB Bot
parent a84c1db262
commit 89b618b12c
5 changed files with 26 additions and 6 deletions

View File

@ -111,7 +111,7 @@ function bazel_test_results::print_executor_logs() {
fi
local -r sorted_log_files=$(echo "${log_files}" | while IFS= read -r log_file; do
local shard_num=$(echo "${log_file}" | grep -oP 'shard_\K\d+(?=/)')
local shard_num=$(echo "${log_file}" | sed -n 's|.*shard_\([0-9][0-9]*\)/.*|\1|p')
echo "${shard_num} ${log_file}"
done | sort -n | cut -d' ' -f2-)
@ -149,7 +149,7 @@ function bazel_test_results::display_test_summary() {
IFS=$'\n' sorted_indices=($(
for i in "${sorted_indices[@]}"; do
local shard_num=$(echo "${_names[$i]}" | grep -oP 'shard_\K\d+$')
local shard_num=$(echo "${_names[$i]}" | sed -n 's|.*shard_\([0-9][0-9]*\)$|\1|p')
echo "${shard_num} ${i}"
done | sort -n | cut -d' ' -f2
))

View File

@ -8,4 +8,9 @@ set -o verbose
cd src
echo "common --define=MONGO_VERSION=5.1.0-alpha" >.bazelrc.target_mongo_version
echo "r$(grep -oP '(?<=MONGO_VERSION=)[^\s]+' .bazelrc.target_mongo_version)"
version=$(awk -F'MONGO_VERSION=' '/MONGO_VERSION=/ { split($2, version, /[[:space:]]/); print version[1]; exit }' .bazelrc.target_mongo_version)
if [[ -z "${version}" ]]; then
echo "Unable to extract MONGO_VERSION from .bazelrc.target_mongo_version" >&2
exit 1
fi
echo "r${version}"

View File

@ -7,7 +7,12 @@ set -o errexit
set -o verbose
# Extract version from .bazelrc.target_mongo_version (e.g., "common --define=MONGO_VERSION=8.3.0-rc1003")
MONGO_VERSION="r$(grep -oP '(?<=MONGO_VERSION=)[^\s]+' .bazelrc.target_mongo_version)"
target_mongo_version=$(awk -F'MONGO_VERSION=' '/MONGO_VERSION=/ { split($2, version, /[[:space:]]/); print version[1]; exit }' .bazelrc.target_mongo_version)
if [[ -z "${target_mongo_version}" ]]; then
echo "Unable to extract MONGO_VERSION from .bazelrc.target_mongo_version" >&2
exit 1
fi
MONGO_VERSION="r${target_mongo_version}"
# If the project is sys-perf (or related), add the string -sys-perf to the version
if [[ "${project}" == sys-perf* ]]; then

View File

@ -36,7 +36,12 @@ else
fi
if [[ "${requester}" == "commit" ]]; then
echo "common --define MONGO_VERSION=$(grep -oP 'MONGO_VERSION=\K.*' .bazelrc.target_mongo_version)-${GIT_REV: -8}" >>.bazelrc.git
mongo_version=$(awk -F'MONGO_VERSION=' '/MONGO_VERSION=/ { split($2, version, /[[:space:]]/); print version[1]; exit }' .bazelrc.target_mongo_version)
if [[ -z "${mongo_version}" ]]; then
echo "Unable to extract MONGO_VERSION from .bazelrc.target_mongo_version" >&2
exit 1
fi
echo "common --define MONGO_VERSION=${mongo_version}-${GIT_REV: -8}" >>.bazelrc.git
fi
if [[ "${evergreen_remote_exec}" != "on" ]]; then

View File

@ -4,7 +4,12 @@ set -o errexit
set -o verbose
# Extract version from .bazelrc.target_mongo_version (e.g., "common --define=MONGO_VERSION=8.2.2")
version="r$(grep -oP '(?<=MONGO_VERSION=)[^\s]+' .bazelrc.target_mongo_version)"
target_mongo_version=$(awk -F'MONGO_VERSION=' '/MONGO_VERSION=/ { split($2, version, /[[:space:]]/); print version[1]; exit }' .bazelrc.target_mongo_version)
if [[ -z "${target_mongo_version}" ]]; then
echo "Unable to extract MONGO_VERSION from .bazelrc.target_mongo_version" >&2
exit 1
fi
version="r${target_mongo_version}"
# For commit builds, append the last 8 characters of the git revision to the version string.
if [[ "${requester:-}" == "commit" ]]; then