Skip to content

Commit e4b4391

Browse files
MDBF-143: Add Infer builder
This preforms static analysis on the MariaDB codebase by maintaining a git source repository as a shared volume. Because static analysis takes time, a lot of time, there is a shared cache volume to store build results from main branches of the codebase so that as much incremental usage can occur. Infer runs in to phases, a capture and an analyze. Infer output are in a result-dir this contains: * report.json - what infer tools use * report.txt - the human readable version of this * capture.db - the sqlite3 version presentation of captured files and the relation to functions definitions. * results.db - the analyze phase outputs Of these, the report.json is desirable as the long term record of vulnerabilities. and the main_diff containing the difference from the last main X.Y branch commit.
1 parent 7b43fe4 commit e4b4391

File tree

5 files changed

+461
-0
lines changed

5 files changed

+461
-0
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import os
2+
3+
from configuration.builders.infra.runtime import (
4+
BuildSequence,
5+
DockerConfig,
6+
InContainer,
7+
)
8+
from configuration.steps.base import StepOptions
9+
from configuration.steps.commands.base import URL
10+
from configuration.steps.commands.packages import SavePackages
11+
from configuration.steps.commands.util import InferScript, PrintEnvironmentDetails
12+
from configuration.steps.remote import ShellStep
13+
14+
15+
def infer(config: DockerConfig):
16+
sequence = BuildSequence()
17+
18+
sequence.add_step(ShellStep(command=PrintEnvironmentDetails()))
19+
20+
sequence.add_step(
21+
InContainer(
22+
docker_environment=config,
23+
step=ShellStep(
24+
command=InferScript(),
25+
options=StepOptions(
26+
description="running infer analysis",
27+
descriptionDone="infer analysis complete",
28+
),
29+
env_vars=[("JOBS", str("%(prop:jobs)s"))],
30+
timeout=7200,
31+
),
32+
)
33+
)
34+
35+
sequence.add_step(
36+
InContainer(
37+
docker_environment=config,
38+
step=ShellStep(
39+
command=SavePackages(
40+
packages=["infer_results"],
41+
destination="/packages/%(prop:tarbuildnum)s/logs/%(prop:buildername)s",
42+
),
43+
url=URL(
44+
url=f"{os.environ['ARTIFACTS_URL']}/%(prop:tarbuildnum)s/logs/%(prop:buildername)s",
45+
url_text="Infer artifacts/logs",
46+
),
47+
options=StepOptions(
48+
alwaysRun=True,
49+
description="saving infer analysis results",
50+
descriptionDone="infer analysis results saved",
51+
),
52+
),
53+
)
54+
)
55+
return sequence

0 commit comments

Comments
 (0)