[PATCH v2 lkp-tests 2/2] tests: add email

send email to user when test job failed Signed-off-by: Wei Jihui <weijihuiall@163.com> --- tests/email | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 tests/email diff --git a/tests/email b/tests/email new file mode 100755 index 00000000..40b48fd9 --- /dev/null +++ b/tests/email @@ -0,0 +1,40 @@ +#!/bin/sh +# - my_email +# - info + +: ${info:=failure} + +SCRIPT_DIR=$(dirname $(realpath $0)) +PROJECT_DIR=$(dirname $SCRIPT_DIR) + +. $PROJECT_DIR/lib/http.sh +. $PROJECT_DIR/lib/env.sh + +data_failure() +{ + data="To: $my_email +Subject: [NOTIFY Compass-ci] Test job failed + +Dear $my_name: + + Sorry to inform you that your test job is failed. you can click the following link to view details. + http://api.compass-ci.openeuler.org:$SRV_HTTP_PORT/$result_root + +Regards +Compass-Ci +" +} + +compose_email() +{ + [ "$info" == "failure" ] && data_failure +} + +run_email() +{ + [ -n "$my_email" ] || return 0 + compose_email + curl -XPOST "${MAIL_HOST:-$LKP_SERVER}:${MAIL_PORT:-49000}/send_mail_text" -d "$data" +} + +run_email -- 2.23.0

+ http://api.compass-ci.openeuler.org:$SRV_HTTP_PORT/$result_root
SRV_HTTP_PORT is used in several client side, however I cannot grep SRV_HTTP_PORT in the container that provides the service. Would you help fix the service side to use SRV_HTTP_xxx? Thanks, Fengguang
participants (2)
-
Wei Jihui
-
Wu Fengguang