Skip to content

Commit 7418249

Browse files
Merge pull request #21 from gitbito/release/1.2.9
exclude branches property added in bash script
2 parents 428402f + 53c62bc commit 7418249

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

cra-scripts/bito-cra.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ dependency_check.snyk_auth_token=
1414
review_comments=2
1515
server_port=10051
1616
cra_version=latest
17+
exclude_branches=

cra-scripts/bito-cra.ps1

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,7 @@ $optional_params_cli = @(
355355
"static_analysis",
356356
"static_analysis_tool",
357357
"review_scope",
358+
"exclude_branches",
358359
"dependency_check",
359360
"dependency_check.snyk_auth_token",
360361
"cra_version",
@@ -379,6 +380,7 @@ $optional_params_server = @(
379380
"static_analysis",
380381
"static_analysis_tool",
381382
"review_scope",
383+
"exclude_branches",
382384
"dependency_check",
383385
"dependency_check.snyk_auth_token",
384386
"server_port",
@@ -423,6 +425,7 @@ $mode = "cli"
423425
$param_mode = "mode"
424426
$server_port = "10051"
425427
$param_server_port = "server_port"
428+
$command = "review"
426429
$docker_cmd = ""
427430
# handle if CRA is starting in server mode using start command.
428431
if ($force_mode) {
@@ -454,7 +457,7 @@ foreach ($param in $required_params) {
454457
foreach ($param in $optional_params) {
455458
if ($param -eq "dependency_check.snyk_auth_token" -and $props["dependency_check"] -eq "True") {
456459
Ask-For-Param $param $false
457-
} elseif ($param -ne "dependency_check.snyk_auth_token" -and $param -ne "env" -and $param -ne "cli_path" -and $param -ne "output_path" -and $param -ne "static_analysis_tool" -and $param -ne "git.domain" -and $param -ne "review_scope") {
460+
} elseif ($param -ne "dependency_check.snyk_auth_token" -and $param -ne "env" -and $param -ne "cli_path" -and $param -ne "output_path" -and $param -ne "static_analysis_tool" -and $param -ne "git.domain" -and $param -ne "review_scope" -and $param -ne "exclude_branches") {
458461
Ask-For-Param $param $false
459462
}
460463
}
@@ -471,7 +474,7 @@ foreach ($param in $required_params + $bee_params + $optional_params) {
471474
} elseif ($param -eq "pr_url") {
472475
$trimmedUrl = $props[$param].Trim()
473476
Validate-Url $trimmedUrl
474-
$docker_cmd += " --$param=$($trimmedUrl) review"
477+
$docker_cmd += " --$param=$($trimmedUrl) --command=$($command) rest"
475478
} elseif ($param -eq "git.provider") {
476479
$validated_gitprovider = Validate-GitProvider $props[$param]
477480
$docker_cmd += " --$param=$validated_gitprovider"
@@ -483,6 +486,8 @@ foreach ($param in $required_params + $bee_params + $optional_params) {
483486
} elseif ($param -eq "review_scope") {
484487
$scopes = $($props[$param]) -replace ',\s*', ','
485488
$docker_cmd += " --$param='[$scopes]'"
489+
} elseif ($param -eq "exclude_branches") {
490+
$docker_cmd += " --exclude_branches=$($props[$param])"
486491
} elseif ($param -eq "dependency_check") {
487492
$validated_boolean = Validate-Boolean $props[$param]
488493
$docker_cmd += " --dependency_check.enabled=$validated_boolean"

cra-scripts/bito-cra.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,7 @@ optional_params_cli=(
372372
"static_analysis"
373373
"static_analysis_tool"
374374
"review_scope"
375+
"exclude_branches"
375376
"dependency_check"
376377
"dependency_check.snyk_auth_token"
377378
"cra_version"
@@ -396,6 +397,7 @@ optional_params_server=(
396397
"static_analysis"
397398
"static_analysis_tool"
398399
"review_scope"
400+
"exclude_branches"
399401
"dependency_check"
400402
"dependency_check.snyk_auth_token"
401403
"server_port"
@@ -434,6 +436,7 @@ required_params=("${required_params_cli[@]}")
434436
optional_params=("${optional_params_cli[@]}")
435437
mode="cli"
436438
param_mode="mode"
439+
command="review"
437440
docker_cmd=""
438441
#handle if CRA is starting in server mode using start command.
439442
if [ -n "$force_mode" ]; then
@@ -465,7 +468,7 @@ done
465468
for param in "${optional_params[@]}"; do
466469
if [ "$param" == "dependency_check.snyk_auth_token" ] && [ "${props["dependency_check"]}" == "True" ]; then
467470
ask_for_param "$param" "False"
468-
elif [ "$param" != "dependency_check.snyk_auth_token" ] && [ "$param" != "env" ] && [ "$param" != "cli_path" ] && [ "$param" != "output_path" ] && [ "$param" != "static_analysis_tool" ] && [ "$param" != "git.domain" ] && [ "$param" != "review_scope" ]; then
471+
elif [ "$param" != "dependency_check.snyk_auth_token" ] && [ "$param" != "env" ] && [ "$param" != "cli_path" ] && [ "$param" != "output_path" ] && [ "$param" != "static_analysis_tool" ] && [ "$param" != "git.domain" ] && [ "$param" != "review_scope" ] && [ "$param" != "exclude_branches" ]; then
469472
ask_for_param "$param" "False"
470473
fi
471474
done
@@ -486,7 +489,7 @@ for param in "${required_params[@]}" "${bee_params[@]}" "${optional_params[@]}";
486489
#validate the URL
487490
trimmed_url=$(echo "${props[$param]}" | sed 's/^[ \t]*//;s/[ \t]*$//')
488491
validate_url $trimmed_url
489-
docker_cmd+=" --$param=${trimmed_url} review"
492+
docker_cmd+=" --$param=${trimmed_url} --command='${command}' rest"
490493
elif [ "$param" == "git.provider" ]; then
491494
#validate the URL
492495
props[$param]=$(validate_git_provider "${props[$param]}")
@@ -500,6 +503,8 @@ for param in "${required_params[@]}" "${bee_params[@]}" "${optional_params[@]}";
500503
elif [ "$param" == "review_scope" ]; then
501504
scopes=$(echo ${props[$param]} | sed 's/, */,/g')
502505
docker_cmd+=" --review_scope='[$scopes]'"
506+
elif [ "$param" == "exclude_branches" ]; then
507+
docker_cmd+=" --exclude_branches=${props[$param]}"
503508
elif [ "$param" == "dependency_check" ]; then
504509
#validate the dependency check boolean value
505510
props[$param]=$(validate_boolean "${props[$param]}")

0 commit comments

Comments
 (0)