SERVER-108960 [8.2] Fix missing git commit in version info for windows mongod (#39806)
GitOrigin-RevId: 7939a34a7480a8d40a4e31087de26d3a9526a505
This commit is contained in:
parent
2d43d9c8df
commit
12dc03761c
@ -1,6 +1,7 @@
|
||||
# This script validates the msi can be installed, uninstalled, and checks for the default install location and some of the possible install files
|
||||
import glob
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
@ -87,6 +88,8 @@ def validate_files(is_enterprise):
|
||||
print(f"File exists: {file_match[0]}")
|
||||
if file_match[0].endswith(".exe"):
|
||||
validate_help(file_match[0])
|
||||
if file_match[0].endswith("mongod.exe"):
|
||||
validate_version(file_match[0])
|
||||
else:
|
||||
print(f"Error: {file_path} could not be found.")
|
||||
sys.exit(1)
|
||||
@ -102,6 +105,24 @@ def validate_help(exe_path):
|
||||
print(f"Error while calling help for {exe_path}: {e}")
|
||||
sys.exit(1)
|
||||
|
||||
# Make sure we have a proper git version in the windows release
|
||||
def validate_version(exe_path):
|
||||
try:
|
||||
version_command = [exe_path, "--version"]
|
||||
print(f"Calling '{exe_path}' with command: {' '.join(version_command)}...")
|
||||
result = subprocess.run(version_command, check=True, stdout=subprocess.PIPE, text=True)
|
||||
print(f"{exe_path} called version successfully.")
|
||||
match = re.search('.*"gitVersion": "[0-9a-fA-F]{40}".*', result.stdout)
|
||||
if match:
|
||||
print("Found a valid git version.")
|
||||
return
|
||||
else:
|
||||
print("--version command did not contain a valid git version in gitVersion. Stdout:")
|
||||
print(result.stdout)
|
||||
sys.exit(1)
|
||||
except subprocess.CalledProcessError as e:
|
||||
print(f"Error while calling version for {exe_path}: {e}")
|
||||
sys.exit(1)
|
||||
|
||||
def main():
|
||||
if len(sys.argv) != 2:
|
||||
|
||||
@ -25,8 +25,7 @@ if [[ "$OSTYPE" == "cygwin" ]] || [[ "$OSTYPE" == "win32" ]]; then
|
||||
echo "common --action_env=TMP=Z:/bazel_tmp" >>.bazelrc.evergreen
|
||||
echo "common --action_env=TEMP=Z:/bazel_tmp" >>.bazelrc.evergreen
|
||||
echo "BAZELISK_HOME=${abs_path}/bazelisk_home" >>.bazeliskrc
|
||||
# echo "common --define GIT_COMMIT_HASH=$(git rev-parse HEAD)" >> .bazelrc.git
|
||||
echo "common --define GIT_COMMIT_HASH=nogitversion" >>.bazelrc.git
|
||||
echo "common --define GIT_COMMIT_HASH=$(git rev-parse HEAD)" >>.bazelrc.git
|
||||
else
|
||||
echo "startup --output_user_root=${TMPDIR}/bazel-output-root" >.bazelrc.evergreen
|
||||
echo "BAZELISK_HOME=${TMPDIR}/bazelisk_home" >>.bazeliskrc
|
||||
|
||||
Loading…
Reference in New Issue
Block a user