From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f51.google.com (mail-wm0-f51.google.com [74.125.82.51]) by dpdk.org (Postfix) with ESMTP id 3C0F42A5D for ; Thu, 15 Dec 2016 00:05:36 +0100 (CET) Received: by mail-wm0-f51.google.com with SMTP id a197so136967507wmd.0 for ; Wed, 14 Dec 2016 15:05:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=fiZulutwGCJewgrf1b55eNpCANWjZyXIMKaqAB8d4ro=; b=EJIRLLiWaXtMykOKPpTQcH2vZTwSiO+uDwOuIZFRVdgnx3ZnINhnlZkBhGfaHPL65d 7Ts9VTVdM4q6wAtaoCcVZGQ4GxHKA/uPZf1K48oS+gAjspmE0LVqJubd0M5SdqfntfOf QUAkx/T6XwaOm1CPqXhiaD73U9H0UcG0gBYJJESLUdtPC0Zwwt8hIH/x4wYeYTeRMbfH t0iCV98JIPriFdQTXmK2FDYSWqa0UZawnYEcLG5uq8lmiXvqlhqLp+dCtMpl9tnHbaIJ N4U77DKfRO3JIlKKoPpBJNHd2fS8OCbCUe6mvftaeyasK1k/S2o6qKd+NnO4+FC1RJtz sFvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=fiZulutwGCJewgrf1b55eNpCANWjZyXIMKaqAB8d4ro=; b=T7QJ3OUiqk4aSSM8wx0PZfZjA5l5pTtqmS+riA1cDrawY8pgcM/VzT03EzjUhVd/yo 8afpdezLfwvKwl3yUSeGwWlPVbcx9pma8okxXwc9tJrl+cWKyDa0284ENCrEYg9QheX0 RPbnOtAEy2roToJ6x3uaFhkbo72eDQfieZBztstP6dhXT/u0Ff1FAJmP5MgGNIPUjqlQ UP/3EkU7J6O22V1h+0j7mOvQ9bEXad5ue1I5bjMe5CaCeJlXQuxFi78bgyOo2Bo9nasZ EzsljQBO8Vvy+YOU3z04DyKftAotJCrJjqU6nk7L/aGvWgx7NncyxjHthFAXe85U0amC MaTA== X-Gm-Message-State: AKaTC01t8VOCdTU6LHGFyKl0PcvptBbEVNhtMZQfl3BeVlfbdBx6oKRRL/vtf98aYO04DInc X-Received: by 10.28.36.87 with SMTP id k84mr9814078wmk.64.1481756735667; Wed, 14 Dec 2016 15:05:35 -0800 (PST) Received: from XPS13.localdomain (184.203.134.77.rev.sfr.net. [77.134.203.184]) by smtp.gmail.com with ESMTPSA id v2sm69378887wja.41.2016.12.14.15.05.34 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 14 Dec 2016 15:05:34 -0800 (PST) From: Thomas Monjalon To: ci@dpdk.org Date: Thu, 15 Dec 2016 00:05:21 +0100 Message-Id: <1481756723-4868-8-git-send-email-thomas.monjalon@6wind.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1481756723-4868-1-git-send-email-thomas.monjalon@6wind.com> References: <1480944373-10233-1-git-send-email-thomas.monjalon@6wind.com> <1481756723-4868-1-git-send-email-thomas.monjalon@6wind.com> Subject: [dpdk-ci] [PATCH v5 7/9] tools: add per-patch report mailer X-BeenThere: ci@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK CI discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Dec 2016 23:05:36 -0000 Archived-At: List-Archive: 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 --- README | 1 + config/ci.config | 3 ++ tools/send-patch-report.sh | 131 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 135 insertions(+) create mode 100755 tools/send-patch-report.sh diff --git a/README b/README index f662f6d..b030175 100644 --- a/README +++ b/README @@ -44,6 +44,7 @@ The sender must be trusted (whitelisted) by dpdk.org. If a report has the format of a "per-patch" test, it is automatically integrated in patchwork. +The script send-patch-report.sh should be used. Scripts help 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..7f78316 --- /dev/null +++ b/tools/send-patch-report.sh @@ -0,0 +1,131 @@ +#! /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 pwid id of the patch in patchwork (retrieved from msgid otherwise) + -o listid origin of 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 pwid +unset listid +unset label +unset status +unset desc +while getopts d:f:hl:m:o:p:s:t: arg ; do + case $arg in + t ) title=$OPTARG ;; + f ) from=$OPTARG ;; + m ) msgid=$OPTARG ;; + p ) pwid=$OPTARG ;; + o ) 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 () # [cc] +{ + echo "Subject: $1" + echo "In-Reply-To: $2" + echo "References: $2" + echo "To: $3" + [ -z "$4" ] || echo "Cc: $4" + echo +} + +writeheadlines () #