Skip to content

Commit 6ee0dcb

Browse files
dmoody256MongoDB Bot
authored andcommitted
SERVER-108778 Fix coverity task to use evergreen MONGO_VERSION (#39613) (#39720)
GitOrigin-RevId: 94f342c6662f71276ab428b3fcf8e3cc1ac9c698
1 parent 65be292 commit 6ee0dcb

File tree

3 files changed

+21
-14
lines changed

3 files changed

+21
-14
lines changed

bazel/coverity/generate_coverity_command.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,22 @@
1717
# the cc_library and cc_binaries in our build. There is not a good way from
1818
# within the build to get all those targets, so we will generate the list via query
1919
# https://sig-product-docs.synopsys.com/bundle/coverity-docs/page/coverity-analysis/topics/building_with_bazel.html#build_with_bazel
20-
proc = subprocess.run(
21-
[
20+
cmd = [
2221
bazel_executable,
2322
bazel_cache,
2423
"aquery",
25-
]
26-
+ bazel_cmd_args
27-
+ [args.bazel_query],
24+
] + bazel_cmd_args + [args.bazel_query]
25+
print(f"Running command: {cmd}")
26+
proc = subprocess.run(
27+
cmd,
2828
stdout=subprocess.PIPE,
2929
stderr=subprocess.PIPE,
3030
text=True,
3131
)
3232

33+
print(proc.stderr)
34+
print(proc.stdout)
35+
3336
targets = set()
3437
for line in proc.stdout.splitlines():
3538
if line.startswith(" Target: "):

etc/evergreen_yml_components/variants/coverity.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ functions:
4242

4343
tasks:
4444
- name: run_coverity
45+
depends_on:
46+
- name: version_expansions_gen
47+
variant: generate-tasks-for-version
4548
tags:
4649
[
4750
"assigned_to_jira_team_devprod_build",
@@ -59,6 +62,8 @@ tasks:
5962
- func: f_expansions_write
6063
- func: f_setup_python
6164
- func: f_expansions_write
65+
- func: "get and apply version expansions"
66+
- func: "f_expansions_write"
6267
- func: f_generate_evergreen_bazelrc
6368
- func: f_download_and_extract_coverity
6469
vars:

evergreen/coverity_build.sh

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
11
#!/bin/env bash
2-
3-
set -eo pipefail
2+
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
3+
. "$DIR/prelude.sh"
44

55
cd src
66

7-
. evergreen/prelude_venv.sh
7+
set -eo pipefail
8+
89
activate_venv
9-
python buildscripts/install_bazel.py
10-
bazel_bin="$HOME/.local/bin/bazelisk"
1110
# number of parallel jobs to use for build.
1211
# 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
1312
bazel_jobs=$(bc <<<"$(grep -c '^processor' /proc/cpuinfo) * .85 / 1")
14-
build_config="--config=local --jobs=$bazel_jobs --compiler_type=gcc --opt=off --dbg=False --allocator=system"
13+
build_config="--config=local --jobs=$bazel_jobs --compiler_type=gcc --opt=off --dbg=False --allocator=system --define=MONGO_VERSION=${version}"
1514
bazel_query='mnemonic("CppCompile|LinkCompile", filter(//src/mongo, deps(//:install-core)) except //src/mongo/db/modules/enterprise/src/streams/third_party/...)'
1615
bazel_cache="--output_user_root=$workdir/bazel_cache"
1716

18-
python bazel/coverity/generate_coverity_command.py --bazel_executable=$bazel_bin --bazel_cache=$bazel_cache --bazel_query="$bazel_query" $build_config --noinclude_artifacts
19-
$bazel_bin $bazel_cache build $build_config --build_tag_filters=gen_source //src/...
20-
bazelBuildCommand="$bazel_bin $bazel_cache build $build_config //src/mongo/db/modules/enterprise/coverity:enterprise_coverity_build"
17+
python bazel/coverity/generate_coverity_command.py --bazel_executable="bazel" --bazel_cache=$bazel_cache --bazel_query="$bazel_query" $build_config --noinclude_artifacts
18+
bazel $bazel_cache build $build_config --build_tag_filters=gen_source //src/...
19+
bazelBuildCommand="bazel $bazel_cache build $build_config //src/mongo/db/modules/enterprise/coverity:enterprise_coverity_build"
2120
echo "Bazel Build Command: $bazelBuildCommand"
2221
covIdir="$workdir/covIdir"
2322
if [ -d "$covIdir" ]; then

0 commit comments

Comments
 (0)