mirror of https://github.com/mongodb/mongo
SERVER-108778 Fix coverity task to use evergreen MONGO_VERSION (#39613)
GitOrigin-RevId: 1550bb57696cc6acc7798bcc5e4ecbba771a6779
This commit is contained in:
parent
00bc776d7a
commit
26f9041040
|
|
@ -17,19 +17,22 @@ bazel_cache = os.path.expanduser(args.bazel_cache)
|
|||
# the cc_library and cc_binaries in our build. There is not a good way from
|
||||
# within the build to get all those targets, so we will generate the list via query
|
||||
# https://sig-product-docs.synopsys.com/bundle/coverity-docs/page/coverity-analysis/topics/building_with_bazel.html#build_with_bazel
|
||||
proc = subprocess.run(
|
||||
[
|
||||
cmd = [
|
||||
bazel_executable,
|
||||
bazel_cache,
|
||||
"aquery",
|
||||
]
|
||||
+ bazel_cmd_args
|
||||
+ [args.bazel_query],
|
||||
] + bazel_cmd_args + [args.bazel_query]
|
||||
print(f"Running command: {cmd}")
|
||||
proc = subprocess.run(
|
||||
cmd,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
text=True,
|
||||
)
|
||||
|
||||
print(proc.stderr)
|
||||
print(proc.stdout)
|
||||
|
||||
targets = set()
|
||||
for line in proc.stdout.splitlines():
|
||||
if line.startswith(" Target: "):
|
||||
|
|
|
|||
|
|
@ -42,6 +42,9 @@ functions:
|
|||
|
||||
tasks:
|
||||
- name: run_coverity
|
||||
depends_on:
|
||||
- name: version_expansions_gen
|
||||
variant: generate-tasks-for-version
|
||||
tags:
|
||||
[
|
||||
"assigned_to_jira_team_devprod_build",
|
||||
|
|
@ -60,6 +63,8 @@ tasks:
|
|||
- func: f_expansions_write
|
||||
- func: f_setup_python
|
||||
- func: f_expansions_write
|
||||
- func: "get and apply version expansions"
|
||||
- func: "f_expansions_write"
|
||||
- func: f_generate_evergreen_bazelrc
|
||||
- func: f_download_and_extract_coverity
|
||||
vars:
|
||||
|
|
|
|||
|
|
@ -1,23 +1,22 @@
|
|||
#!/bin/env bash
|
||||
|
||||
set -eo pipefail
|
||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
|
||||
. "$DIR/prelude.sh"
|
||||
|
||||
cd src
|
||||
|
||||
. evergreen/prelude_venv.sh
|
||||
set -eo pipefail
|
||||
|
||||
activate_venv
|
||||
python buildscripts/install_bazel.py
|
||||
bazel_bin="$HOME/.local/bin/bazelisk"
|
||||
# number of parallel jobs to use for build.
|
||||
# Even with scale=0 (the default), bc command adds decimal digits in case of multiplication. Division by 1 gives us a whole number with scale=0
|
||||
bazel_jobs=$(bc <<<"$(grep -c '^processor' /proc/cpuinfo) * .85 / 1")
|
||||
build_config="--config=local --jobs=$bazel_jobs --compiler_type=gcc --opt=off --dbg=False --allocator=system"
|
||||
build_config="--config=local --jobs=$bazel_jobs --compiler_type=gcc --opt=off --dbg=False --allocator=system --define=MONGO_VERSION=${version}"
|
||||
bazel_query='mnemonic("CppCompile|LinkCompile", filter(//src/mongo, deps(//:install-core)) except //src/mongo/db/modules/enterprise/src/streams/third_party/...)'
|
||||
bazel_cache="--output_user_root=$workdir/bazel_cache"
|
||||
|
||||
python bazel/coverity/generate_coverity_command.py --bazel_executable=$bazel_bin --bazel_cache=$bazel_cache --bazel_query="$bazel_query" $build_config --noinclude_artifacts
|
||||
$bazel_bin $bazel_cache build $build_config --build_tag_filters=gen_source //src/...
|
||||
bazelBuildCommand="$bazel_bin $bazel_cache build $build_config //src/mongo/db/modules/enterprise/coverity:enterprise_coverity_build"
|
||||
python bazel/coverity/generate_coverity_command.py --bazel_executable="bazel" --bazel_cache=$bazel_cache --bazel_query="$bazel_query" $build_config --noinclude_artifacts
|
||||
bazel $bazel_cache build $build_config --build_tag_filters=gen_source //src/...
|
||||
bazelBuildCommand="bazel $bazel_cache build $build_config //src/mongo/db/modules/enterprise/coverity:enterprise_coverity_build"
|
||||
echo "Bazel Build Command: $bazelBuildCommand"
|
||||
covIdir="$workdir/covIdir"
|
||||
if [ -d "$covIdir" ]; then
|
||||
|
|
|
|||
Loading…
Reference in New Issue