scripts: improve print message of automatic jenkins verification [1/1]
PD#SWPL-67525
Problem:
improve print message of automatic jenkins verification
Solution:
improve print message of automatic jenkins verification
Verify:
ad401_a113l
Change-Id: Id24e8da1d1893f3c51a94a1d5fdd057819c0ecfd
Signed-off-by: Kelvin Zhang <kelvin.zhang@amlogic.com>
diff --git a/gerrit_review.sh b/gerrit_review.sh
index ea68d9d..c16fa2d 100755
--- a/gerrit_review.sh
+++ b/gerrit_review.sh
@@ -17,22 +17,26 @@
[ ! -f "$GERRIT_QUERY_RESULT" ] && echo "${FUNCNAME[0]}: No such file! $GERRIT_QUERY_RESULT" && exit 1
[ $# -ne 1 ] && echo "${FUNCNAME[0]}: Invalid parameters! $*" && exit 1
- if [ "$1" = "Start" ]; then
- verify_param=""
- elif [ "$1" = "SUCCESS" ]; then
- verify_param="--verified +1"
+ if [ "$1" = "SUCCESS" ]; then
+ verify_score="+1"
elif [ "$1" = "FAIL" ]; then
- verify_param="--verified -1"
+ verify_score="-1"
else
echo "${FUNCNAME[0]}: Invalid parameter $1" && exit 1
fi
+ if [ "$1" = "Start" ]; then
+ verify_param=""
+ else
+ verify_param="--verified $verify_score"
+ echo -e "======== Verifying Gerrit Topic: $MANUAL_GERRIT_TOPIC ========"
+ fi
+
review_msg="Build ${BUILD_URL}: $1"
GERRIT_CHANGE_NUMBERS=$(jq -r '.number // empty' $GERRIT_QUERY_RESULT)
GERRIT_PATCHSET_NUMBERS=$(jq -r '.currentPatchSet.number // empty' $GERRIT_QUERY_RESULT)
- [ "$1" != "Start" ] && echo -e "======== Verifying Gerrit Topic: $MANUAL_GERRIT_TOPIC ========"
i=1
for GERRIT_CHANGE_NUMBER in $GERRIT_CHANGE_NUMBERS; do
GERRIT_PATCHSET_NUMBER=$(echo $GERRIT_PATCHSET_NUMBERS | awk "{print \$$i}")
@@ -40,7 +44,7 @@
ssh -p $GERRIT_PORT $GERRIT_SERVER gerrit review "${verify_param}" -m "'${review_msg}'" $GERRIT_CHANGE_NUMBER,$GERRIT_PATCHSET_NUMBER
if [ "$1" != "Start" ]; then
if [ "$?" -eq 0 ]; then
- echo "OK"
+ echo "done"
else
echo "failed"
fi
@@ -48,9 +52,11 @@
i=$((i+1))
done
- i=$((i-1))
- [ "$1" != "Start" ] && [ "$i" -eq 1 ] && echo -e "======== Verified $i Gerrit change for $MANUAL_GERRIT_TOPIC ========\n"
- [ "$1" != "Start" ] && [ "$i" -gt 1 ] && echo -e "======== Verified $i Gerrit changes for $MANUAL_GERRIT_TOPIC ========\n"
+ if [ "$1" != "Start" ]; then
+ i=$((i-1))
+ [ "$i" -eq 1 ] && echo -e "======== Verified $i Gerrit change for $MANUAL_GERRIT_TOPIC ========\n"
+ [ "$i" -gt 1 ] && echo -e "======== Verified $i Gerrit changes for $MANUAL_GERRIT_TOPIC ========\n"
+ fi
if [ "$1" = "FAIL" ]; then
exit 1