From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wj0-f172.google.com (mail-wj0-f172.google.com [209.85.210.172]) by dpdk.org (Postfix) with ESMTP id 1E11C58D6 for ; Fri, 25 Nov 2016 18:02:31 +0100 (CET) Received: by mail-wj0-f172.google.com with SMTP id qp4so63805911wjc.3 for ; Fri, 25 Nov 2016 09:02:31 -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=ouI5cOj+gC5XTt4kOrogp4m5i2+TH9YUKvVuY/O1P7DUjyE8dIRoTwEaYZgu6fcSiH kMoqm1Ktys7BIS/mKfCtvo/MifZI0dRupLoBUqOtb4+Z+Vv1pfXkzHaNRwdny9+WRHfK APSImTx/yU5IGMPS6B0ddmT0+/N7Kn02JQpkY5BosIopGLAi3yX7X3RPjaBmrIP4LUaj 9Ig3d3UHpxXb/5u7bs6OvltucSoiRVYzQkzh3tJsXMu0cgAf1oP0++0+AOZpUvOm5D9T 0wQVDpIvrBTKY/5Fwaim64zbe1b064nGXTrn/Qizx4dXxxrpvnOYorCWEAAjq7Yi2Zix lv9g== 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=kY+poMasRBixSybjopb5JfNQhFp75GuZZ9VrLvHFMbGp6RU9AYJAonpHsK9T6LVCGl ykRbIvSisgHxcujNxy1lgM+TRvEKFreLHUIZCwAqbqLcfzPVRXZH7D57u9xBUWFBki+F iD5e31nmvhDCrXANxMS/vp6O7Xn85Haw3NijCk2IAM3KonflkGQOgCmXG9VYafd0ZVya 9y0aSvKpvUTOFnLJy9vSKTSe+sqUSW2n8MA+v63i7qC6lsMB1hiX/mArqIXbHgmpYhrR eVsyCKGQR+zrdU6q6iTahPL2LZxKwAqt9G9Mj5CIL1naV7ccH8CalPL57frTiBIq3q/f 2Q8A== X-Gm-Message-State: AKaTC03GeOJB07AyApTu1ojOPhp77oiZ40TionJ5/TEyk7pr4cAgtYxrabtT9uEeHPGNu868 X-Received: by 10.194.109.65 with SMTP id hq1mr8270712wjb.37.1480093350524; Fri, 25 Nov 2016 09:02:30 -0800 (PST) Received: from XPS13.localdomain (184.203.134.77.rev.sfr.net. [77.134.203.184]) by smtp.gmail.com with ESMTPSA id ct7sm29707757wjc.2.2016.11.25.09.02.29 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 25 Nov 2016 09:02:29 -0800 (PST) From: Thomas Monjalon To: ci@dpdk.org Date: Fri, 25 Nov 2016 18:02:13 +0100 Message-Id: <1480093334-29957-7-git-send-email-thomas.monjalon@6wind.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1480093334-29957-1-git-send-email-thomas.monjalon@6wind.com> References: <1480093334-29957-1-git-send-email-thomas.monjalon@6wind.com> Subject: [dpdk-ci] [PATCH 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: Fri, 25 Nov 2016 17:02:31 -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