Skip to content

Commit 702d7ce

Browse files
MDBF 143 - Added repository/env inputs to infer script
To allow DEV testing.
1 parent 4ef445f commit 702d7ce

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

configuration/steps/commands/scripts/infer.sh

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ fi
1414

1515
# Testing this version
1616
branch=$1
17+
repository=${2:-"https://github.com/MariaDB/server.git"}
18+
environment=${3:-"PROD"}
1719

1820
if [ -z "$branch" ]; then
1921
echo "usage $0 {branch/commit}" >&2
@@ -28,8 +30,8 @@ trap "cleanup_for_CI" EXIT
2830

2931
base=$PWD
3032
result_dir=$PWD/infer_results
31-
infer="/mnt/infer"
32-
sources="/mnt/src/server"
33+
infer="/mnt/infer/$environment"
34+
sources="/mnt/src/$environment/server"
3335
# less than zabbix (80) warning.
3436
max_usage=75 # maximum disk usage (in percent)
3537
limit=50 # number of commits away to consider for a differential build/analysis
@@ -39,17 +41,22 @@ limit=50 # number of commits away to consider for a differential build/analysis
3941
## FUNCTIONS ##
4042
################################################################################
4143

44+
create_dirs()
45+
{
46+
mkdir -p "$infer"
47+
mkdir -p "$sources"
48+
}
49+
4250
# Inputs: $branch
4351
# Postconditions:
4452
# * $sources is checked out to $branch
4553
# * $commit set to the reference
4654
get_source()
4755
{
48-
[ -d "$sources" ] || mkdir "$sources"
49-
pushd $sources
56+
pushd "$sources"
5057
trap 'popd' RETURN
5158
if [ ! -d .git ]; then
52-
git clone https://github.com/MariaDB/server.git .
59+
git clone "$repository" .
5360
else
5461
git clean -df
5562
fi
@@ -193,7 +200,7 @@ capture()
193200
analyze()
194201
{
195202
analyze_cmd=(analyze --project-root "${sources}" --results-dir "${result_dir}" --max-jobs "${JOBS}" "$@")
196-
if [ -f $sources/.infer/report-block-list.spec.json ]; then
203+
if [ -f "$sources"/.infer/report-block-list.spec.json ]; then
197204
# fp reports
198205
analyze_cmd+=( --report-block-list-spec="${sources}"/.infer/report-block-list-spec.json )
199206
fi
@@ -280,7 +287,7 @@ differential_to_main_branch()
280287
source "$sources"/VERSION
281288
branch=${MYSQL_VERSION_MAJOR}.${MYSQL_VERSION_MINOR}
282289

283-
pushd $sources
290+
pushd "$sources"
284291
merge_base=$(git merge-base "origin/$branch" "$commit")
285292
#mapfile -t commits < <(git rev-list "${merge_base}..${commit}")
286293
popd
@@ -319,6 +326,7 @@ differential_to_main_branch()
319326
## MAIN SCRIPT ##
320327
################################################################################
321328

329+
create_dirs
322330
host_cleanup
323331

324332
get_source

configuration/steps/commands/util.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os
12
from pathlib import PurePath
23

34
from buildbot.plugins import util
@@ -182,5 +183,8 @@ class InferScript(BashScriptCommand):
182183

183184
def __init__(self):
184185
branch = util.Interpolate("%(prop:branch)s")
185-
super().__init__(script_name="infer.sh", args=[branch])
186+
repository = util.Interpolate("%(prop:repository)s")
187+
environment = os.environ.get("ENVIRON")
188+
args = [branch, repository, environment]
189+
super().__init__(script_name="infer.sh", args=args)
186190
self.name = "Run Infer"

0 commit comments

Comments
 (0)