mirror of https://github.com/mongodb/mongo
SERVER-113751 Wrap the Modules Linter in a Retry (#43844)
GitOrigin-RevId: 0c79036a9d36ab44c5371f0523d69500a2721d92
This commit is contained in:
parent
4e931624a3
commit
6b9557fc30
|
|
@ -130,16 +130,29 @@ def is_submodule_usage(decl_mod: str, *, usage_mod: str) -> bool:
|
||||||
|
|
||||||
|
|
||||||
def get_paths(timer: Timer):
|
def get_paths(timer: Timer):
|
||||||
|
# Retry the bazel build up to 3 times to handle transient failures
|
||||||
|
max_retries = 3
|
||||||
|
|
||||||
|
for attempt in range(1, max_retries + 1):
|
||||||
|
print(f"Bazel build attempt {attempt}/{max_retries}...")
|
||||||
proc = subprocess.run(
|
proc = subprocess.run(
|
||||||
["bazel", "build", "--config=mod-scanner", "//src/mongo/..."],
|
["bazel", "build", "--config=mod-scanner", "//src/mongo/..."],
|
||||||
text=True, # unnecessary since we don't use stdout, but makes the types match
|
text=True, # unnecessary since we don't use stdout, but makes the types match
|
||||||
cwd=REPO_ROOT,
|
cwd=REPO_ROOT,
|
||||||
check=False,
|
check=False,
|
||||||
)
|
)
|
||||||
timer.mark("scanned sources")
|
|
||||||
if proc.returncode != 0:
|
if proc.returncode == 0:
|
||||||
|
break
|
||||||
|
|
||||||
|
if attempt < max_retries:
|
||||||
|
print(f"Bazel build failed with exit code {proc.returncode}, " f"retrying...")
|
||||||
|
else:
|
||||||
|
print(f"Bazel build failed after {max_retries} attempts")
|
||||||
sys.exit(proc.returncode)
|
sys.exit(proc.returncode)
|
||||||
|
|
||||||
|
timer.mark("scanned sources")
|
||||||
|
|
||||||
proc = subprocess.run(
|
proc = subprocess.run(
|
||||||
[
|
[
|
||||||
"bazel",
|
"bazel",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue