aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVratko Polak <vrpolak@cisco.com>2020-12-01 11:41:18 +0100
committerVratko Polak <vrpolak@cisco.com>2020-12-01 15:38:05 +0000
commit146887a5320558de212d187c5191be51f78deb52 (patch)
tree41b446e186d2f8e99adaf7fb7974d1e3cd22df34
parent849ff8bf85ad3c9c1379c63c43b44dfd425c1647 (diff)
Tolerate base64 encoded Gerrit comments
+ Move "|| true" to a place that really aviods errors. + Attemp to parse decoded string if trigger is not found in plain one. Change-Id: If3587229ec588f9ad41acb3050add1142032d2d8 Signed-off-by: Vratko Polak <vrpolak@cisco.com> (cherry picked from commit 4582f0f408616cdff8e606ac3abfe154f8f0514b) (cherry picked from commit f89bc7a87e0b6015e50de3557a1724c8aaafbf60)
-rw-r--r--resources/libraries/bash/function/common.sh10
1 files changed, 8 insertions, 2 deletions
diff --git a/resources/libraries/bash/function/common.sh b/resources/libraries/bash/function/common.sh
index a144b3cc3a..af59bc4ed3 100644
--- a/resources/libraries/bash/function/common.sh
+++ b/resources/libraries/bash/function/common.sh
@@ -519,14 +519,20 @@ function get_test_tag_string () {
die "Unknown specification: ${TEST_CODE}"
esac
# Ignore lines not containing the trigger word.
- comment=$(fgrep "${trigger}" <<< "${GERRIT_EVENT_COMMENT_TEXT}") || true
+ comment=$(fgrep "${trigger}" <<< "${GERRIT_EVENT_COMMENT_TEXT}" || true)
# The vpp-csit triggers trail stuff we are not interested in.
# Removing them and trigger word: https://unix.stackexchange.com/a/13472
# (except relying on \s whitespace, \S non-whitespace and . both).
# The last string is concatenated, only the middle part is expanded.
cmd=("grep" "-oP" '\S*'"${trigger}"'\S*\s\K.+$') || die "Unset trigger?"
# On parsing error, TEST_TAG_STRING probably stays empty.
- TEST_TAG_STRING=$("${cmd[@]}" <<< "${comment}") || true
+ TEST_TAG_STRING=$("${cmd[@]}" <<< "${comment}" || true)
+ if [[ -z "${TEST_TAG_STRING-}" ]]; then
+ # Probably we got a base64 encoded comment.
+ comment=$(base64 --decode <<< "${GERRIT_EVENT_COMMENT_TEXT}" || true)
+ comment=$(fgrep "${trigger}" <<< "${comment}" || true)
+ TEST_TAG_STRING=$("${cmd[@]}" <<< "${comment}" || true)
+ fi
if [[ -n "${TEST_TAG_STRING-}" ]]; then
test_tag_array=(${TEST_TAG_STRING})
if [[ "${test_tag_array[0]}" == "icl" ]]; then