From: Thomas Monjalon <thomas.monjalon@6wind.com> To: ci@dpdk.org Subject: [dpdk-ci] [PATCH v3 5/7] tools: add per-patch report mailer Date: Thu, 1 Dec 2016 17:58:59 +0100 Message-ID: <1480611541-17439-6-git-send-email-thomas.monjalon@6wind.com> (raw) In-Reply-To: <1480611541-17439-1-git-send-email-thomas.monjalon@6wind.com> The report sent by this script will be parsed and integrated in patchwork if the patch was public. Otherwise it will just send the report to the patch submitter. Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com> --- config/ci.config | 3 ++ tools/send-patch-report.sh | 128 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 131 insertions(+) create mode 100755 tools/send-patch-report.sh diff --git a/config/ci.config b/config/ci.config index 722aeb5..b3b0376 100644 --- a/config/ci.config +++ b/config/ci.config @@ -3,5 +3,8 @@ # or ~/.config/dpdk/ci.config # or .ciconfig +# The mailer (sendmail, mail, mailx) must support the option -t +# export DPDK_CI_MAILER=/usr/sbin/sendmail + # The pwclient script is part of patchwork and is copied in dpdk-ci # export DPDK_CI_PWCLIENT=tools/pwclient diff --git a/tools/send-patch-report.sh b/tools/send-patch-report.sh new file mode 100755 index 0000000..716e8e3 --- /dev/null +++ b/tools/send-patch-report.sh @@ -0,0 +1,128 @@ +#! /bin/sh -e + +# BSD LICENSE +# +# Copyright 2016 6WIND S.A. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of 6WIND S.A. nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +print_usage () { + cat <<- END_OF_HELP + usage: $(basename $0) [options] < report + + Send test report in a properly formatted email for patchwork integration. + The report is submitted to this script via stdin. + + options: + -t title subject of the patch email + -f from sender of the patch email + -m msgid id of the patch email + -p listid mailing list publishing the patch + -l label title of the test + -s status one of these test results: SUCCESS, WARNING, FAILURE + -d desc few words to better describe the status + -h this help + END_OF_HELP +} + +. $(dirname $(readlink -e $0))/load-ci-config.sh +sendmail=${DPDK_CI_MAILER:-/usr/sbin/sendmail} +pwclient=${DPDK_CI_PWCLIENT:-$(dirname $(readlink -m $0))/pwclient} + +unset title +unset from +unset msgid +unset listid +unset label +unset status +unset desc +while getopts d:f:hl:m:p:s:t: arg ; do + case $arg in + t ) title=$OPTARG ;; + f ) from=$OPTARG ;; + m ) msgid=$OPTARG ;; + p ) listid=$OPTARG ;; + l ) label=$OPTARG ;; + s ) status=$OPTARG ;; + d ) desc=$OPTARG ;; + h ) print_usage ; exit 0 ;; + ? ) print_usage >&2 ; exit 1 ;; + esac +done +shift $(($OPTIND - 1)) +if [ -t 0 ] ; then + printf 'nothing to read on stdin\n\n' >&2 + print_usage >&2 + exit 1 +fi +report=$(cat) + +writeheaders () # <subject> <ref> <to> [cc] +{ + echo "Subject: $1" + echo "In-Reply-To: $2" + echo "References: $2" + echo "To: $3" + [ -z "$4" ] || echo "Cc: $4" + echo +} + +writeheadlines () # <label> <status> <description> [pwid] +{ + echo "Test-Label: $1" + echo "Test-Status: $2" + [ -z "$4" ] || echo "http://dpdk.org/patch/$4" + echo + echo "_${3}_" + echo +} + +if echo "$listid" | grep -q 'dev.dpdk.org' ; then + # get patchwork id + if [ -n "$msgid" ] ; then + for try in $(seq 20) ; do + pwid=$($pwclient list -f '%{id}' -m "$msgid") + [ -n "$pwid" ] && break || sleep 7 + done + fi + [ -n "$pwid" ] || pwid='?' + # send public report + subject=$(echo $title | sed 's,\[dpdk-dev\] ,,') + [ "$status" = 'SUCCESS' ] && cc='' || cc="$from" + ( + writeheaders "|$status| $subject" "$msgid" 'test-report@dpdk.org' "$cc" + writeheadlines "$label" "$status" "$desc" "$pwid" + echo "$report" + ) | $sendmail -t +else + # send private report + ( + writeheaders "Re: $title" "$msgid" "$from" + writeheadlines "$label" "$status" "$desc" + echo "$report" + ) | $sendmail -t +fi -- 2.7.0
next prev parent reply other threads:[~2016-12-01 16:59 UTC|newest] Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top 2016-11-25 17:02 [dpdk-ci] [PATCH 0/7] first scripts for CI integration Thomas Monjalon 2016-11-25 17:02 ` [dpdk-ci] [PATCH 1/7] tools: add mail filter Thomas Monjalon 2016-11-25 17:02 ` [dpdk-ci] [PATCH 2/7] tools: add mail parser Thomas Monjalon 2016-11-25 17:02 ` [dpdk-ci] [PATCH 3/7] config: add loader and template Thomas Monjalon 2016-11-25 17:02 ` [dpdk-ci] [PATCH 4/7] tools: add patchwork client Thomas Monjalon 2016-11-25 17:02 ` [dpdk-ci] [PATCH 5/7] tools: add per-patch report mailer Thomas Monjalon 2016-11-25 17:02 ` [dpdk-ci] [PATCH 6/7] tools: add patchwork integration Thomas Monjalon 2016-11-25 17:02 ` [dpdk-ci] [PATCH 7/7] tests: add checkpatch Thomas Monjalon 2016-12-01 13:44 ` [dpdk-ci] [PATCH v2 0/7] first scripts for CI integration Thomas Monjalon 2016-12-01 13:44 ` [dpdk-ci] [PATCH v2 1/7] tools: add mail filter Thomas Monjalon 2016-12-01 13:44 ` [dpdk-ci] [PATCH v2 2/7] tools: add mail parser Thomas Monjalon 2016-12-01 13:44 ` [dpdk-ci] [PATCH v2 3/7] config: add loader and template Thomas Monjalon 2016-12-01 13:44 ` [dpdk-ci] [PATCH v2 4/7] tools: add patchwork client Thomas Monjalon 2016-12-01 13:44 ` [dpdk-ci] [PATCH v2 5/7] tools: add per-patch report mailer Thomas Monjalon 2016-12-01 13:44 ` [dpdk-ci] [PATCH v2 6/7] tools: add patchwork integration Thomas Monjalon 2016-12-01 13:44 ` [dpdk-ci] [PATCH v2 7/7] tests: add checkpatch Thomas Monjalon 2016-12-01 16:58 ` [dpdk-ci] [PATCH v3 0/7] first scripts for CI integration Thomas Monjalon 2016-12-01 16:58 ` [dpdk-ci] [PATCH v3 1/7] tools: add mail filter Thomas Monjalon 2016-12-01 16:58 ` [dpdk-ci] [PATCH v3 2/7] tools: add mail parser Thomas Monjalon 2016-12-01 16:58 ` [dpdk-ci] [PATCH v3 3/7] config: add loader and template Thomas Monjalon 2016-12-01 16:58 ` [dpdk-ci] [PATCH v3 4/7] tools: add patchwork client Thomas Monjalon 2016-12-01 16:58 ` Thomas Monjalon [this message] 2016-12-01 16:59 ` [dpdk-ci] [PATCH v3 6/7] tools: add patchwork integration Thomas Monjalon 2016-12-01 16:59 ` [dpdk-ci] [PATCH v3 7/7] tests: add checkpatch Thomas Monjalon 2016-12-05 13:26 ` [dpdk-ci] [PATCH v4 0/7] first scripts for CI integration Thomas Monjalon 2016-12-05 13:26 ` [dpdk-ci] [PATCH v4 1/7] tools: add mail filter Thomas Monjalon 2016-12-05 13:26 ` [dpdk-ci] [PATCH v4 2/7] tools: add mail parser Thomas Monjalon 2016-12-05 13:26 ` [dpdk-ci] [PATCH v4 3/7] config: add loader and template Thomas Monjalon 2016-12-05 13:26 ` [dpdk-ci] [PATCH v4 4/7] tools: add patchwork client Thomas Monjalon 2016-12-05 13:26 ` [dpdk-ci] [PATCH v4 5/7] tools: add per-patch report mailer Thomas Monjalon 2016-12-05 13:26 ` [dpdk-ci] [PATCH v4 6/7] tools: add patchwork integration Thomas Monjalon 2016-12-05 13:26 ` [dpdk-ci] [PATCH v4 7/7] tests: add checkpatch Thomas Monjalon 2016-12-06 6:34 ` Wei, FangfangX 2016-12-06 8:40 ` Thomas Monjalon 2016-12-06 9:04 ` Wei, FangfangX 2016-12-07 5:48 ` Wei, FangfangX 2016-12-07 9:32 ` Thomas Monjalon 2016-12-08 9:02 ` Wei, FangfangX 2016-12-08 13:11 ` Thomas Monjalon 2016-12-09 8:51 ` Wei, FangfangX 2016-12-09 9:16 ` Thomas Monjalon 2016-12-09 10:07 ` Mcnamara, John 2016-12-09 10:11 ` Thomas Monjalon 2016-12-09 12:11 ` Mcnamara, John 2016-12-12 9:27 ` Wei, FangfangX 2016-12-12 9:34 ` Wei, FangfangX 2016-12-12 9:58 ` Thomas Monjalon 2016-12-13 8:29 ` Wei, FangfangX 2016-12-13 8:49 ` Thomas Monjalon 2016-12-13 9:24 ` Wei, FangfangX 2016-12-21 11:45 ` Thomas Monjalon 2016-12-12 9:39 ` Thomas Monjalon 2016-12-13 8:22 ` Wei, FangfangX 2016-12-14 23:05 ` [dpdk-ci] [PATCH v5 0/9] first scripts for CI integration Thomas Monjalon 2016-12-14 23:05 ` [dpdk-ci] [PATCH v5 1/9] tools: add mail filter Thomas Monjalon 2016-12-14 23:05 ` [dpdk-ci] [PATCH v5 2/9] tools: add mail parser Thomas Monjalon 2016-12-14 23:05 ` [dpdk-ci] [PATCH v5 3/9] config: add loader and template Thomas Monjalon 2016-12-14 23:05 ` [dpdk-ci] [PATCH v5 4/9] tools: add patchwork client Thomas Monjalon 2016-12-14 23:05 ` [dpdk-ci] [PATCH v5 5/9] tools: fix pwclient for proxy and python 3 Thomas Monjalon 2016-12-14 23:05 ` [dpdk-ci] [PATCH v5 6/9] tools: add patch mail download Thomas Monjalon 2016-12-14 23:05 ` [dpdk-ci] [PATCH v5 7/9] tools: add per-patch report mailer Thomas Monjalon 2016-12-14 23:05 ` [dpdk-ci] [PATCH v5 8/9] tools: add patchwork integration Thomas Monjalon 2016-12-14 23:05 ` [dpdk-ci] [PATCH v5 9/9] tests: add checkpatch Thomas Monjalon 2016-12-21 11:46 ` [dpdk-ci] [PATCH v5 0/9] first scripts for CI integration Thomas Monjalon
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1480611541-17439-6-git-send-email-thomas.monjalon@6wind.com \ --to=thomas.monjalon@6wind.com \ --cc=ci@dpdk.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
DPDK CI discussions This inbox may be cloned and mirrored by anyone: git clone --mirror http://inbox.dpdk.org/ci/0 ci/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ci ci/ http://inbox.dpdk.org/ci \ ci@dpdk.org public-inbox-index ci Example config snippet for mirrors. Newsgroup available over NNTP: nntp://inbox.dpdk.org/inbox.dpdk.ci AGPL code for this site: git clone https://public-inbox.org/public-inbox.git