mirror of https://github.com/mongodb/mongo
SERVER-101034 Use rules_lint shfmt formatter (#38448)
GitOrigin-RevId: e8ef1ba2000e12fa2cd5a115a9ceeab92332e938
This commit is contained in:
parent
5ac113adb1
commit
7ccc14bf91
|
|
@ -0,0 +1,9 @@
|
|||
root = true
|
||||
|
||||
[*.sh]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
|
@ -10,6 +10,7 @@ OWNERS.yml @10gen/server-root-ownership @svc-auto-approve-bot
|
|||
.bazel* @10gen/devprod-build @svc-auto-approve-bot
|
||||
.clang-format @10gen/server-programmability @svc-auto-approve-bot
|
||||
.clang-tidy.in @10gen/server-programmability @svc-auto-approve-bot
|
||||
/.editorconfig @10gen/devprod-build @svc-auto-approve-bot
|
||||
.git* @10gen/devprod-build @svc-auto-approve-bot
|
||||
.mypy.ini @10gen/devprod-build @10gen/devprod-correctness @svc-auto-approve-bot
|
||||
.prettierignore @10gen/devprod-correctness @svc-auto-approve-bot
|
||||
|
|
|
|||
|
|
@ -18,6 +18,9 @@ filters:
|
|||
- ".clang-tidy.in":
|
||||
approvers:
|
||||
- 10gen/server-programmability
|
||||
- "/.editorconfig":
|
||||
approvers:
|
||||
- 10gen/devprod-build
|
||||
- ".git*":
|
||||
approvers:
|
||||
- 10gen/devprod-build
|
||||
|
|
|
|||
|
|
@ -6,8 +6,6 @@ py_binary(
|
|||
args = [
|
||||
"--prettier",
|
||||
"$(location //:prettier)",
|
||||
"--shellscripts-linters",
|
||||
"$(location //buildscripts:shellscripts_linters)",
|
||||
"--rules-lint-format",
|
||||
"$(location :rules_lint_format)",
|
||||
"--rules-lint-format-check",
|
||||
|
|
@ -17,7 +15,6 @@ py_binary(
|
|||
":rules_lint_format",
|
||||
":rules_lint_format.check",
|
||||
"//:prettier",
|
||||
"//buildscripts:shellscripts_linters",
|
||||
"@shfmt",
|
||||
],
|
||||
env = {
|
||||
|
|
@ -38,9 +35,8 @@ format_multirun(
|
|||
graphql = "//:prettier",
|
||||
html = "//:prettier",
|
||||
markdown = "//:prettier",
|
||||
shell = "@shfmt//:shfmt",
|
||||
sql = "//:prettier",
|
||||
starlark = "@buildifier_prebuilt//:buildifier",
|
||||
visibility = ["//visibility:public"],
|
||||
# TODO(SERVER-101034): Enable rules_lint shfmt after sh files are reformatted with .editorconfig
|
||||
# shell = "@shfmt//:shfmt",
|
||||
)
|
||||
|
|
|
|||
|
|
@ -82,21 +82,6 @@ def run_rules_lint(
|
|||
return True
|
||||
|
||||
|
||||
def run_shellscripts_linters(shellscripts_linters: pathlib.Path, check: bool) -> bool:
|
||||
try:
|
||||
command = [str(shellscripts_linters)]
|
||||
if not check:
|
||||
print("Running shellscripts formatter")
|
||||
command.append("fix")
|
||||
else:
|
||||
print("Running shellscripts linter")
|
||||
repo_path = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
subprocess.run(command, check=True, env=os.environ, cwd=repo_path)
|
||||
except subprocess.CalledProcessError:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def run_prettier(
|
||||
prettier: pathlib.Path, check: bool, files_to_format: Union[List[str], str] = "all"
|
||||
) -> bool:
|
||||
|
|
@ -169,12 +154,6 @@ def main() -> int:
|
|||
parser.add_argument(
|
||||
"--prettier", help="Set the path to prettier", required=True, type=pathlib.Path
|
||||
)
|
||||
parser.add_argument(
|
||||
"--shellscripts-linters",
|
||||
help="Set the path to shellscripts_linters",
|
||||
required=True,
|
||||
type=pathlib.Path,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--rules-lint-format",
|
||||
help="Set the path to rules_lint's formatter",
|
||||
|
|
@ -200,7 +179,6 @@ def main() -> int:
|
|||
|
||||
args = parser.parse_args()
|
||||
prettier_path: pathlib.Path = args.prettier.resolve()
|
||||
shellscripts_linters_path: pathlib.Path = args.shellscripts_linters.resolve()
|
||||
|
||||
os.chdir(default_dir)
|
||||
|
||||
|
|
@ -235,7 +213,6 @@ def main() -> int:
|
|||
if run_rules_lint(
|
||||
args.rules_lint_format, args.rules_lint_format_check, args.check, files_to_format
|
||||
)
|
||||
and run_shellscripts_linters(shellscripts_linters_path, args.check)
|
||||
and run_prettier(prettier_path, args.check, files_to_format)
|
||||
else 1
|
||||
)
|
||||
|
|
|
|||
|
|
@ -111,18 +111,6 @@ py_binary(
|
|||
],
|
||||
)
|
||||
|
||||
sh_binary(
|
||||
name = "shellscripts_linters",
|
||||
srcs = ["shellscripts-linters.sh"],
|
||||
data = [
|
||||
"@shfmt",
|
||||
],
|
||||
env = {
|
||||
"SHFMT_PATH": "$(rootpath @shfmt//:shfmt)",
|
||||
},
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
py_library(
|
||||
name = "mongo_toolchain",
|
||||
srcs = [
|
||||
|
|
|
|||
|
|
@ -26,43 +26,36 @@ mkdir -p "$repodir/yum/redhat"
|
|||
|
||||
# to support different $releasever values in yum repo configurations
|
||||
#
|
||||
if [ ! -e "$repodir/yum/redhat/7Server" ]
|
||||
then
|
||||
if [ ! -e "$repodir/yum/redhat/7Server" ]; then
|
||||
ln -s 7 "$repodir/yum/redhat/7Server"
|
||||
fi
|
||||
|
||||
if [ ! -e "$repodir/yum/redhat/6Server" ]
|
||||
then
|
||||
if [ ! -e "$repodir/yum/redhat/6Server" ]; then
|
||||
ln -s 6 "$repodir/yum/redhat/6Server"
|
||||
fi
|
||||
|
||||
if [ ! -e "$repodir/yum/redhat/5Server" ]
|
||||
then
|
||||
if [ ! -e "$repodir/yum/redhat/5Server" ]; then
|
||||
ln -s 5 "$repodir/yum/redhat/5Server"
|
||||
fi
|
||||
|
||||
echo "Scanning and copying package files from $source_dir"
|
||||
echo ". = skipping existing file, @ = copying file"
|
||||
for package in $(find "$source_dir" -not \( -path "$repodir" -prune \) -and \( -name \*.rpm -o -name \*.deb -o -name Release \))
|
||||
do
|
||||
for package in $(find "$source_dir" -not \( -path "$repodir" -prune \) -and \( -name \*.rpm -o -name \*.deb -o -name Release \)); do
|
||||
new_package_location="$repodir$(echo "$package" | sed 's/\/var\/www-enterprise\/[^\/]*//;')"
|
||||
# skip if the directory structure looks weird
|
||||
#
|
||||
if echo "$new_package_location" | grep -q /repo/
|
||||
then
|
||||
if echo "$new_package_location" | grep -q /repo/; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# skip if not enterprise package
|
||||
#
|
||||
if ! echo "$new_package_location" | grep -q enterprise
|
||||
then
|
||||
if ! echo "$new_package_location" | grep -q enterprise; then
|
||||
continue
|
||||
fi
|
||||
# skip if it's already there
|
||||
#
|
||||
if [ -e "$new_package_location" -a "$(basename "$package")" != "Release" ]
|
||||
then
|
||||
if [ -e "$new_package_location" -a "$(basename "$package")" != "Release" ]; then
|
||||
echo -n .
|
||||
else
|
||||
mkdir -p "$(dirname "$new_package_location")"
|
||||
|
|
@ -74,16 +67,12 @@ echo
|
|||
|
||||
# packages are in place, now create metadata
|
||||
#
|
||||
for debian_dir in "$repodir"/apt/ubuntu "$repodir"/apt/debian
|
||||
do
|
||||
for debian_dir in "$repodir"/apt/ubuntu "$repodir"/apt/debian; do
|
||||
cd "$debian_dir"
|
||||
for section_dir in $(find dists -type d -name multiverse -o -name main)
|
||||
do
|
||||
for arch_dir in "$section_dir"/{binary-i386,binary-amd64}
|
||||
do
|
||||
for section_dir in $(find dists -type d -name multiverse -o -name main); do
|
||||
for arch_dir in "$section_dir"/{binary-i386,binary-amd64}; do
|
||||
echo "Generating Packages file under $debian_dir/$arch_dir"
|
||||
if [ ! -d $arch_dir ]
|
||||
then
|
||||
if [ ! -d $arch_dir ]; then
|
||||
mkdir $arch_dir
|
||||
fi
|
||||
dpkg-scanpackages --multiversion "$arch_dir" >"$arch_dir"/Packages
|
||||
|
|
@ -91,8 +80,7 @@ do
|
|||
done
|
||||
done
|
||||
|
||||
for release_file in $(find "$debian_dir" -name Release)
|
||||
do
|
||||
for release_file in $(find "$debian_dir" -name Release); do
|
||||
release_dir=$(dirname "$release_file")
|
||||
echo "Generating Release file under $release_dir"
|
||||
cd $release_dir
|
||||
|
|
@ -118,28 +106,23 @@ done
|
|||
# /var/www-enterprise/repo.consolidated/apt/ubuntu/dists/precise/mongodb-enterprise/unstable -> 2.5
|
||||
# /var/www-enterprise/repo.consolidated/apt/debian/dists/wheezy/mongodb-enterprise/unstable -> 2.5
|
||||
#
|
||||
for unstable_branch_dir in "$repodir"/yum/redhat/*/*/$unstable_branch "$repodir"/yum/amazon/*/*/$unstable_branch "$repodir"/apt/debian/dists/*/*/$unstable_branch "$repodir"/apt/ubuntu/dists/*/*/$unstable_branch "$repodir"/zypper/suse/*/*/$unstable_branch
|
||||
do
|
||||
for unstable_branch_dir in "$repodir"/yum/redhat/*/*/$unstable_branch "$repodir"/yum/amazon/*/*/$unstable_branch "$repodir"/apt/debian/dists/*/*/$unstable_branch "$repodir"/apt/ubuntu/dists/*/*/$unstable_branch "$repodir"/zypper/suse/*/*/$unstable_branch; do
|
||||
full_unstable_path=$(dirname "$unstable_branch_dir")/unstable
|
||||
if [ -e "$unstable_branch_dir" -a ! -e "$full_unstable_path" ]
|
||||
then
|
||||
if [ -e "$unstable_branch_dir" -a ! -e "$full_unstable_path" ]; then
|
||||
echo "Linking unstable branch directory $unstable_branch_dir to $full_unstable_path"
|
||||
ln -s $unstable_branch $full_unstable_path
|
||||
fi
|
||||
done
|
||||
|
||||
for stable_branch_dir in "$repodir"/yum/redhat/*/*/$stable_branch "$repodir"/yum/amazon/*/*/$stable_branch "$repodir"/apt/debian/dists/*/*/$stable_branch "$repodir"/apt/ubuntu/dists/*/*/$stable_branch "$repodir"/zypper/suse/*/*/$stable_branch
|
||||
do
|
||||
for stable_branch_dir in "$repodir"/yum/redhat/*/*/$stable_branch "$repodir"/yum/amazon/*/*/$stable_branch "$repodir"/apt/debian/dists/*/*/$stable_branch "$repodir"/apt/ubuntu/dists/*/*/$stable_branch "$repodir"/zypper/suse/*/*/$stable_branch; do
|
||||
full_stable_path=$(dirname "$stable_branch_dir")/stable
|
||||
if [ -e "$stable_branch_dir" -a ! -e "$full_stable_path" ]
|
||||
then
|
||||
if [ -e "$stable_branch_dir" -a ! -e "$full_stable_path" ]; then
|
||||
echo "Linking stable branch directory $stable_branch_dir to $full_stable_path"
|
||||
ln -s $stable_branch $full_stable_path
|
||||
fi
|
||||
done
|
||||
|
||||
for rpm_dir in $(find "$repodir"/yum/redhat "$repodir"/zypper/suse -type d -name x86_64 -o -name i386)
|
||||
do
|
||||
for rpm_dir in $(find "$repodir"/yum/redhat "$repodir"/zypper/suse -type d -name x86_64 -o -name i386); do
|
||||
echo "Generating redhat repo metadata under $rpm_dir"
|
||||
cd "$rpm_dir"
|
||||
createrepo .
|
||||
|
|
|
|||
|
|
@ -26,43 +26,36 @@ mkdir -p "$repodir/yum/redhat"
|
|||
|
||||
# to support different $releasever values in yum repo configurations
|
||||
#
|
||||
if [ ! -e "$repodir/yum/redhat/6Server" ]
|
||||
then
|
||||
if [ ! -e "$repodir/yum/redhat/6Server" ]; then
|
||||
ln -s 6 "$repodir/yum/redhat/6Server"
|
||||
fi
|
||||
|
||||
if [ ! -e "$repodir/yum/redhat/7Server" ]
|
||||
then
|
||||
if [ ! -e "$repodir/yum/redhat/7Server" ]; then
|
||||
ln -s 7 "$repodir/yum/redhat/7Server"
|
||||
fi
|
||||
|
||||
if [ ! -e "$repodir/yum/redhat/5Server" ]
|
||||
then
|
||||
if [ ! -e "$repodir/yum/redhat/5Server" ]; then
|
||||
ln -s 5 "$repodir/yum/redhat/5Server"
|
||||
fi
|
||||
|
||||
echo "Scanning and copying package files from $source_dir"
|
||||
echo ". = skipping existing file, @ = copying file"
|
||||
for package in $(find "$source_dir" -not \( -path "$repodir" -prune \) -and \( -name \*.rpm -o -name \*.deb -o -name Release \))
|
||||
do
|
||||
for package in $(find "$source_dir" -not \( -path "$repodir" -prune \) -and \( -name \*.rpm -o -name \*.deb -o -name Release \)); do
|
||||
new_package_location="$repodir$(echo "$package" | sed 's/\/var\/www-org\/[^\/]*//;')"
|
||||
# skip if the directory structure looks weird
|
||||
#
|
||||
if echo "$new_package_location" | grep -q /repo/
|
||||
then
|
||||
if echo "$new_package_location" | grep -q /repo/; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# skip if not community package
|
||||
#
|
||||
if ! echo "$new_package_location" | grep -q org
|
||||
then
|
||||
if ! echo "$new_package_location" | grep -q org; then
|
||||
continue
|
||||
fi
|
||||
# skip if it's already there
|
||||
#
|
||||
if [ -e "$new_package_location" -a "$(basename "$package")" != "Release" ]
|
||||
then
|
||||
if [ -e "$new_package_location" -a "$(basename "$package")" != "Release" ]; then
|
||||
echo -n .
|
||||
else
|
||||
mkdir -p "$(dirname "$new_package_location")"
|
||||
|
|
@ -74,16 +67,12 @@ echo
|
|||
|
||||
# packages are in place, now create metadata
|
||||
#
|
||||
for debian_dir in "$repodir"/apt/ubuntu "$repodir"/apt/debian
|
||||
do
|
||||
for debian_dir in "$repodir"/apt/ubuntu "$repodir"/apt/debian; do
|
||||
cd "$debian_dir"
|
||||
for section_dir in $(find dists -type d -name multiverse -o -name main)
|
||||
do
|
||||
for arch_dir in "$section_dir"/{binary-i386,binary-amd64}
|
||||
do
|
||||
for section_dir in $(find dists -type d -name multiverse -o -name main); do
|
||||
for arch_dir in "$section_dir"/{binary-i386,binary-amd64}; do
|
||||
echo "Generating Packages file under $debian_dir/$arch_dir"
|
||||
if [ ! -d $arch_dir ]
|
||||
then
|
||||
if [ ! -d $arch_dir ]; then
|
||||
mkdir $arch_dir
|
||||
fi
|
||||
dpkg-scanpackages --multiversion "$arch_dir" >"$arch_dir"/Packages
|
||||
|
|
@ -91,8 +80,7 @@ do
|
|||
done
|
||||
done
|
||||
|
||||
for release_file in $(find "$debian_dir" -name Release)
|
||||
do
|
||||
for release_file in $(find "$debian_dir" -name Release); do
|
||||
release_dir=$(dirname "$release_file")
|
||||
echo "Generating Release file under $release_dir"
|
||||
cd $release_dir
|
||||
|
|
@ -118,28 +106,23 @@ done
|
|||
# /var/www-org/repo.consolidated/apt/ubuntu/dists/precise/mongodb-org/unstable -> 2.5
|
||||
# /var/www-org/repo.consolidated/apt/debian/dists/wheezy/mongodb-org/unstable -> 2.5
|
||||
#
|
||||
for unstable_branch_dir in "$repodir"/yum/redhat/*/*/$unstable_branch "$repodir"/yum/amazon/*/*/$unstable_branch "$repodir"/apt/debian/dists/*/*/$unstable_branch "$repodir"/apt/ubuntu/dists/*/*/$unstable_branch "$repodir"/zypper/suse/*/*/$unstable_branch
|
||||
do
|
||||
for unstable_branch_dir in "$repodir"/yum/redhat/*/*/$unstable_branch "$repodir"/yum/amazon/*/*/$unstable_branch "$repodir"/apt/debian/dists/*/*/$unstable_branch "$repodir"/apt/ubuntu/dists/*/*/$unstable_branch "$repodir"/zypper/suse/*/*/$unstable_branch; do
|
||||
full_unstable_path=$(dirname "$unstable_branch_dir")/unstable
|
||||
if [ -e "$unstable_branch_dir" -a ! -e "$full_unstable_path" ]
|
||||
then
|
||||
if [ -e "$unstable_branch_dir" -a ! -e "$full_unstable_path" ]; then
|
||||
echo "Linking unstable branch directory $unstable_branch_dir to $full_unstable_path"
|
||||
ln -s $unstable_branch $full_unstable_path
|
||||
fi
|
||||
done
|
||||
|
||||
for stable_branch_dir in "$repodir"/yum/redhat/*/*/$stable_branch "$repodir"/yum/amazon/*/*/$stable_branch "$repodir"/apt/debian/dists/*/*/$stable_branch "$repodir"/apt/ubuntu/dists/*/*/$stable_branch "$repodir"/zypper/suse/*/*/$stable_branch
|
||||
do
|
||||
for stable_branch_dir in "$repodir"/yum/redhat/*/*/$stable_branch "$repodir"/yum/amazon/*/*/$stable_branch "$repodir"/apt/debian/dists/*/*/$stable_branch "$repodir"/apt/ubuntu/dists/*/*/$stable_branch "$repodir"/zypper/suse/*/*/$stable_branch; do
|
||||
full_stable_path=$(dirname "$stable_branch_dir")/stable
|
||||
if [ -e "$stable_branch_dir" -a ! -e "$full_stable_path" ]
|
||||
then
|
||||
if [ -e "$stable_branch_dir" -a ! -e "$full_stable_path" ]; then
|
||||
echo "Linking stable branch directory $stable_branch_dir to $full_stable_path"
|
||||
ln -s $stable_branch $full_stable_path
|
||||
fi
|
||||
done
|
||||
|
||||
for rpm_dir in $(find "$repodir"/yum/redhat "$repodir"/yum/amazon "$repodir"/zypper/suse -type d -name x86_64 -o -name i386)
|
||||
do
|
||||
for rpm_dir in $(find "$repodir"/yum/redhat "$repodir"/yum/amazon "$repodir"/zypper/suse -type d -name x86_64 -o -name i386); do
|
||||
echo "Generating redhat repo metadata under $rpm_dir"
|
||||
cd "$rpm_dir"
|
||||
createrepo .
|
||||
|
|
|
|||
|
|
@ -31,10 +31,8 @@ This script supports the following parameters for Windows & Linux platforms:
|
|||
EOF
|
||||
}
|
||||
|
||||
|
||||
# Parse command line options
|
||||
while getopts "d:l:o:r:t:u:?" option
|
||||
do
|
||||
while getopts "d:l:o:r:t:u:?" option; do
|
||||
case $option in
|
||||
d)
|
||||
data_device_names=$OPTARG
|
||||
|
|
@ -72,8 +70,7 @@ function mount_drive {
|
|||
|
||||
# Determine how many devices were specified
|
||||
local num_devices=0
|
||||
for device_name in $device_names
|
||||
do
|
||||
for device_name in $device_names; do
|
||||
local devices="$devices /dev/$device_name"
|
||||
let num_devices=num_devices+1
|
||||
done
|
||||
|
|
@ -93,8 +90,7 @@ function mount_drive {
|
|||
local drive=$device_names
|
||||
local system_drive=c
|
||||
|
||||
while true;
|
||||
do
|
||||
while true; do
|
||||
sleep $drive_poll_delay
|
||||
echo "Looking for drive '$drive' to mount $root_dir"
|
||||
if [ -d /cygdrive/$drive ]; then
|
||||
|
|
@ -105,8 +101,7 @@ function mount_drive {
|
|||
cmd.exe /c mklink /J $system_drive:\\$root_dir $drive:\\$root_dir
|
||||
ln -s /cygdrive/$drive/$root_dir /$root_dir
|
||||
setfacl -s user::rwx,group::rwx,other::rwx /cygdrive/$drive/$root_dir
|
||||
for sub_dir in $sub_dirs
|
||||
do
|
||||
for sub_dir in $sub_dirs; do
|
||||
mkdir -p /cygdrive/$drive/$root_dir/$sub_dir
|
||||
done
|
||||
chown -R $user_group /cygdrive/$system_drive/$root_dir
|
||||
|
|
@ -165,8 +160,7 @@ function mount_drive {
|
|||
mkdir /$root_dir || true
|
||||
chmod 777 /$root_dir
|
||||
mount -t $fs_type "UUID=$device_uuid" /$root_dir
|
||||
for sub_dir in $sub_dirs
|
||||
do
|
||||
for sub_dir in $sub_dirs; do
|
||||
mkdir -p /$root_dir/$sub_dir
|
||||
chmod 1777 /$root_dir/$sub_dir
|
||||
done
|
||||
|
|
|
|||
|
|
@ -1,41 +0,0 @@
|
|||
#!/bin/bash
|
||||
set +o errexit
|
||||
|
||||
shfmt=shfmt
|
||||
if [ -n "$SHFMT_PATH" ]; then
|
||||
shfmt=$(readlink $SHFMT_PATH)
|
||||
fi
|
||||
|
||||
if [ -n "$BUILD_WORKSPACE_DIRECTORY" ]; then
|
||||
cd $BUILD_WORKSPACE_DIRECTORY
|
||||
fi
|
||||
|
||||
if ! command -v $shfmt &>/dev/null; then
|
||||
echo "Could not find shfmt at $shfmt"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
lint_dirs="evergreen"
|
||||
|
||||
if [ "$1" = "fix" ]; then
|
||||
$shfmt -w -i 2 -bn -sr "$lint_dirs"
|
||||
fi
|
||||
|
||||
output_file="shfmt_output.txt"
|
||||
exit_code=0
|
||||
|
||||
$shfmt -d -i 2 -bn -sr "$lint_dirs" >"$output_file"
|
||||
if [ -s "$output_file" ]; then
|
||||
echo "ERROR: Found formatting errors in shell script files in directories: $lint_dirs"
|
||||
echo ""
|
||||
cat "$output_file"
|
||||
echo ""
|
||||
echo "To fix formatting errors run"
|
||||
echo ""
|
||||
echo " ./buildscripts/shellscripts-linters.sh fix"
|
||||
echo ""
|
||||
exit_code=1
|
||||
fi
|
||||
rm -rf "$output_file"
|
||||
|
||||
exit "$exit_code"
|
||||
|
|
@ -8,4 +8,3 @@ set -vx
|
|||
|
||||
NAME=protobuf
|
||||
VERSION="mongo/v4.25.0"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
silent_grep() {
|
||||
command grep -q > /dev/null 2>&1 "$@"
|
||||
command grep -q "$@" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
idem_file_append() {
|
||||
|
|
@ -19,9 +19,9 @@ idem_file_append() {
|
|||
local end_marker="# END $2"
|
||||
if ! silent_grep "^$start_marker" "$1"; then
|
||||
{
|
||||
echo -e "\n$start_marker";
|
||||
echo -e "$3";
|
||||
echo -e "$end_marker";
|
||||
echo -e "\n$start_marker"
|
||||
echo -e "$3"
|
||||
echo -e "$end_marker"
|
||||
} >>"$1"
|
||||
fi
|
||||
}
|
||||
|
|
@ -30,7 +30,8 @@ setup_bash() {
|
|||
# Bash profile should source .bashrc
|
||||
echo "################################################################################"
|
||||
echo "Setting up bash..."
|
||||
local block=$(cat <<BLOCK
|
||||
local block=$(
|
||||
cat <<BLOCK
|
||||
if [[ -f ~/.bashrc ]]; then
|
||||
source ~/.bashrc
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -296,11 +296,6 @@ sh_binary(
|
|||
srcs = ["lint_fuzzer_sanity_patch.sh"],
|
||||
)
|
||||
|
||||
sh_binary(
|
||||
name = "lint_shellscripts",
|
||||
srcs = ["lint_shellscripts.sh"],
|
||||
)
|
||||
|
||||
sh_binary(
|
||||
name = "lint_yaml",
|
||||
srcs = ["lint_yaml.sh"],
|
||||
|
|
|
|||
|
|
@ -146,8 +146,8 @@ fi
|
|||
|
||||
for i in {1..3}; do
|
||||
eval ${TIMEOUT_CMD} $BAZEL_BINARY build --verbose_failures $LOCAL_ARG ${bazel_args} ${bazel_compile_flags} ${task_compile_flags} \
|
||||
--define=MONGO_VERSION=${version} ${patch_compile_flags} ${targets} 2>&1 | tee bazel_stdout.log \
|
||||
&& RET=0 && break || RET=$? && sleep 60
|
||||
--define=MONGO_VERSION=${version} ${patch_compile_flags} ${targets} 2>&1 | tee bazel_stdout.log &&
|
||||
RET=0 && break || RET=$? && sleep 60
|
||||
if [ $RET -eq 124 ]; then
|
||||
echo "Bazel timed out after ${build_timeout_seconds} seconds, retrying..."
|
||||
else
|
||||
|
|
|
|||
|
|
@ -80,8 +80,8 @@ for i in {1..3}; do
|
|||
done
|
||||
|
||||
for i in {1..3}; do
|
||||
eval ${TIMEOUT_CMD} ${BAZEL_BINARY} test ${ALL_FLAGS} ${targets} 2>&1 | tee bazel_stdout.log \
|
||||
&& RET=0 && break || RET=$? && sleep 1
|
||||
eval ${TIMEOUT_CMD} ${BAZEL_BINARY} test ${ALL_FLAGS} ${targets} 2>&1 | tee bazel_stdout.log &&
|
||||
RET=0 && break || RET=$? && sleep 1
|
||||
if [ $RET -eq 124 ]; then
|
||||
echo "Bazel timed out after ${build_timeout_seconds} seconds, retrying..."
|
||||
else
|
||||
|
|
|
|||
|
|
@ -14,10 +14,10 @@ echo "Cleaning up OIDC GCP test artifacts"
|
|||
|
||||
# Delete the GCP VM specified in gce_vm_info.json if GOOGLE_APPLICATION_CREDENTIALS is set, points
|
||||
# to a file, and the GCE config and VM info files exist.
|
||||
if [ ! -z "${GOOGLE_APPLICATION_CREDENTIALS}" ] \
|
||||
&& [ -f "${GOOGLE_APPLICATION_CREDENTIALS}" ] \
|
||||
&& [ -f "${HOME}/gce_vm_config.json" ] \
|
||||
&& [ -f "${HOME}/gce_vm_info.json" ]; then
|
||||
if [ ! -z "${GOOGLE_APPLICATION_CREDENTIALS}" ] &&
|
||||
[ -f "${GOOGLE_APPLICATION_CREDENTIALS}" ] &&
|
||||
[ -f "${HOME}/gce_vm_config.json" ] &&
|
||||
[ -f "${HOME}/gce_vm_info.json" ]; then
|
||||
# Install google-cloud-compute so that the script can run.
|
||||
$python -m pip install google-cloud-compute
|
||||
$python src/mongo/db/modules/enterprise/jstests/external_auth_oidc_gcp/lib/gce_vm_manager.py delete --config_file $HOME/gce_vm_config.json --service_account_key_file ${GOOGLE_APPLICATION_CREDENTIALS} --output_file $HOME/gce_vm_info.json
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@ cd src
|
|||
set -eou pipefail
|
||||
|
||||
# Only run on unit test tasks so we don't target mongod binaries from cores.
|
||||
if [ "${task_name}" != "run_dbtest" ] \
|
||||
&& [[ ${task_name} != integration_tests* ]] \
|
||||
&& [[ "${task_name}" != unit_test_group*_no_sandbox ]]; then
|
||||
if [ "${task_name}" != "run_dbtest" ] &&
|
||||
[[ ${task_name} != integration_tests* ]] &&
|
||||
[[ "${task_name}" != unit_test_group*_no_sandbox ]]; then
|
||||
echo "Not gathering failed unittests binaries as this is not a unittest task: ${task_name}"
|
||||
exit 0
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@ DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null 2>&1 && pwd)"
|
|||
proc_list="(java|lein|mongo|python|_test$|_test\.exe$)"
|
||||
if [ "Windows_NT" = "$OS" ]; then
|
||||
get_pids() {
|
||||
proc_pids=$(tasklist /fo:csv \
|
||||
| awk -F'","' '{x=$1; gsub("\"","",x); print $2, x}' \
|
||||
| grep -iE $1 \
|
||||
| cut -f1 -d ' ')
|
||||
proc_pids=$(tasklist /fo:csv |
|
||||
awk -F'","' '{x=$1; gsub("\"","",x); print $2, x}' |
|
||||
grep -iE $1 |
|
||||
cut -f1 -d ' ')
|
||||
}
|
||||
get_process_info() {
|
||||
proc_name=""
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@ lein run test --test ${jepsen_test_name} \
|
|||
${jepsen_storage_engine} \
|
||||
${jepsen_time_limit} \
|
||||
${jepsen_write_concern} \
|
||||
2>&1 \
|
||||
| tee jepsen_${task_name}_${execution}.log
|
||||
2>&1 |
|
||||
tee jepsen_${task_name}_${execution}.log
|
||||
end_time=$(date +%s)
|
||||
elapsed_secs=$((end_time - start_time))
|
||||
. ../evergreen/jepsen_report.sh
|
||||
|
|
|
|||
|
|
@ -13,9 +13,9 @@ CONTAINER_INPUT_DIR="/app"
|
|||
podman pull 901841024863.dkr.ecr.us-east-1.amazonaws.com/mongodb-internal/jstestfuzz:latest
|
||||
# Run parse-jsfiles on 50 files at a time with 32 processes in parallel.
|
||||
# Skip javascript files in third_party directory
|
||||
find "jstests" "src/mongo/db/modules/enterprise" -path "$PWD/jstests/third_party" -prune -o -name "*.js" -print \
|
||||
| xargs -P 32 -L 50 $CONTAINER_RUNTIME run -v $LOCAL_INPUT_DIR/jstests:$CONTAINER_INPUT_DIR/jstests -v $LOCAL_INPUT_DIR/src/mongo/db/modules/enterprise:$CONTAINER_INPUT_DIR/src/mongo/db/modules/enterprise 901841024863.dkr.ecr.us-east-1.amazonaws.com/mongodb-internal/jstestfuzz:latest npm run-script parse-jsfiles -- 2>&1 \
|
||||
| tee lint_fuzzer_sanity.log
|
||||
find "jstests" "src/mongo/db/modules/enterprise" -path "$PWD/jstests/third_party" -prune -o -name "*.js" -print |
|
||||
xargs -P 32 -L 50 $CONTAINER_RUNTIME run -v $LOCAL_INPUT_DIR/jstests:$CONTAINER_INPUT_DIR/jstests -v $LOCAL_INPUT_DIR/src/mongo/db/modules/enterprise:$CONTAINER_INPUT_DIR/src/mongo/db/modules/enterprise 901841024863.dkr.ecr.us-east-1.amazonaws.com/mongodb-internal/jstestfuzz:latest npm run-script parse-jsfiles -- 2>&1 |
|
||||
tee lint_fuzzer_sanity.log
|
||||
exit_code=$?
|
||||
|
||||
activate_venv
|
||||
|
|
|
|||
|
|
@ -1,14 +0,0 @@
|
|||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null 2>&1 && pwd)"
|
||||
. "$DIR/prelude.sh"
|
||||
|
||||
set -o pipefail
|
||||
|
||||
cd src
|
||||
|
||||
PATH="/opt/shfmt/v3.2.4/bin:$PATH"
|
||||
./buildscripts/shellscripts-linters.sh | tee shellscripts.log
|
||||
exit_code=$?
|
||||
|
||||
activate_venv
|
||||
$python ./buildscripts/simple_report.py --test-name shfmt --log-file shellscripts.log --exit-code $exit_code
|
||||
exit $exit_code
|
||||
|
|
@ -58,8 +58,8 @@ function create_mongo_config() {
|
|||
function start_mongod() {
|
||||
# Start mongod and if it won't come up, fail and exit
|
||||
|
||||
sudo --non-interactive systemctl start mongod \
|
||||
&& sudo --non-interactive systemctl status mongod || (
|
||||
sudo --non-interactive systemctl start mongod &&
|
||||
sudo --non-interactive systemctl status mongod || (
|
||||
fail_and_exit_err "systemd failed to start mongod server!"
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,13 +3,11 @@
|
|||
SCRIPT_DIR=$(dirname $0)
|
||||
SOURCE_ROOT="$SCRIPT_DIR/.."
|
||||
|
||||
function merged_decls_headers
|
||||
{
|
||||
function merged_decls_headers {
|
||||
jq -r 'map(select(.mod as $mod | any(.used_from[]; .mod != $mod)) | .loc | split(":") | .[0]) | unique[]' $SOURCE_ROOT/merged_decls.json
|
||||
}
|
||||
|
||||
function all_headers
|
||||
{
|
||||
function all_headers {
|
||||
cd $SOURCE_ROOT && find src/mongo -name '*.h' | sort
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue