Fix the URL to send the email report 82/21082/1
authorKhouloud Touil <ktouil@baylibre.com>
Fri, 19 Apr 2019 12:30:35 +0000 (14:30 +0200)
committerKhouloud Touil <ktouil@baylibre.com>
Fri, 19 Apr 2019 12:35:11 +0000 (14:35 +0200)
The 'LAVA_MASTER_URI' used is wrong, this patch fixes the url.
It adds also a check on the output of lavacli command before to send the
test email report.

Change-Id: I156024e2ee4f268a4631a5723438683eb6f2df39
Signed-off-by: Khouloud Touil <ktouil@baylibre.com>
jjb/common/include-agl-lava-jobs-submit.sh

index fa00fd4..d73c617 100644 (file)
@@ -85,14 +85,17 @@ if [ -n "$KCI_EMAIL_AUTH_TOKEN" ]; then
        TREE_NAME=$(grep kernel.tree: $JOB_FILE_NEW | sed 's,[[:space:]],,g' | cut -d: -f2)
        BRANCH=$(grep git.branch: $JOB_FILE_NEW | sed 's,[[:space:]],,g' | cut -d: -f2)
        GIT_DESCRIBE="$(grep kernel.version: $JOB_FILE_NEW | sed 's,[[:space:]],,g' | cut -d: -f2)"
-       lavacli --uri $LAVA_MASTER_URI results $job_id | grep '* [0-9]' |cut -d_ -f2- |cut -d. -f1 | sort | uniq > test_plans
-       if [ $? -eq 0 ] && [ -s test_plans ]; then
-               for plan in $(<test_plans); do
-                       curl -X POST -H "Authorization: $KCI_EMAIL_AUTH_TOKEN" -H "Content-Type: application/json" -d '{"job": "'$TREE_NAME'", "kernel": "'$GIT_DESCRIBE'", "git_branch": "'$BRANCH'", "report_type": "test", "plan": "'$plan'", "send_to": [" automotive-testreports@lists.linuxfoundation.org"], "format": ["txt"], "delay": 3600}' ${KCI_API}/send
-                       echo "The test email reportS will be sent with a delay of 1 hour "
-               done
-       else
-               echo "There is no test plan identified"
+       lavacli -i $lab results $job_id > test_plan.raw
+       if [ $? -eq 0 ]; then
+               grep '* [0-9]' test_plan.raw |cut -d_ -f2- |cut -d. -f1 | sort | uniq > test_plans
+               if [ $? -eq 0 ] && [ -s test_plans ]; then
+                       for plan in $(<test_plans); do
+                               curl -X POST -H "Authorization: $KCI_EMAIL_AUTH_TOKEN" -H "Content-Type: application/json" -d '{"job": "'$TREE_NAME'", "kernel": "'$GIT_DESCRIBE'", "git_branch": "'$BRANCH'", "report_type": "test", "plan": "'$plan'", "send_to": [" automotive-testreports@lists.linuxfoundation.org"], "format": ["txt"], "delay": 3600}' ${KCI_API}/send
+                               echo "The test email reportS will be sent with a delay of 1 hour "
+                       done
+               else
+                       echo "There is no test plan identified"
+               fi
        fi
 fi
 set +x