From 29d66a104a35cbf35fcb39503bed0d46380a4a86 Mon Sep 17 00:00:00 2001 From: Corentin LABBE Date: Wed, 11 Sep 2019 20:49:34 +0200 Subject: SPEC-2703: do not fail with set -xe This patch move the grepping test inside the if for not failling due to set -xe For the same reason, harden the code checking if git clone was successfull. Change-Id: Idb0619c4e90c9a3a0654a024fbd2166e49df98c6 Bug-AGL: SPEC-2703 Signed-off-by: Corentin LABBE --- jjb/common/include-agl-lava-jobs-submit.sh | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'jjb/common/include-agl-lava-jobs-submit.sh') diff --git a/jjb/common/include-agl-lava-jobs-submit.sh b/jjb/common/include-agl-lava-jobs-submit.sh index 82482130..dbb1f93e 100644 --- a/jjb/common/include-agl-lava-jobs-submit.sh +++ b/jjb/common/include-agl-lava-jobs-submit.sh @@ -68,25 +68,25 @@ echo "####" handle_skiplist() { SKIPLIST=skiplist # detect job type (apps vs non-apps) and get skiplist - echo $JOB_NAME | grep -q 'ci-platform' - if [ $? -eq 0 ];then - git clone https://${GERRIT_HOST}/gerrit/src/qa-testdefinitions.git - if [ $? -ne ];then + if [ ! -z "$(echo $JOB_NAME | grep 'ci-platform')" ];then + git clone https://${GERRIT_HOST}/gerrit/src/qa-testdefinitions.git || true + if [ ! -e qa-testdefinitions ];then echo "ERROR: fail to get qa-testdefinitions" - return 1 + return 0 fi SKIPDIR=qa-testdefinitions/skiplists/ SKIPFILE=common CK_REPO_NAME="qa-testdefinitions" else - git clone https://${GERRIT_HOST}/gerrit/${GERRIT_PROJECT}.git - if [ $? -ne ];then + git clone https://${GERRIT_HOST}/gerrit/${GERRIT_PROJECT}.git || true + # GERRIT_PROJECT could have a / in it + CK_REPO_NAME="$(basename ${GERRIT_PROJECT})" + if [ ! -e $CK_REPO_NAME ];then echo "ERROR: fail to get $GERRIT_PROJECT" - return 1 + return 0 fi - SKIPDIR=${GERRIT_PROJECT}/ + SKIPDIR=${CK_REPO_NAME}/ SKIPFILE=.aglci - CK_REPO_NAME="${GERRIT_PROJECT}" fi for skipfile in $SKIPFILE $MACHINE ${GERRIT_PROJECT} do @@ -111,8 +111,7 @@ handle_skiplist() { do # Check if fail are "normal/accepted" TESTNAME=$(echo $testline | cut -d' ' -f2) - grep -q $TESTNAME $SKIPLIST - if [ $? -ne 0 ];then + if [ -z "$(grep $TESTNAME $SKIPLIST)" ];then echo "DEBUG: $TESNAME not in skiplist" GOODJOB=0 else -- cgit 1.2.3-korg