diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 1233cd900d5..57d85f49da5 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -3051,5 +3051,8 @@ WORKSPACE.bazel @10gen/devprod-build @svc-auto-approve-bot # The following patterns are parsed from ./src/third_party/libmongocrypt/OWNERS.yml /src/third_party/libmongocrypt/**/* @10gen/server-security @svc-auto-approve-bot +# The following patterns are parsed from ./tools/lint/OWNERS.yml +/tools/lint/**/* @10gen/devprod-build @svc-auto-approve-bot + # The following patterns are parsed from ./x509/OWNERS.yml /x509/**/* @10gen/server-security @svc-auto-approve-bot diff --git a/MODULE.bazel b/MODULE.bazel index ca56288ea1a..082db8d525a 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -129,6 +129,12 @@ single_version_override( version = "6.4.0", ) +bazel_dep(name = "rules_multitool", version = "0.4.0") + +multitool = use_extension("@rules_multitool//multitool:extension.bzl", "multitool") +multitool.hub(lockfile = "//tools/lint:multitool.lock.json") +use_repo(multitool, "multitool") + # TODO port over from WORKSPACE # currently breaks pyright ##node = use_extension("@rules_nodejs//nodejs:extensions.bzl", "node", dev_dependency = True) diff --git a/bazel/BUILD.bazel b/bazel/BUILD.bazel index 3beed525c8d..72197537c63 100644 --- a/bazel/BUILD.bazel +++ b/bazel/BUILD.bazel @@ -11,3 +11,8 @@ sh_binary( srcs = ["lint.sh"], visibility = ["//visibility:public"], ) + +py_binary( + name = "bazelisk", + srcs = ["bazelisk.py"], +) diff --git a/bazel/coverity/BUILD.bazel b/bazel/coverity/BUILD.bazel index e69de29bb2d..7ce91449ad8 100644 --- a/bazel/coverity/BUILD.bazel +++ b/bazel/coverity/BUILD.bazel @@ -0,0 +1,5 @@ +py_binary( + name = "generate_coverity_command", + srcs = ["generate_coverity_command.py"], + visibility = ["//visibility:public"], +) diff --git a/bazel/lint.sh b/bazel/lint.sh index 5c27d7c49b3..186717a4cdb 100755 --- a/bazel/lint.sh +++ b/bazel/lint.sh @@ -1,8 +1,15 @@ # placeholder for bazel/wrapper_hook/lint.py + +RED='\033[0;31m' +GREEN='\033[0;32m' +NO_COLOR='\033[0m' + if [[ $1 == "ALL_PASSING" ]]; then - echo "No linter errors found!" + echo -e "${GREEN}INFO:${NO_COLOR} No linter errors found!" exit 0 fi -echo "Linter run failed, see details above" +echo -e "${RED}ERROR:${NO_COLOR} Linter run failed, see details above" +echo -e "${GREEN}INFO:${NO_COLOR} Run the following to try to auto-fix the errors:\n\nbazel run lint --fix" + exit 1 diff --git a/bazel/platforms/BUILD.bazel b/bazel/platforms/BUILD.bazel index e57b0b7a4ad..191a530eab5 100644 --- a/bazel/platforms/BUILD.bazel +++ b/bazel/platforms/BUILD.bazel @@ -146,3 +146,9 @@ platform( ":rhel9", ], ) + +py_binary( + name = "remote_execution_containers_generator", + srcs = ["remote_execution_containers_generator.py"], + visibility = ["//visibility:public"], +) diff --git a/bazel/toolchains/cc/mongo_linux/BUILD.bazel b/bazel/toolchains/cc/mongo_linux/BUILD.bazel index e69de29bb2d..359b4670069 100644 --- a/bazel/toolchains/cc/mongo_linux/BUILD.bazel +++ b/bazel/toolchains/cc/mongo_linux/BUILD.bazel @@ -0,0 +1,5 @@ +py_binary( + name = "mongo_toolchain_version_generator", + srcs = ["mongo_toolchain_version_generator.py"], + visibility = ["//visibility:public"], +) diff --git a/bazel/wrapper_hook/lint.py b/bazel/wrapper_hook/lint.py index 701ec23c3a7..6c0d661c05c 100644 --- a/bazel/wrapper_hook/lint.py +++ b/bazel/wrapper_hook/lint.py @@ -104,6 +104,10 @@ def list_files_without_targets( new_list = [] for file in all_typed_files: if file not in typed_files_in_targets_set and file not in exempt_list: + if "bazel_rules_mongo" in file: + # Skip files in bazel_rules_mongo, since it has its own Bazel repo + continue + new_list.append(file) if len(new_list) != 0: @@ -139,6 +143,11 @@ def run_rules_lint(bazel_bin: str, args: List[str]) -> bool: ): return False + if not list_files_without_targets( + files_with_targets, "python", "py", ["src/mongo", "buildscripts", "evergreen"] + ): + return False + # Default to linting everything if no path was passed in if len([arg for arg in args if not arg.startswith("--")]) == 0: args = ["//..."] + args @@ -147,7 +156,8 @@ def run_rules_lint(bazel_bin: str, args: List[str]) -> bool: with tempfile.NamedTemporaryFile(delete=False) as buildevents: buildevents_path = buildevents.name - args.append("--aspects=//tools/lint:linters.bzl%eslint") + for linter in ["eslint", "ruff"]: + args.append(f"--aspects=//tools/lint:linters.bzl%{linter}") args.extend( [ @@ -210,11 +220,16 @@ def run_rules_lint(bazel_bin: str, args: List[str]) -> bool: if "coverage.dat" in report or not os.path.exists(report) or not os.path.getsize(report): # Report is empty. No linting errors. continue - failing_reports += 1 - print(f"From {report}:") with open(report, "r", encoding="utf-8") as f: - print(f.read()) - print() + file_contents = f.read().strip() + if file_contents == "All checks passed!": + # Report is successful. No linting errors. + continue + + print(f"From {report}:") + print(file_contents) + print() + failing_reports += 1 # Apply fixes if requested if fix: diff --git a/buildscripts/BUILD.bazel b/buildscripts/BUILD.bazel index aa1b03f08b8..262d8fa9f42 100644 --- a/buildscripts/BUILD.bazel +++ b/buildscripts/BUILD.bazel @@ -251,3 +251,35 @@ sh_binary( name = "setup_node_env", srcs = ["setup_node_env.sh"], ) + +py_binary( + name = "evergreen_task_timeout", + srcs = ["evergreen_task_timeout.py"], + main = "evergreen_task_timeout.py", + visibility = ["//visibility:public"], + deps = [ + "//buildscripts/ciconfig", + "//buildscripts/resmoke_proxy", + "//buildscripts/timeouts:timeout_service", + "//evergreen:all_python_files", + dependency( + "evergreen-py", + group = "testing", + ), + dependency( + "pydantic", + group = "evergreen", + ), + dependency( + "inject", + group = "evergreen", + ), + ], +) + +# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets +py_library( + name = "all_python_files", + srcs = glob(["*.py"]), + visibility = ["//visibility:public"], +) diff --git a/buildscripts/ciconfig/BUILD.bazel b/buildscripts/ciconfig/BUILD.bazel index 699cd3a0a24..b80c6e14e2b 100644 --- a/buildscripts/ciconfig/BUILD.bazel +++ b/buildscripts/ciconfig/BUILD.bazel @@ -3,6 +3,7 @@ load("@poetry//:dependencies.bzl", "dependency") py_library( name = "ciconfig", srcs = [ + "__init__.py", "evergreen.py", ], visibility = ["//visibility:public"], diff --git a/buildscripts/client/BUILD.bazel b/buildscripts/client/BUILD.bazel new file mode 100644 index 00000000000..fa7edff1bc5 --- /dev/null +++ b/buildscripts/client/BUILD.bazel @@ -0,0 +1,6 @@ +# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets +py_library( + name = "all_python_files", + srcs = glob(["*.py"]), + visibility = ["//visibility:public"], +) diff --git a/buildscripts/cost_model/BUILD.bazel b/buildscripts/cost_model/BUILD.bazel new file mode 100644 index 00000000000..fa7edff1bc5 --- /dev/null +++ b/buildscripts/cost_model/BUILD.bazel @@ -0,0 +1,6 @@ +# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets +py_library( + name = "all_python_files", + srcs = glob(["*.py"]), + visibility = ["//visibility:public"], +) diff --git a/buildscripts/gdb/BUILD.bazel b/buildscripts/gdb/BUILD.bazel new file mode 100644 index 00000000000..fa7edff1bc5 --- /dev/null +++ b/buildscripts/gdb/BUILD.bazel @@ -0,0 +1,6 @@ +# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets +py_library( + name = "all_python_files", + srcs = glob(["*.py"]), + visibility = ["//visibility:public"], +) diff --git a/buildscripts/idl/BUILD.bazel b/buildscripts/idl/BUILD.bazel index b399f372438..b8d21d3e1b7 100644 --- a/buildscripts/idl/BUILD.bazel +++ b/buildscripts/idl/BUILD.bazel @@ -1,3 +1,5 @@ +load("@poetry//:dependencies.bzl", "dependency") + filegroup( name = "idlc", srcs = [ @@ -16,5 +18,65 @@ py_library( ] + glob(["idl/**/*.py"]), visibility = ["//visibility:public"], deps = [ + dependency( + "typer", + group = "core", + ), ], ) + +py_library( + name = "idl_compatibility_errors", + srcs = [ + "idl_compatibility_errors.py", + ], + visibility = ["//visibility:public"], +) + +py_binary( + name = "idl_check_compatibility", + srcs = [ + "idl_check_compatibility.py", + ], + main = "idl_check_compatibility.py", + visibility = ["//visibility:public"], + deps = [ + "idl_compatibility_errors", + ], +) + +py_binary( + name = "check_stable_api_commands_have_idl_definitions", + srcs = [ + "check_stable_api_commands_have_idl_definitions.py", + ], + main = "check_stable_api_commands_have_idl_definitions.py", + visibility = ["//visibility:public"], +) + +py_binary( + name = "checkout_idl_files_from_past_releases", + srcs = [ + "checkout_idl_files_from_past_releases.py", + ], + main = "checkout_idl_files_from_past_releases.py", + visibility = ["//visibility:public"], +) + +py_binary( + name = "gen_all_server_params_list", + srcs = [ + "gen_all_server_params_list.py", + ], + main = "gen_all_server_params_list.py", + visibility = ["//visibility:public"], +) + +py_binary( + name = "run_tests", + srcs = [ + "run_tests.py", + ], + main = "run_tests.py", + visibility = ["//visibility:public"], +) diff --git a/buildscripts/idl/check_stable_api_commands_have_idl_definitions.py b/buildscripts/idl/check_stable_api_commands_have_idl_definitions.py index e6573ed3e1b..58bc9445ac5 100644 --- a/buildscripts/idl/check_stable_api_commands_have_idl_definitions.py +++ b/buildscripts/idl/check_stable_api_commands_have_idl_definitions.py @@ -41,7 +41,6 @@ from pymongo import MongoClient # Permit imports from "buildscripts". sys.path.append(os.path.normpath(os.path.join(os.path.abspath(__file__), "../../.."))) - from idl import syntax from buildscripts.idl.lib import list_idls, parse_idl diff --git a/buildscripts/idl/tests/BUILD.bazel b/buildscripts/idl/tests/BUILD.bazel new file mode 100644 index 00000000000..fa7edff1bc5 --- /dev/null +++ b/buildscripts/idl/tests/BUILD.bazel @@ -0,0 +1,6 @@ +# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets +py_library( + name = "all_python_files", + srcs = glob(["*.py"]), + visibility = ["//visibility:public"], +) diff --git a/buildscripts/libdeps/BUILD.bazel b/buildscripts/libdeps/BUILD.bazel new file mode 100644 index 00000000000..fa7edff1bc5 --- /dev/null +++ b/buildscripts/libdeps/BUILD.bazel @@ -0,0 +1,6 @@ +# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets +py_library( + name = "all_python_files", + srcs = glob(["*.py"]), + visibility = ["//visibility:public"], +) diff --git a/buildscripts/linter/BUILD.bazel b/buildscripts/linter/BUILD.bazel index 6d5407af6c4..fe3d15ccc02 100644 --- a/buildscripts/linter/BUILD.bazel +++ b/buildscripts/linter/BUILD.bazel @@ -3,6 +3,7 @@ load("@poetry//:dependencies.bzl", "dependency") py_library( name = "linter", srcs = [ + "__init__.py", "base.py", "filediff.py", "git.py", diff --git a/buildscripts/lldb/BUILD.bazel b/buildscripts/lldb/BUILD.bazel new file mode 100644 index 00000000000..fa7edff1bc5 --- /dev/null +++ b/buildscripts/lldb/BUILD.bazel @@ -0,0 +1,6 @@ +# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets +py_library( + name = "all_python_files", + srcs = glob(["*.py"]), + visibility = ["//visibility:public"], +) diff --git a/buildscripts/monitor_build_status/BUILD.bazel b/buildscripts/monitor_build_status/BUILD.bazel new file mode 100644 index 00000000000..fa7edff1bc5 --- /dev/null +++ b/buildscripts/monitor_build_status/BUILD.bazel @@ -0,0 +1,6 @@ +# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets +py_library( + name = "all_python_files", + srcs = glob(["*.py"]), + visibility = ["//visibility:public"], +) diff --git a/buildscripts/patch_builds/BUILD.bazel b/buildscripts/patch_builds/BUILD.bazel index 18d977104a4..b7ffdb94442 100644 --- a/buildscripts/patch_builds/BUILD.bazel +++ b/buildscripts/patch_builds/BUILD.bazel @@ -17,3 +17,10 @@ py_library( ), ], ) + +# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets +py_library( + name = "all_python_files", + srcs = glob(["*.py"]), + visibility = ["//visibility:public"], +) diff --git a/buildscripts/resmoke_proxy/BUILD.bazel b/buildscripts/resmoke_proxy/BUILD.bazel new file mode 100644 index 00000000000..8c4d3bbd00b --- /dev/null +++ b/buildscripts/resmoke_proxy/BUILD.bazel @@ -0,0 +1,11 @@ +py_binary( + name = "resmoke_proxy", + srcs = [ + "__init__.py", + "resmoke_proxy.py", + ], + visibility = ["//visibility:public"], + deps = [ + "//buildscripts/resmokelib", + ], +) diff --git a/buildscripts/resmokelib/multiversionconstants.py b/buildscripts/resmokelib/multiversionconstants.py index 60cccc659a5..8cc95a51283 100644 --- a/buildscripts/resmokelib/multiversionconstants.py +++ b/buildscripts/resmokelib/multiversionconstants.py @@ -110,7 +110,7 @@ def in_spawn_host(): return False -if in_git_root_dir() and not in_spawn_host(): +if (in_git_root_dir() or "BUILD_WORKSPACE_DIRECTORY" in os.environ) and not in_spawn_host(): generate_mongo_version_file() else: LOGGER.info("Skipping generating mongo version file since we're not in the root of a git repo") diff --git a/buildscripts/s3_binary/hashes.py b/buildscripts/s3_binary/hashes.py index be8b2ffbb88..defc06c33d2 100644 --- a/buildscripts/s3_binary/hashes.py +++ b/buildscripts/s3_binary/hashes.py @@ -11,4 +11,11 @@ S3_SHA256_HASHES = { "https://mdb-build-public.s3.amazonaws.com/buildozer/v7.3.1/buildozer-linux-amd64": "3305e287b3fcc68b9a35fd8515ee617452cd4e018f9e6886b6c7cdbcba8710d4", "https://mdb-build-public.s3.amazonaws.com/buildozer/v7.3.1/buildozer-linux-arm64": "0b5a2a717ac4fc911e1fec8d92af71dbb4fe95b10e5213da0cc3d56cea64a328", "https://mdb-build-public.s3.amazonaws.com/buildozer/v7.3.1/buildozer-windows-amd64.exe": "58d41ce53257c5594c9bc86d769f580909269f68de114297f46284fbb9023dcf", + "https://mdb-build-public.s3.amazonaws.com/ruff/0.6.9/ruff-aarch64-apple-darwin.tar.gz": "b94562393a4bf23f1a48521f5495a8e48de885b7c173bd7ea8206d6d09921633", + "https://mdb-build-public.s3.amazonaws.com/ruff/0.6.9/ruff-aarch64-unknown-linux-musl.tar.gz": "73df3729a3381d0918e4640aac4b2653c542f74c7b7843dee8310e2c877e6f2e", + "https://mdb-build-public.s3.amazonaws.com/ruff/0.6.9/ruff-powerpc64le-unknown-linux-gnu.tar.gz": "6eedb853553ee52309e9519af775b3359a12227ec342404b6a033308cdd48b1b", + "https://mdb-build-public.s3.amazonaws.com/ruff/0.6.9/ruff-s390x-unknown-linux-gnu.tar.gz": "b4f93af861c1b3e1956df08e0d9f20b7e55cd7beb37c9df09b659908e920ebe6", + "https://mdb-build-public.s3.amazonaws.com/ruff/0.6.9/ruff-x86_64-apple-darwin.tar.gz": "34aa37643e30dcb81a3c0e011c3a8df552465ea7580ba92ca727a3b7c6de25d1", + "https://mdb-build-public.s3.amazonaws.com/ruff/0.6.9/ruff-x86_64-pc-windows-msvc.zip": "9d10e1282c5f695b2130cf593d55e37266513fc6d497edc4a30a6ed6d8ba4067", + "https://mdb-build-public.s3.amazonaws.com/ruff/0.6.9/ruff-x86_64-unknown-linux-musl.tar.gz": "39a1cd878962ebc88322b4f6d33cae2292454563028f93a3f1f8ce58e3025b07", } diff --git a/buildscripts/smoke_tests/BUILD.bazel b/buildscripts/smoke_tests/BUILD.bazel new file mode 100644 index 00000000000..fa7edff1bc5 --- /dev/null +++ b/buildscripts/smoke_tests/BUILD.bazel @@ -0,0 +1,6 @@ +# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets +py_library( + name = "all_python_files", + srcs = glob(["*.py"]), + visibility = ["//visibility:public"], +) diff --git a/buildscripts/testmatrix/BUILD.bazel b/buildscripts/testmatrix/BUILD.bazel new file mode 100644 index 00000000000..fa7edff1bc5 --- /dev/null +++ b/buildscripts/testmatrix/BUILD.bazel @@ -0,0 +1,6 @@ +# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets +py_library( + name = "all_python_files", + srcs = glob(["*.py"]), + visibility = ["//visibility:public"], +) diff --git a/buildscripts/tests/BUILD.bazel b/buildscripts/tests/BUILD.bazel index 1ced62d2086..6556cc516ef 100644 --- a/buildscripts/tests/BUILD.bazel +++ b/buildscripts/tests/BUILD.bazel @@ -17,3 +17,10 @@ mongo_toolchain_py_cxx_test( ), ], ) + +# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets +py_library( + name = "all_python_files", + srcs = glob(["*.py"]), + visibility = ["//visibility:public"], +) diff --git a/buildscripts/tests/burn_in_tests_end2end/BUILD.bazel b/buildscripts/tests/burn_in_tests_end2end/BUILD.bazel new file mode 100644 index 00000000000..fa7edff1bc5 --- /dev/null +++ b/buildscripts/tests/burn_in_tests_end2end/BUILD.bazel @@ -0,0 +1,6 @@ +# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets +py_library( + name = "all_python_files", + srcs = glob(["*.py"]), + visibility = ["//visibility:public"], +) diff --git a/buildscripts/tests/ciconfig/BUILD.bazel b/buildscripts/tests/ciconfig/BUILD.bazel new file mode 100644 index 00000000000..38d24f5675b --- /dev/null +++ b/buildscripts/tests/ciconfig/BUILD.bazel @@ -0,0 +1,11 @@ +py_test( + name = "test_evergreen", + srcs = [ + "__init__.py", + "test_evergreen.py", + ], + visibility = ["//visibility:public"], + deps = [ + "//buildscripts/ciconfig", + ], +) diff --git a/buildscripts/tests/monitor_build_status/BUILD.bazel b/buildscripts/tests/monitor_build_status/BUILD.bazel new file mode 100644 index 00000000000..fa7edff1bc5 --- /dev/null +++ b/buildscripts/tests/monitor_build_status/BUILD.bazel @@ -0,0 +1,6 @@ +# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets +py_library( + name = "all_python_files", + srcs = glob(["*.py"]), + visibility = ["//visibility:public"], +) diff --git a/buildscripts/tests/patch_builds/BUILD.bazel b/buildscripts/tests/patch_builds/BUILD.bazel new file mode 100644 index 00000000000..fa7edff1bc5 --- /dev/null +++ b/buildscripts/tests/patch_builds/BUILD.bazel @@ -0,0 +1,6 @@ +# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets +py_library( + name = "all_python_files", + srcs = glob(["*.py"]), + visibility = ["//visibility:public"], +) diff --git a/buildscripts/tests/resmoke_end2end/BUILD.bazel b/buildscripts/tests/resmoke_end2end/BUILD.bazel new file mode 100644 index 00000000000..fa7edff1bc5 --- /dev/null +++ b/buildscripts/tests/resmoke_end2end/BUILD.bazel @@ -0,0 +1,6 @@ +# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets +py_library( + name = "all_python_files", + srcs = glob(["*.py"]), + visibility = ["//visibility:public"], +) diff --git a/buildscripts/tests/resmoke_end2end/failtestfiles/BUILD.bazel b/buildscripts/tests/resmoke_end2end/failtestfiles/BUILD.bazel new file mode 100644 index 00000000000..fa7edff1bc5 --- /dev/null +++ b/buildscripts/tests/resmoke_end2end/failtestfiles/BUILD.bazel @@ -0,0 +1,6 @@ +# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets +py_library( + name = "all_python_files", + srcs = glob(["*.py"]), + visibility = ["//visibility:public"], +) diff --git a/buildscripts/tests/resmoke_proxy/BUILD.bazel b/buildscripts/tests/resmoke_proxy/BUILD.bazel new file mode 100644 index 00000000000..fa7edff1bc5 --- /dev/null +++ b/buildscripts/tests/resmoke_proxy/BUILD.bazel @@ -0,0 +1,6 @@ +# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets +py_library( + name = "all_python_files", + srcs = glob(["*.py"]), + visibility = ["//visibility:public"], +) diff --git a/buildscripts/tests/resmoke_validation/BUILD.bazel b/buildscripts/tests/resmoke_validation/BUILD.bazel new file mode 100644 index 00000000000..c8145434c4d --- /dev/null +++ b/buildscripts/tests/resmoke_validation/BUILD.bazel @@ -0,0 +1,49 @@ +load("@poetry//:dependencies.bzl", "dependency") + +py_test( + name = "test_suites_configurations", + srcs = ["test_suites_configurations.py"], + visibility = ["//visibility:public"], + deps = [ + "//buildscripts/resmokelib", + ], +) + +py_test( + name = "test_find_suites", + srcs = ["test_find_suites.py"], + visibility = ["//visibility:public"], + deps = [ + "//buildscripts/resmokelib", + ], +) + +py_test( + name = "test_generated_matrix_suites", + srcs = ["test_generated_matrix_suites.py"], + visibility = ["//visibility:public"], + deps = [ + "//buildscripts/resmokelib", + "//buildscripts/resmokelib/logging", + ], +) + +py_test( + name = "test_jstest_tags", + srcs = ["test_jstest_tags.py"], + visibility = ["//visibility:public"], + deps = [ + "//buildscripts/idl", + "//buildscripts/resmokelib", + ], +) + +py_test( + name = "test_matrix_suite_generation", + srcs = ["test_matrix_suite_generation.py"], + visibility = ["//visibility:public"], + deps = [ + "//buildscripts/resmokelib", + "//buildscripts/resmokelib/logging", + ], +) diff --git a/buildscripts/tests/resmoke_validation/test_jstest_tags.py b/buildscripts/tests/resmoke_validation/test_jstest_tags.py index 2d417076bef..6231d374529 100644 --- a/buildscripts/tests/resmoke_validation/test_jstest_tags.py +++ b/buildscripts/tests/resmoke_validation/test_jstest_tags.py @@ -1,5 +1,6 @@ import glob import json +import os import unittest from collections import defaultdict from typing import Optional @@ -57,6 +58,7 @@ class RequiresFcvTagRule(JstestTagRule): class TestJstestTags(unittest.TestCase): def test_jstest_tags(self): + os.chdir(os.environ.get("BUILD_WORKSPACE_DIRECTORY", ".")) globs = ["src/mongo/db/modules/enterprise/jstests/**/*.js", "jstests/**/*.js"] tag_rules = [ diff --git a/buildscripts/tests/resmoke_validation/tests/BUILD.bazel b/buildscripts/tests/resmoke_validation/tests/BUILD.bazel new file mode 100644 index 00000000000..9aa6b9d9951 --- /dev/null +++ b/buildscripts/tests/resmoke_validation/tests/BUILD.bazel @@ -0,0 +1,5 @@ +py_test( + name = "python_test", + srcs = ["python_test.py"], + visibility = ["//visibility:public"], +) diff --git a/buildscripts/tests/resmokelib/BUILD.bazel b/buildscripts/tests/resmokelib/BUILD.bazel new file mode 100644 index 00000000000..fa7edff1bc5 --- /dev/null +++ b/buildscripts/tests/resmokelib/BUILD.bazel @@ -0,0 +1,6 @@ +# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets +py_library( + name = "all_python_files", + srcs = glob(["*.py"]), + visibility = ["//visibility:public"], +) diff --git a/buildscripts/tests/resmokelib/core/BUILD.bazel b/buildscripts/tests/resmokelib/core/BUILD.bazel new file mode 100644 index 00000000000..fa7edff1bc5 --- /dev/null +++ b/buildscripts/tests/resmokelib/core/BUILD.bazel @@ -0,0 +1,6 @@ +# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets +py_library( + name = "all_python_files", + srcs = glob(["*.py"]), + visibility = ["//visibility:public"], +) diff --git a/buildscripts/tests/resmokelib/discovery/BUILD.bazel b/buildscripts/tests/resmokelib/discovery/BUILD.bazel new file mode 100644 index 00000000000..826a77194d3 --- /dev/null +++ b/buildscripts/tests/resmokelib/discovery/BUILD.bazel @@ -0,0 +1,12 @@ +py_test( + name = "test_discovery", + srcs = [ + "__init__.py", + "test_discovery.py", + ], + visibility = ["//visibility:public"], + deps = [ + "//buildscripts/resmokelib", + "//buildscripts/resmokelib/logging", + ], +) diff --git a/buildscripts/tests/resmokelib/hang_analyzer/BUILD.bazel b/buildscripts/tests/resmokelib/hang_analyzer/BUILD.bazel new file mode 100644 index 00000000000..fa7edff1bc5 --- /dev/null +++ b/buildscripts/tests/resmokelib/hang_analyzer/BUILD.bazel @@ -0,0 +1,6 @@ +# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets +py_library( + name = "all_python_files", + srcs = glob(["*.py"]), + visibility = ["//visibility:public"], +) diff --git a/buildscripts/tests/resmokelib/logging/BUILD.bazel b/buildscripts/tests/resmokelib/logging/BUILD.bazel new file mode 100644 index 00000000000..fa7edff1bc5 --- /dev/null +++ b/buildscripts/tests/resmokelib/logging/BUILD.bazel @@ -0,0 +1,6 @@ +# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets +py_library( + name = "all_python_files", + srcs = glob(["*.py"]), + visibility = ["//visibility:public"], +) diff --git a/buildscripts/tests/resmokelib/multiversion/BUILD.bazel b/buildscripts/tests/resmokelib/multiversion/BUILD.bazel new file mode 100644 index 00000000000..fa7edff1bc5 --- /dev/null +++ b/buildscripts/tests/resmokelib/multiversion/BUILD.bazel @@ -0,0 +1,6 @@ +# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets +py_library( + name = "all_python_files", + srcs = glob(["*.py"]), + visibility = ["//visibility:public"], +) diff --git a/buildscripts/tests/resmokelib/powercycle/BUILD.bazel b/buildscripts/tests/resmokelib/powercycle/BUILD.bazel new file mode 100644 index 00000000000..fa7edff1bc5 --- /dev/null +++ b/buildscripts/tests/resmokelib/powercycle/BUILD.bazel @@ -0,0 +1,6 @@ +# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets +py_library( + name = "all_python_files", + srcs = glob(["*.py"]), + visibility = ["//visibility:public"], +) diff --git a/buildscripts/tests/resmokelib/run/BUILD.bazel b/buildscripts/tests/resmokelib/run/BUILD.bazel new file mode 100644 index 00000000000..fa7edff1bc5 --- /dev/null +++ b/buildscripts/tests/resmokelib/run/BUILD.bazel @@ -0,0 +1,6 @@ +# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets +py_library( + name = "all_python_files", + srcs = glob(["*.py"]), + visibility = ["//visibility:public"], +) diff --git a/buildscripts/tests/resmokelib/setup_multiversion/BUILD.bazel b/buildscripts/tests/resmokelib/setup_multiversion/BUILD.bazel new file mode 100644 index 00000000000..fa7edff1bc5 --- /dev/null +++ b/buildscripts/tests/resmokelib/setup_multiversion/BUILD.bazel @@ -0,0 +1,6 @@ +# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets +py_library( + name = "all_python_files", + srcs = glob(["*.py"]), + visibility = ["//visibility:public"], +) diff --git a/buildscripts/tests/resmokelib/testing/BUILD.bazel b/buildscripts/tests/resmokelib/testing/BUILD.bazel new file mode 100644 index 00000000000..fa7edff1bc5 --- /dev/null +++ b/buildscripts/tests/resmokelib/testing/BUILD.bazel @@ -0,0 +1,6 @@ +# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets +py_library( + name = "all_python_files", + srcs = glob(["*.py"]), + visibility = ["//visibility:public"], +) diff --git a/buildscripts/tests/resmokelib/testing/fixtures/BUILD.bazel b/buildscripts/tests/resmokelib/testing/fixtures/BUILD.bazel new file mode 100644 index 00000000000..fa7edff1bc5 --- /dev/null +++ b/buildscripts/tests/resmokelib/testing/fixtures/BUILD.bazel @@ -0,0 +1,6 @@ +# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets +py_library( + name = "all_python_files", + srcs = glob(["*.py"]), + visibility = ["//visibility:public"], +) diff --git a/buildscripts/tests/resmokelib/testing/hooks/BUILD.bazel b/buildscripts/tests/resmokelib/testing/hooks/BUILD.bazel new file mode 100644 index 00000000000..fa7edff1bc5 --- /dev/null +++ b/buildscripts/tests/resmokelib/testing/hooks/BUILD.bazel @@ -0,0 +1,6 @@ +# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets +py_library( + name = "all_python_files", + srcs = glob(["*.py"]), + visibility = ["//visibility:public"], +) diff --git a/buildscripts/tests/resmokelib/testing/testcases/BUILD.bazel b/buildscripts/tests/resmokelib/testing/testcases/BUILD.bazel new file mode 100644 index 00000000000..fa7edff1bc5 --- /dev/null +++ b/buildscripts/tests/resmokelib/testing/testcases/BUILD.bazel @@ -0,0 +1,6 @@ +# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets +py_library( + name = "all_python_files", + srcs = glob(["*.py"]), + visibility = ["//visibility:public"], +) diff --git a/buildscripts/tests/resmokelib/utils/BUILD.bazel b/buildscripts/tests/resmokelib/utils/BUILD.bazel new file mode 100644 index 00000000000..fa7edff1bc5 --- /dev/null +++ b/buildscripts/tests/resmokelib/utils/BUILD.bazel @@ -0,0 +1,6 @@ +# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets +py_library( + name = "all_python_files", + srcs = glob(["*.py"]), + visibility = ["//visibility:public"], +) diff --git a/buildscripts/tests/sbom_linter/BUILD.bazel b/buildscripts/tests/sbom_linter/BUILD.bazel new file mode 100644 index 00000000000..2f3acd8479c --- /dev/null +++ b/buildscripts/tests/sbom_linter/BUILD.bazel @@ -0,0 +1,5 @@ +py_binary( + name = "test_sbom", + srcs = ["test_sbom.py"], + visibility = ["//visibility:public"], +) diff --git a/buildscripts/tests/timeouts/BUILD.bazel b/buildscripts/tests/timeouts/BUILD.bazel new file mode 100644 index 00000000000..fa7edff1bc5 --- /dev/null +++ b/buildscripts/tests/timeouts/BUILD.bazel @@ -0,0 +1,6 @@ +# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets +py_library( + name = "all_python_files", + srcs = glob(["*.py"]), + visibility = ["//visibility:public"], +) diff --git a/buildscripts/tests/util/BUILD.bazel b/buildscripts/tests/util/BUILD.bazel new file mode 100644 index 00000000000..fa7edff1bc5 --- /dev/null +++ b/buildscripts/tests/util/BUILD.bazel @@ -0,0 +1,6 @@ +# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets +py_library( + name = "all_python_files", + srcs = glob(["*.py"]), + visibility = ["//visibility:public"], +) diff --git a/buildscripts/timeouts/BUILD.bazel b/buildscripts/timeouts/BUILD.bazel new file mode 100644 index 00000000000..80f0e442788 --- /dev/null +++ b/buildscripts/timeouts/BUILD.bazel @@ -0,0 +1,34 @@ +load("@poetry//:dependencies.bzl", "dependency") + +py_library( + name = "timeout", + srcs = ["timeout.py"], + visibility = ["//visibility:public"], + deps = [ + dependency( + "shrub-py", + group = "testing", + ), + ], +) + +py_library( + name = "timeout_service", + srcs = ["timeout_service.py"], + visibility = ["//visibility:public"], + deps = [ + "timeout", + "//buildscripts/resmoke_proxy", + dependency( + "inject", + group = "evergreen", + ), + ], +) + +# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets +py_library( + name = "all_python_files", + srcs = glob(["*.py"]), + visibility = ["//visibility:public"], +) diff --git a/buildscripts/tracing_profiler/BUILD.bazel b/buildscripts/tracing_profiler/BUILD.bazel new file mode 100644 index 00000000000..fa7edff1bc5 --- /dev/null +++ b/buildscripts/tracing_profiler/BUILD.bazel @@ -0,0 +1,6 @@ +# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets +py_library( + name = "all_python_files", + srcs = glob(["*.py"]), + visibility = ["//visibility:public"], +) diff --git a/buildscripts/util/BUILD.bazel b/buildscripts/util/BUILD.bazel index 0dc6f6b231c..c714de7a35f 100644 --- a/buildscripts/util/BUILD.bazel +++ b/buildscripts/util/BUILD.bazel @@ -3,6 +3,7 @@ load("@poetry//:dependencies.bzl", "dependency") py_library( name = "util", srcs = [ + "__init__.py", "buildozer_utils.py", "cedar_report.py", "cmdutils.py", diff --git a/evergreen/BUILD.bazel b/evergreen/BUILD.bazel index 9abbef92e22..0cdc35b5993 100644 --- a/evergreen/BUILD.bazel +++ b/evergreen/BUILD.bazel @@ -560,3 +560,17 @@ sh_binary( name = "write_mongo_binary_url_to_downstream_expansions", srcs = ["write_mongo_binary_url_to_downstream_expansions.sh"], ) + +py_binary( + name = "macos_notary", + srcs = ["macos_notary.py"], + main = "macos_notary.py", + visibility = ["//visibility:public"], +) + +# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets +py_library( + name = "all_python_files", + srcs = glob(["*.py"]), + visibility = ["//visibility:public"], +) diff --git a/evergreen/functions/BUILD.bazel b/evergreen/functions/BUILD.bazel index 6ae2124ac8b..e45ebbe81fd 100644 --- a/evergreen/functions/BUILD.bazel +++ b/evergreen/functions/BUILD.bazel @@ -124,3 +124,10 @@ sh_binary( name = "wiredtiger_develop_use", srcs = ["wiredtiger_develop_use.sh"], ) + +# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets +py_library( + name = "all_python_files", + srcs = glob(["*.py"]), + visibility = ["//visibility:public"], +) diff --git a/evergreen/spawnhost/BUILD.bazel b/evergreen/spawnhost/BUILD.bazel new file mode 100644 index 00000000000..fa7edff1bc5 --- /dev/null +++ b/evergreen/spawnhost/BUILD.bazel @@ -0,0 +1,6 @@ +# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets +py_library( + name = "all_python_files", + srcs = glob(["*.py"]), + visibility = ["//visibility:public"], +) diff --git a/pyproject.toml b/pyproject.toml index 23c3d39378d..88208d22c3b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -213,6 +213,9 @@ ignore = [ "F822", # undefined-export ] +[tool.ruff.lint.isort] +known-first-party = ["buildscripts", "buildscripts/idl", "evergreen"] + [tool.pyright] include = [ "buildscripts", diff --git a/src/mongo/db/concurrency/BUILD.bazel b/src/mongo/db/concurrency/BUILD.bazel index 7c5ff18964a..ae70f6711a4 100644 --- a/src/mongo/db/concurrency/BUILD.bazel +++ b/src/mongo/db/concurrency/BUILD.bazel @@ -164,3 +164,8 @@ mongo_cc_benchmark( "//src/mongo/db:service_context", ], ) + +py_binary( + name = "lock_gdb_test", + srcs = ["lock_gdb_test.py"], +) diff --git a/src/mongo/db/fts/unicode/BUILD.bazel b/src/mongo/db/fts/unicode/BUILD.bazel index 9ff29324c46..99e31788b91 100644 --- a/src/mongo/db/fts/unicode/BUILD.bazel +++ b/src/mongo/db/fts/unicode/BUILD.bazel @@ -92,3 +92,8 @@ mongo_cc_unit_test( ":unicode", ], ) + +py_binary( + name = "gen_diacritic_map", + srcs = ["gen_diacritic_map.py"], +) diff --git a/src/mongo/db/query/query_tester/scripts/BUILD.bazel b/src/mongo/db/query/query_tester/scripts/BUILD.bazel new file mode 100644 index 00000000000..d708920f051 --- /dev/null +++ b/src/mongo/db/query/query_tester/scripts/BUILD.bazel @@ -0,0 +1,16 @@ +package(default_visibility = ["//visibility:public"]) + +py_library( + name = "utils", + srcs = ["utils.py"], +) + +py_binary( + name = "extract_failed_test_to_pickle", + srcs = ["extract_failed_test_to_pickle.py"], +) + +py_binary( + name = "extract_pickle_to_json", + srcs = ["extract_pickle_to_json.py"], +) diff --git a/src/mongo/db/query/query_tester/tests/BUILD.bazel b/src/mongo/db/query/query_tester/tests/BUILD.bazel new file mode 100644 index 00000000000..fa7edff1bc5 --- /dev/null +++ b/src/mongo/db/query/query_tester/tests/BUILD.bazel @@ -0,0 +1,6 @@ +# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets +py_library( + name = "all_python_files", + srcs = glob(["*.py"]), + visibility = ["//visibility:public"], +) diff --git a/src/mongo/db/query/query_tester/tests/scripts/BUILD.bazel b/src/mongo/db/query/query_tester/tests/scripts/BUILD.bazel new file mode 100644 index 00000000000..8d13dd79a6d --- /dev/null +++ b/src/mongo/db/query/query_tester/tests/scripts/BUILD.bazel @@ -0,0 +1,17 @@ +py_binary( + name = "overwrite_results", + srcs = [ + "overwrite_results.py", + ], + main = "overwrite_results.py", + visibility = ["//visibility:public"], +) + +py_binary( + name = "setup_repro_env", + srcs = [ + "setup_repro_env.py", + ], + main = "setup_repro_env.py", + visibility = ["//visibility:public"], +) diff --git a/src/mongo/db/query/query_tester/tests/selfTests/BUILD.bazel b/src/mongo/db/query/query_tester/tests/selfTests/BUILD.bazel new file mode 100644 index 00000000000..fa7edff1bc5 --- /dev/null +++ b/src/mongo/db/query/query_tester/tests/selfTests/BUILD.bazel @@ -0,0 +1,6 @@ +# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets +py_library( + name = "all_python_files", + srcs = glob(["*.py"]), + visibility = ["//visibility:public"], +) diff --git a/src/mongo/db/query/query_tester/tests/selfTests/testlib/BUILD.bazel b/src/mongo/db/query/query_tester/tests/selfTests/testlib/BUILD.bazel new file mode 100644 index 00000000000..fa7edff1bc5 --- /dev/null +++ b/src/mongo/db/query/query_tester/tests/selfTests/testlib/BUILD.bazel @@ -0,0 +1,6 @@ +# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets +py_library( + name = "all_python_files", + srcs = glob(["*.py"]), + visibility = ["//visibility:public"], +) diff --git a/src/mongo/db/query/stage_builder/sbe/abt/BUILD.bazel b/src/mongo/db/query/stage_builder/sbe/abt/BUILD.bazel index 59884120b04..095e80ea297 100644 --- a/src/mongo/db/query/stage_builder/sbe/abt/BUILD.bazel +++ b/src/mongo/db/query/stage_builder/sbe/abt/BUILD.bazel @@ -55,3 +55,8 @@ mongo_cc_binary( "//src/mongo/db/query/stage_builder/sbe:abt_unit_test_utils", ], ) + +py_binary( + name = "optimizer_gdb_test", + srcs = ["optimizer_gdb_test.py"], +) diff --git a/src/mongo/tools/workload_simulation/BUILD.bazel b/src/mongo/tools/workload_simulation/BUILD.bazel index 657440b18c9..dc3f8d75cc0 100644 --- a/src/mongo/tools/workload_simulation/BUILD.bazel +++ b/src/mongo/tools/workload_simulation/BUILD.bazel @@ -75,3 +75,9 @@ mongo_cc_unit_test( "//src/mongo/unittest", ], ) + +py_binary( + name = "process_logs", + srcs = ["process_logs.py"], + visibility = ["//visibility:public"], +) diff --git a/src/mongo/util/BUILD.bazel b/src/mongo/util/BUILD.bazel index bfdc35c98a4..b31c676fc9e 100644 --- a/src/mongo/util/BUILD.bazel +++ b/src/mongo/util/BUILD.bazel @@ -1275,3 +1275,9 @@ mongo_cc_library( "packaged_task.h", ], ) + +py_binary( + name = "pretty_printer_test", + srcs = ["pretty_printer_test.py"], + visibility = ["//visibility:public"], +) diff --git a/src/third_party/opentelemetry-cpp/api/BUILD b/src/third_party/opentelemetry-cpp/api/BUILD index dbc3b1d452e..48e6d1085fa 100644 --- a/src/third_party/opentelemetry-cpp/api/BUILD +++ b/src/third_party/opentelemetry-cpp/api/BUILD @@ -62,12 +62,6 @@ config_setting( flag_values = {":with_cxx_stdlib": "best"}, ) -bool_flag( - name = "with_abseil", - build_setting_default = False, - deprecation = "The value of this flag is ignored. Bazel builds always depend on Abseil for its pre-adopted `std::` types. You should remove this flag from your build command.", -) - int_flag( name = "abi_version_no", build_setting_default = 1, diff --git a/tools/lint/OWNERS.yml b/tools/lint/OWNERS.yml new file mode 100644 index 00000000000..1baf21091bc --- /dev/null +++ b/tools/lint/OWNERS.yml @@ -0,0 +1,5 @@ +version: 1.0.0 +filters: + - "*": + approvers: + - 10gen/devprod-build diff --git a/tools/lint/linters.bzl b/tools/lint/linters.bzl index 1340b295031..f81afeda0b2 100644 --- a/tools/lint/linters.bzl +++ b/tools/lint/linters.bzl @@ -2,6 +2,7 @@ load("@aspect_rules_lint//lint:eslint.bzl", "lint_eslint_aspect") load("@aspect_rules_lint//lint:lint_test.bzl", "lint_test") +load("@aspect_rules_lint//lint:ruff.bzl", "lint_ruff_aspect") eslint = lint_eslint_aspect( binary = Label("@//tools/lint:eslint"), @@ -11,3 +12,10 @@ eslint = lint_eslint_aspect( ) eslint_test = lint_test(aspect = eslint) + +ruff = lint_ruff_aspect( + binary = "@multitool//tools/ruff", + configs = [ + Label("//:pyproject.toml"), + ], +) diff --git a/tools/lint/multitool.lock.json b/tools/lint/multitool.lock.json new file mode 100644 index 00000000000..f221469740b --- /dev/null +++ b/tools/lint/multitool.lock.json @@ -0,0 +1,39 @@ +{ + "$schema": "https://raw.githubusercontent.com/theoremlp/rules_multitool/main/lockfile.schema.json", + "ruff": { + "binaries": [ + { + "kind": "archive", + "url": "https://mdb-build-public.s3.amazonaws.com/ruff/0.6.9/ruff-aarch64-unknown-linux-musl.tar.gz", + "file": "ruff-aarch64-unknown-linux-musl/ruff", + "sha256": "73df3729a3381d0918e4640aac4b2653c542f74c7b7843dee8310e2c877e6f2e", + "os": "linux", + "cpu": "arm64" + }, + { + "kind": "archive", + "url": "https://mdb-build-public.s3.amazonaws.com/ruff/0.6.9/ruff-x86_64-unknown-linux-musl.tar.gz", + "file": "ruff-x86_64-unknown-linux-musl/ruff", + "sha256": "39a1cd878962ebc88322b4f6d33cae2292454563028f93a3f1f8ce58e3025b07", + "os": "linux", + "cpu": "x86_64" + }, + { + "kind": "archive", + "url": "https://mdb-build-public.s3.amazonaws.com/ruff/0.6.9/ruff-aarch64-apple-darwin.tar.gz", + "file": "ruff-aarch64-apple-darwin/ruff", + "sha256": "b94562393a4bf23f1a48521f5495a8e48de885b7c173bd7ea8206d6d09921633", + "os": "macos", + "cpu": "arm64" + }, + { + "kind": "archive", + "url": "https://mdb-build-public.s3.amazonaws.com/ruff/0.6.9/ruff-x86_64-apple-darwin.tar.gz", + "file": "ruff-x86_64-apple-darwin/ruff", + "sha256": "34aa37643e30dcb81a3c0e011c3a8df552465ea7580ba92ca727a3b7c6de25d1", + "os": "macos", + "cpu": "x86_64" + } + ] + } +}