mirror of https://github.com/mongodb/mongo
SERVER-108655 Use our own architectures for naming the top level folder in release packages (#39603)
GitOrigin-RevId: bcda111700c4ecf2ca9cbb6b042bb800364de297
This commit is contained in:
parent
4aeccd2fd2
commit
9acc9d3df3
6
.bazelrc
6
.bazelrc
|
|
@ -474,9 +474,6 @@ common:fission --remote_download_regex=.*\.dwo$
|
|||
# Avoid failing builds when BES metadata fails to upload.
|
||||
common --bes_upload_mode=fully_async
|
||||
|
||||
# Default Mongo Version if a version is not specified.
|
||||
common --define=MONGO_VERSION=8.0.6
|
||||
|
||||
# Default distmod if not specified.
|
||||
common --define=MONGO_DISTMOD=""
|
||||
|
||||
|
|
@ -492,6 +489,9 @@ try-import %workspace%/.bazelrc.evergreen
|
|||
# local default dev settings
|
||||
try-import %workspace%/.bazelrc.common_bes
|
||||
|
||||
# local default dev settings
|
||||
try-import %workspace%/.bazelrc.mongo_variables
|
||||
|
||||
# local git version info
|
||||
try-import %workspace%/.bazelrc.git
|
||||
|
||||
|
|
|
|||
|
|
@ -282,17 +282,20 @@ buildozer
|
|||
.bazelrc.git
|
||||
.bazelrc.gitinfo
|
||||
.bazelrc.workstation
|
||||
.bazelrc.common_bes
|
||||
.bazelrc.mongo_variables
|
||||
.bazelrc.mongo_version
|
||||
.bazelrc.compiledb
|
||||
.bazelrc.sync
|
||||
.compiledb
|
||||
.bazelrc.xcode
|
||||
.bazelrc.bazelisk
|
||||
*.bazel_info_for_ninja.txt
|
||||
.ninja_last_command_line_targets.txt
|
||||
.bazelrc.common_bes
|
||||
.bazelrc.sync
|
||||
bazel/coverity/analysis/BUILD.bazel
|
||||
.bazel_include_info.json
|
||||
.bazel_header_list_cache
|
||||
.bazel_real
|
||||
.compiledb
|
||||
.mongo_checks_module_path
|
||||
|
||||
# generated configs for external fixture suites
|
||||
|
|
|
|||
14
BUILD.bazel
14
BUILD.bazel
|
|
@ -209,13 +209,13 @@ mongo_install(
|
|||
"//conditions:default": [],
|
||||
}),
|
||||
package_extract_name = select({
|
||||
"//bazel/config:build_enterprise_linux_enabled": "mongodb-linux-{TARGET_CPU}-enterprise-{MONGO_DISTMOD}-{MONGO_VERSION}",
|
||||
"//bazel/config:build_enterprise_linux_disabled": "mongodb-linux-{TARGET_CPU}-{MONGO_DISTMOD}-{MONGO_VERSION}",
|
||||
"//bazel/config:build_enterprise_windows_enabled": "mongodb-win32-{TARGET_CPU}-enterprise-{MONGO_DISTMOD}-{MONGO_VERSION}",
|
||||
"//bazel/config:build_enterprise_windows_disabled": "mongodb-win32-{TARGET_CPU}-{MONGO_DISTMOD}-{MONGO_VERSION}",
|
||||
"//bazel/config:build_enterprise_mac_enabled": "mongodb-macos-{TARGET_CPU}-enterprise-{MONGO_DISTMOD}-{MONGO_VERSION}",
|
||||
"//bazel/config:build_enterprise_mac_disabled": "mongodb-macos-{TARGET_CPU}-{MONGO_DISTMOD}-{MONGO_VERSION}",
|
||||
"//conditions:default": "mongodb-{TARGET_CPU}-{MONGO_DISTMOD}-{MONGO_VERSION}",
|
||||
"//bazel/config:build_enterprise_linux_enabled": "mongodb-linux-{MONGO_ARCH}-enterprise-{MONGO_DISTMOD}-{MONGO_VERSION}",
|
||||
"//bazel/config:build_enterprise_linux_disabled": "mongodb-linux-{MONGO_ARCH}-{MONGO_DISTMOD}-{MONGO_VERSION}",
|
||||
"//bazel/config:build_enterprise_windows_enabled": "mongodb-win32-{MONGO_ARCH}-enterprise-{MONGO_DISTMOD}-{MONGO_VERSION}",
|
||||
"//bazel/config:build_enterprise_windows_disabled": "mongodb-win32-{MONGO_ARCH}-{MONGO_DISTMOD}-{MONGO_VERSION}",
|
||||
"//bazel/config:build_enterprise_mac_enabled": "mongodb-macos-{MONGO_ARCH}-enterprise-{MONGO_DISTMOD}-{MONGO_VERSION}",
|
||||
"//bazel/config:build_enterprise_mac_disabled": "mongodb-macos-{MONGO_ARCH}-{MONGO_DISTMOD}-{MONGO_VERSION}",
|
||||
"//conditions:default": "mongodb-{MONGO_ARCH}-{MONGO_DISTMOD}-{MONGO_VERSION}",
|
||||
}),
|
||||
publish_debug_in_stripped = select({
|
||||
"@platforms//os:windows": True,
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ py_library(
|
|||
"install_modules.py",
|
||||
"lint.py",
|
||||
"plus_interface.py",
|
||||
"set_mongo_variables.py",
|
||||
"wrapper_debug.py",
|
||||
"wrapper_hook.py",
|
||||
],
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@ import sys
|
|||
REPO_ROOT = pathlib.Path(__file__).parent.parent.parent
|
||||
sys.path.append(str(REPO_ROOT))
|
||||
|
||||
from bazel.wrapper_hook.set_mongo_variables import write_mongo_variables_bazelrc
|
||||
|
||||
|
||||
def run_pty_command(cmd):
|
||||
stdout = None
|
||||
|
|
@ -43,6 +45,9 @@ def run_pty_command(cmd):
|
|||
|
||||
|
||||
def generate_compiledb(bazel_bin, persistent_compdb, enterprise):
|
||||
|
||||
# compiledb ignores command line args so just make a version rc file in anycase
|
||||
write_mongo_variables_bazelrc([])
|
||||
if persistent_compdb:
|
||||
info_proc = subprocess.run(
|
||||
[bazel_bin, "info", "output_base"], capture_output=True, text=True
|
||||
|
|
|
|||
|
|
@ -0,0 +1,45 @@
|
|||
import hashlib
|
||||
import os
|
||||
import pathlib
|
||||
import platform
|
||||
import subprocess
|
||||
|
||||
ARCH_NORMALIZE_MAP = {
|
||||
"amd64": "x86_64",
|
||||
"x86_64": "x86_64",
|
||||
"arm64": "aarch64",
|
||||
"aarch64": "aarch64",
|
||||
"ppc64le": "ppc64le",
|
||||
"s390x": "s390x",
|
||||
}
|
||||
|
||||
def get_mongo_arch(args):
|
||||
arch = platform.machine().lower()
|
||||
if arch in ARCH_NORMALIZE_MAP:
|
||||
return ARCH_NORMALIZE_MAP[arch]
|
||||
else:
|
||||
return arch
|
||||
|
||||
def get_mongo_version(args):
|
||||
proc = subprocess.run(["git", "describe", "--abbrev=0"], capture_output=True, text=True)
|
||||
return proc.stdout.strip()[1:]
|
||||
|
||||
def write_mongo_variables_bazelrc(args):
|
||||
mongo_version = get_mongo_version(args)
|
||||
mongo_arch = get_mongo_arch(args)
|
||||
|
||||
repo_root = pathlib.Path(os.path.abspath(__file__)).parent.parent.parent
|
||||
version_file = os.path.join(repo_root, ".bazelrc.mongo_variables")
|
||||
existing_hash = ""
|
||||
if os.path.exists(version_file):
|
||||
with open(version_file, encoding="utf-8") as f:
|
||||
existing_hash = hashlib.md5(f.read().encode()).hexdigest()
|
||||
|
||||
bazelrc_contents = f"""
|
||||
common --define=MONGO_ARCH={mongo_arch}
|
||||
common --define=MONGO_VERSION={mongo_version}
|
||||
"""
|
||||
current_hash = hashlib.md5(bazelrc_contents.encode()).hexdigest()
|
||||
if existing_hash != current_hash:
|
||||
with open(version_file, "w", encoding="utf-8") as f:
|
||||
f.write(bazelrc_contents)
|
||||
|
|
@ -25,6 +25,7 @@ def main():
|
|||
check_bazel_command_type,
|
||||
test_runner_interface,
|
||||
)
|
||||
from bazel.wrapper_hook.set_mongo_variables import write_mongo_variables_bazelrc
|
||||
|
||||
# This is used to autogenerate a BUILD.bazel that creates
|
||||
# Filegroups for select tags - used to group targets for installing
|
||||
|
|
@ -45,6 +46,8 @@ def main():
|
|||
|
||||
write_workstation_bazelrc(args)
|
||||
|
||||
write_mongo_variables_bazelrc(args)
|
||||
|
||||
args = test_runner_interface(
|
||||
sys.argv[1:],
|
||||
autocomplete_query=os.environ.get("MONGO_AUTOCOMPLETE_QUERY") == "1",
|
||||
|
|
|
|||
|
|
@ -164,6 +164,16 @@ VERSIONS_TO_SKIP: Set[str] = set(
|
|||
['3.0.15', '3.2.22', '3.4.24', '3.6.23', '4.0.28', '4.2.24', '6.3.2'])
|
||||
DISABLED_TESTS: Set[Tuple[str, str]] = set()
|
||||
|
||||
VALID_TAR_DIRECTORY_ARCHITECTURES = [
|
||||
"linux-aarch64",
|
||||
"linux-x86_64",
|
||||
"linux-ppc64le",
|
||||
"linux-s390x",
|
||||
"macos-aarch64",
|
||||
"macos-x86_64",
|
||||
"windows-x86_64",
|
||||
]
|
||||
|
||||
|
||||
@dataclasses.dataclass
|
||||
class Test:
|
||||
|
|
@ -401,6 +411,12 @@ def get_edition_alias(edition_name: str) -> str:
|
|||
return "org"
|
||||
return edition_name
|
||||
|
||||
def validate_top_level_directory(tar_name: str):
|
||||
command = f"tar -tf {tar_name} | head -n 1 | awk -F/ '{{print $1}}'"
|
||||
proc = subprocess.run(command, capture_output=True, shell=True, text=True)
|
||||
top_level_directory = proc.stdout.strip()
|
||||
if all(os_arch not in top_level_directory for os_arch in VALID_TAR_DIRECTORY_ARCHITECTURES):
|
||||
raise Exception(f"Found an unexpected os-arch pairing as the top level directory. Top level directory: {top_level_directory}")
|
||||
|
||||
arches: Set[str] = set()
|
||||
oses: Set[str] = set()
|
||||
|
|
@ -505,6 +521,8 @@ if args.command == "branch":
|
|||
Test(os_name=test_os, edition=args.edition, version=args.server_version,
|
||||
packages_urls=urls))
|
||||
|
||||
validate_top_level_directory("mongo-binaries.tgz")
|
||||
|
||||
if not args.skip_enterprise_check:
|
||||
logging.info(
|
||||
"Checking the source files used to build the binaries, use --skip-enterprise-check to skip this check."
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ set -o errexit
|
|||
set -o verbose
|
||||
|
||||
msi_filename=mongodb-${push_name}-${push_arch}-${suffix}.msi
|
||||
/usr/bin/find build/ -type f | grep msi$ | xargs -I original_filename cp original_filename $msi_filename || true
|
||||
cp bazel-bin/src/mongo/installer/msi/mongodb-win32-x86_64-windows-${version}.msi $msi_filename
|
||||
|
||||
# signing windows artifacts with jsign
|
||||
cat << 'EOF' > jsign_signing_commands.sh
|
||||
|
|
|
|||
Loading…
Reference in New Issue