Skip to content

Commit 12dc037

Browse files
BradshawzMongoDB Bot
authored andcommitted
SERVER-108960 [8.2] Fix missing git commit in version info for windows mongod (#39806)
GitOrigin-RevId: 7939a34a7480a8d40a4e31087de26d3a9526a505
1 parent 2d43d9c commit 12dc037

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

buildscripts/msi_validation.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# This script validates the msi can be installed, uninstalled, and checks for the default install location and some of the possible install files
22
import glob
33
import os
4+
import re
45
import subprocess
56
import sys
67
import tempfile
@@ -87,6 +88,8 @@ def validate_files(is_enterprise):
8788
print(f"File exists: {file_match[0]}")
8889
if file_match[0].endswith(".exe"):
8990
validate_help(file_match[0])
91+
if file_match[0].endswith("mongod.exe"):
92+
validate_version(file_match[0])
9093
else:
9194
print(f"Error: {file_path} could not be found.")
9295
sys.exit(1)
@@ -102,6 +105,24 @@ def validate_help(exe_path):
102105
print(f"Error while calling help for {exe_path}: {e}")
103106
sys.exit(1)
104107

108+
# Make sure we have a proper git version in the windows release
109+
def validate_version(exe_path):
110+
try:
111+
version_command = [exe_path, "--version"]
112+
print(f"Calling '{exe_path}' with command: {' '.join(version_command)}...")
113+
result = subprocess.run(version_command, check=True, stdout=subprocess.PIPE, text=True)
114+
print(f"{exe_path} called version successfully.")
115+
match = re.search('.*"gitVersion": "[0-9a-fA-F]{40}".*', result.stdout)
116+
if match:
117+
print("Found a valid git version.")
118+
return
119+
else:
120+
print("--version command did not contain a valid git version in gitVersion. Stdout:")
121+
print(result.stdout)
122+
sys.exit(1)
123+
except subprocess.CalledProcessError as e:
124+
print(f"Error while calling version for {exe_path}: {e}")
125+
sys.exit(1)
105126

106127
def main():
107128
if len(sys.argv) != 2:

evergreen/generate_evergreen_bazelrc.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ if [[ "$OSTYPE" == "cygwin" ]] || [[ "$OSTYPE" == "win32" ]]; then
2525
echo "common --action_env=TMP=Z:/bazel_tmp" >>.bazelrc.evergreen
2626
echo "common --action_env=TEMP=Z:/bazel_tmp" >>.bazelrc.evergreen
2727
echo "BAZELISK_HOME=${abs_path}/bazelisk_home" >>.bazeliskrc
28-
# echo "common --define GIT_COMMIT_HASH=$(git rev-parse HEAD)" >> .bazelrc.git
29-
echo "common --define GIT_COMMIT_HASH=nogitversion" >>.bazelrc.git
28+
echo "common --define GIT_COMMIT_HASH=$(git rev-parse HEAD)" >>.bazelrc.git
3029
else
3130
echo "startup --output_user_root=${TMPDIR}/bazel-output-root" >.bazelrc.evergreen
3231
echo "BAZELISK_HOME=${TMPDIR}/bazelisk_home" >>.bazeliskrc

0 commit comments

Comments
 (0)