From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wj0-f178.google.com (mail-wj0-f178.google.com [209.85.210.178]) by dpdk.org (Postfix) with ESMTP id 0DA3658EF for ; Thu, 1 Dec 2016 14:45:08 +0100 (CET) Received: by mail-wj0-f178.google.com with SMTP id qp4so205072835wjc.3 for ; Thu, 01 Dec 2016 05:45:08 -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=iWFNSaJjuZ8qtn4CumdiJ4Y1B6FJ7VNX5VWYDbJIe2o=; b=i65aY6Iuc4Lqj0sflI8Hc5U225PGiQdciisreSN+HrmoWn3Z5UYxdtrxaSMdYYZMS0 cKHlii4SWO4yrcHUvZh+c0zxO1i3m0pYI7FFQF2qqX5SKvIqMUl6UKqDiruje8L8P1m1 yOSQPrPqZ9OQYN8qTaB+FME2nvlI903sSWu0/PrlZyqKrcFSE96IQo7GanAZdHxdkVht LjwykixOYEChs80W+CEcWmyU29wM66nkuR17dW6GfJorw+JrseOW+BM7Y5uKWHYzFIM6 epWF4dhPe9UAp3gmpS5BcL57zUJ4AyxR5zguIdIQlAFHpxbPW5aBnfGoIV2Mwq9j0G5J PTxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=iWFNSaJjuZ8qtn4CumdiJ4Y1B6FJ7VNX5VWYDbJIe2o=; b=l5bOtLBimSINmoXtKf7IRnyyqQjqWbxJrbMZi7eBo17odqpa+ZQxhnazXzQMeqbYm1 rlARghCEWpqxkTdv1+Svvsf1JRWP11lAvAuad4YfgHLoCihZs/qwwUvJEsMhqWAY+ahd 1vMJPiItWppgyghOgsTv9wuXgd57Iyl5ofWKquiLBR/FNEmtI3l5VFN3SuuuOdMh2b86 B9FXdWR3Ug6SwOUuq/ZMo4CPvzIPFCQOnrLR+kXT42B1WiB533UukpP739/lBaq6Nu0y C5W96WXqI+agDe1/Y11t9jMWJj9L4EGrMHI3Gr2wak9jRIc1QIAQeEnPHQ0nc2iQkQvI IQjg== X-Gm-Message-State: AKaTC02D7naylgw+yQnWQtG/xjhxAukLFcaYuR3TKY7Gk+F+mqULhCrP6ZIW9+V19LKUH1br X-Received: by 10.194.124.100 with SMTP id mh4mr37841327wjb.154.1480599907472; Thu, 01 Dec 2016 05:45:07 -0800 (PST) Received: from XPS13.localdomain (184.203.134.77.rev.sfr.net. [77.134.203.184]) by smtp.gmail.com with ESMTPSA id c202sm15808333wme.1.2016.12.01.05.45.06 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 01 Dec 2016 05:45:06 -0800 (PST) From: Thomas Monjalon To: ci@dpdk.org Date: Thu, 1 Dec 2016 14:44:51 +0100 Message-Id: <1480599892-14190-7-git-send-email-thomas.monjalon@6wind.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1480599892-14190-1-git-send-email-thomas.monjalon@6wind.com> References: <1480093334-29957-1-git-send-email-thomas.monjalon@6wind.com> <1480599892-14190-1-git-send-email-thomas.monjalon@6wind.com> Subject: [dpdk-ci] [PATCH v2 6/7] tools: add patchwork integration X-BeenThere: ci@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: CI discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Dec 2016 13:45:09 -0000 This script is run with patchwork admin credentials. It is typically installed on dpdk.org and run for each mail received in the test-report mailing list. Signed-off-by: Thomas Monjalon --- tools/update-pw.sh | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100755 tools/update-pw.sh diff --git a/tools/update-pw.sh b/tools/update-pw.sh new file mode 100755 index 0000000..7f10add --- /dev/null +++ b/tools/update-pw.sh @@ -0,0 +1,57 @@ +#! /bin/sh + +# This file is in the public domain. + +print_usage () { + cat <<- END_OF_HELP + usage: $(basename $0) + + Add or update a check in patchwork based on a test report. + The argument specifies only the last URL parts of the test-report + mailing list archives (month/id.html). + END_OF_HELP +} + +. $(dirname $(readlink -e $0))/load-ci-config.sh +pwclient=${DPDK_CI_PWCLIENT:-$(dirname $(readlink -m $0))/pwclient} + +while getopts h arg ; do + case $arg in + h ) print_usage ; exit 0 ;; + ? ) print_usage >&2 ; exit 1 ;; + esac +done +if [ -z "$1" ] ; then + printf 'missing argument\n\n' >&2 + print_usage >&2 + exit 1 +fi + +url="http://dpdk.org/ml/archives/test-report/$1" +mmarker='' +for try in $(seq 20) ; do + [ -z "$report" -o $try -ge 19 ] || continue # 2 last tries if got something + [ $try -le 1 ] || sleep 3 # no delay before first try + report=$(curl -sf $url | grep -m1 -A9 "$mmarker") || continue + echo "$report" | grep -q '^_.*_$' && break || continue +done +if [ -z "$report" ] ; then + echo "cannot download report at $url" >&2 + exit 2 +fi + +pwid=$(echo "$report" | sed -rn 's,.*http://.*dpdk.org/.*patch/([0-9]+).*,\1,p') +label=$(echo "$report" | sed -n 's,.*Test-Label: *,,p') +status=$(echo "$report" | sed -n 's,.*Test-Status: *,,p') +desc=$(echo "$report" | sed -n 's,^_\(.*\)_$,\1,p') +case $status in + 'SUCCESS') pwstatus='success' ;; + 'WARNING') pwstatus='warning' ;; + 'FAILURE') pwstatus='fail' ;; +esac +printf 'id = %s\nlabel = %s\nstatus = %s/%s %s\nurl = %s\n' \ + "$pwid" "$label" "$status" "$pwstatus" "$desc" "$url" +[ -n "$pwid" -a -n "$label" -a -n "$status" -a -n "$desc" ] || exit 3 + +pwclient=$(dirname $(readlink -m $0))/pwclient +$pwclient check-create -c "$label" -s "$pwstatus" -d "$desc" -u "$url" $pwid -- 2.7.0