1414
1515# Testing this version
1616branch=$1
17+ repository=${2:- " https://github.com/MariaDB/server.git" }
18+ environment=${3:- " PROD" }
1719
1820if [ -z " $branch " ]; then
1921 echo " usage $0 {branch/commit}" >&2
@@ -28,8 +30,8 @@ trap "cleanup_for_CI" EXIT
2830
2931base=$PWD
3032result_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.
3436max_usage=75 # maximum disk usage (in percent)
3537limit=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
4654get_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()
193200analyze ()
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
322330host_cleanup
323331
324332get_source
0 commit comments