Skip to content

Commit e19d2bb

Browse files
committed
Apply suggestions from j-rivero
* Add error message and return 1 if whitelist not found * Use tokens[0] in error message * Compare to */* without quotes Signed-off-by: Steve Peters <scpeters@intrinsic.ai>
1 parent 5a82b40 commit e19d2bb

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

jenkins-scripts/lib/_homebrew_brewfiles.bash

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ validate_brew_bundle_repo() {
1919

2020
if [[ ! -f ${whitelist_file} ]]; then
2121
# Not found whitelist file
22-
echo ""
22+
echo "ERROR: homebrew whitelist file not found: ${whitelist_file}" >&2
23+
return 1
2324
fi
2425

2526
IFS=$'\n' repos=($(cat ${whitelist_file}))
@@ -48,7 +49,7 @@ validate_brewfile() {
4849
# Check to make sure the brew command is allowed
4950
local brew_cmd=$(validate_brew_bundle_cmd ${tokens[0]})
5051
if [[ ${brew_cmd} == "" ]]; then
51-
echo "brew bundle command not allowed: ${brew_cmd}"
52+
echo "brew bundle command not allowed: ${tokens[0]}"
5253
return 1
5354
fi
5455
# The token that follows the brew command may contain the repo name
@@ -69,7 +70,7 @@ validate_brewfile() {
6970
if [[ ${brew_cmd} == "tap" ]]; then
7071
validated_repo=$(validate_brew_bundle_repo ${repo})
7172
else
72-
if [[ ${repo} == "*/*" ]]; then
73+
if [[ ${repo} == */* ]]; then
7374
repo="${repo%/*}"
7475
validated_repo=$(validate_brew_bundle_repo ${repo})
7576
else

0 commit comments

Comments
 (0)