Whitelist feature improvements @QuinnStevens

Whitelist feature improvements @QuinnStevens
This commit is contained in:
Toni de la Fuente
2020-09-16 23:28:40 +02:00
committed by GitHub
2 changed files with 14 additions and 3 deletions

View File

@@ -112,13 +112,15 @@ textFail(){
level="FAIL"
colorcode="$BAD"
while read -r i; do
ignore_check_name="${i%:*}"
ignore_value="${i#*${CHECK_NAME}:}"
ignore_check_name="${i%%:*}" # Check name is everything up to the first :
ignore_value="${i#*${CHECK_NAME}:}" # Ignore value is everything after the first :
# Check to see if ignore value appears anywhere within log message.
resource_value=".*${ignore_value}.*"
if [[ ${ignore_check_name} != "${CHECK_NAME}" ]]; then
# not for this check
continue
fi
if [[ $1 =~ .*"${ignore_value}".* ]]; then
if [[ $1 =~ ${resource_value} ]]; then
level="WARNING"
colorcode="$WARNING"
break

View File

@@ -3,6 +3,11 @@
# Example: Will not consider a myignoredbucket failures as full failure. (Still printed as a warning)
check26:myignoredbucket
# Note that by default, this searches for the string appearing *anywhere* in the resource name.
# For example:
# extra718:ci-logs # Will block bucket "ci-logs" AND ALSO bucket "ci-logs-replica"
# extra718:logs # Will block EVERY BUCKET containing the string "logs"
# line starting with # are ignored as comments
# add a line per resource as here:
#<checkid1>:<resource to ignore 1>
@@ -10,3 +15,7 @@ check26:myignoredbucket
# checkid2
#<checkid2>:<resource to ignore 1>
# REGEXES
# This whitelist works with regexes (ERE, the same style of regex as grep -E and bash's =~ use)
# therefore:
# extra718:[[:alnum:]]+-logs # will ignore all buckets containing the terms ci-logs, qa-logs, etc.