From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9AD32A0C4B for ; Mon, 8 Nov 2021 07:29:47 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 963B940151; Mon, 8 Nov 2021 07:29:47 +0100 (CET) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2082.outbound.protection.outlook.com [40.107.94.82]) by mails.dpdk.org (Postfix) with ESMTP id C7E3840040 for ; Mon, 8 Nov 2021 07:29:46 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GfrcmSnBVUXkDBLXEdlYoXMSiHyLzWIMBl4m1soPby/1a/0IlQD+8BR5RAoQgECDYYsNCz9ZR/dsmpqWREQjkGUjj6ul87BArk7PNSAffgfh4IRuOSis72Wfjc4HBogFk7CQ4N7ooR597Pj+r/1qPhNGDrUd3qZRvKakXs/H/t4VgQxXYkIpibuNrhp3UzwpY+ghfCUEX9CSpgy+fbqaxYXNEnAeyO512V7DCwpoN1qPsDbP4IVU9oDYgusA5YtBdJbdgMdwgzedGz6jQSx175CKOAJvNrefwNgd52MsKCfeHxUaXVyXB3CrkUJKvoNNjpEGFFdvcfLdZQet7SZ7/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=vG69tJxrbn2oNHRC4USVKJUn7pijcEINl2/KCKGbLpU=; b=TNzMXglFDHZ72pVclbm5exSPYi/EhrcXzEdHITL2SwlGFixmKUrFpOa6mNRNgxAA6CRNuySdrP4X5zaoTka8gaL/8mzo6yycwW+oD4gyPdFYPpPkagTVn3lyk6FnMtjKNbAoO3owKVP+1utjFmPlHXrX+TPR3DNI59YKQjEr3OnXJnlmhov4laRH82sv5gOtSIpA7F3+9KnYiZs+M9AtjO0nBkLvDNjVnnXVm9OWqLF/hp/cY55/dzNHWGqbirOsJEZt7GfrIX+ASCBgnV54uiDHttkrDMGpBjJJtm1KsoHz5rmEx7ascO9uxP8ijspTqhTbjx5p/XjtDHVxoYlMzQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=intel.com smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vG69tJxrbn2oNHRC4USVKJUn7pijcEINl2/KCKGbLpU=; b=VLEAYXdGhV8Lz3wNlcpiliNNFZzOjfFj1cp0hmpxYcm9GG/dBJpV+DhVWdbQrW/CSernjc00nMQNu8WpWXZhom1MG+KL4eIIjdKh+lKTcowFBTZpiYOcD//UtkTX35xIlDEigAlqVS4ShQaTJPQGbGLsVcIRb+D5qEJrkY2+8H3AWbBcAhVag/50l1twgGh+ZEyX4jrZhCX3BeRw1COiRohsLfXdPz+UaFEXlIrlp0L8sEL4biPHN5EXfvRSx38P6k/LKBj1W3f8sVqsXeVPxdpvzKMKH/Cizldd65O13ISMW1vDwYxnJm9DJH7yX5rAz0kDKzZ7UKk4upBcs+ilQw== Received: from DS7PR03CA0288.namprd03.prod.outlook.com (2603:10b6:5:3ad::23) by DM5PR12MB1547.namprd12.prod.outlook.com (2603:10b6:4:c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.13; Mon, 8 Nov 2021 06:29:40 +0000 Received: from DM6NAM11FT012.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3ad:cafe::8e) by DS7PR03CA0288.outlook.office365.com (2603:10b6:5:3ad::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.10 via Frontend Transport; Mon, 8 Nov 2021 06:29:40 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by DM6NAM11FT012.mail.protection.outlook.com (10.13.173.109) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4669.10 via Frontend Transport; Mon, 8 Nov 2021 06:29:39 +0000 Received: from nvidia.com (172.20.187.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Mon, 8 Nov 2021 06:29:34 +0000 From: Ali Alnubani To: CC: , , , , Date: Mon, 8 Nov 2021 08:28:14 +0200 Message-ID: <20211108062815.7614-10-alialnu@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211108062815.7614-1-alialnu@nvidia.com> References: <20210906154537.1299-1-alialnu@nvidia.com> <20211108062815.7614-1-alialnu@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL105.nvidia.com (172.20.187.12) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7c538d8e-7a68-4a80-2db6-08d9a28124b2 X-MS-TrafficTypeDiagnostic: DM5PR12MB1547: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:843; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1WeQ/vgwpQCBTLJMsHc2udR9k89n7yeV3OCoBEsEGz3dLy5cNGqd/9MXB/3CGG+vFQt3Xz+EiZxtNc+RMR6PIUtZzjDHV14mPN6G/Sxst9D6XOmkifNluFJVIyQXbCZTpDbSG/xrLedlEBG0k1DuvuGIWXxybioxb/O49oSPM10lgtkHSxucCRRsMMdg8+ahvYGYtbP10G5R+dNoGN2cETztrfRFvh7rM39ynkUJL5xXf7qcXKNYUvGHGWoiwDdnQo1TUpnSou05Ti2VJ4kEPrfqkSbERxm+Xgr4oW57yKXEVQsZI6T+uhaJy1bkINFFUTAVRpa3HAkPF3inKwwca3XPTT5f0/q9N3hkFM7+c1mUuc8t2p+X2NMsntM7uzUuGjT4r3pXJJO7DpcR8jYjhLaCPLyyHeJSoQD62YFkRn5ak1bTu27CmpxdqvTVVRUlFyJfrcZWHUd+HIEITFamm11hoe9vJGTg0Jv5s4tTMfigXC27z86JP2XAeAy+mShWfvGJRK/CyOZE0O9nN7T3b4u63sMk2hkX8lP0aurpU8ub/cWPdnTCd8o0aGyd5hnfy5Omh2/B3F9mL27uNjrFNiA3n3lFBH40VCLIR4NVkaFcqiadxh1V1va7BkKQZEqOG+rvNWjZEur8ORi74eDosQpCghJ/bAbV8LgqX2rEkZfVk/PRBlw1vpIqeDy99vZRcSVQIYMJVyMeT8mMTxupDw== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(82310400003)(83380400001)(2616005)(508600001)(7696005)(6666004)(8936002)(5660300002)(2906002)(26005)(186003)(1076003)(16526019)(336012)(4326008)(426003)(70206006)(70586007)(36756003)(8676002)(55016002)(36906005)(316002)(6286002)(36860700001)(54906003)(6916009)(7636003)(356005)(86362001)(47076005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Nov 2021 06:29:39.8664 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7c538d8e-7a68-4a80-2db6-08d9a28124b2 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT012.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1547 Subject: [dpdk-ci] [PATCH v4 09/10] tools: filter new patchwork IDs by project name X-BeenThere: ci@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK CI discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ci-bounces@dpdk.org Sender: "ci" If the script doesn't filter by project, it would be fetching patches from all projects, which we don't want as different projects require different checks usually. This patch modifies the script so that it requires a project's name to fetch IDs for. Example usage: $ export MAINTAINERS_FILE_PATH=/path/to/dpdk/MAINTAINERS $ ./tools/poll-pw series DPDK /path/to/last.txt \ '/path/to/pw_maintainers_cli.py --type series set-pw-delegate $1' Signed-off-by: Ali Alnubani --- Changes in v3: - Filter by project using jq, since the events API doesn't have a 'project' parameter. - Redirect error messages to stderr. tools/poll-pw | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/tools/poll-pw b/tools/poll-pw index 48c9fd0..f4b89c7 100755 --- a/tools/poll-pw +++ b/tools/poll-pw @@ -9,7 +9,7 @@ PAUSE_SECONDS=100 print_usage () { cat <<- END_OF_HELP - usage: $(basename $0) [OPTIONS] + usage: $(basename $0) [OPTIONS] Poll patchwork and call a command for each new patch/series id. The first date to filter with is read from the specified file. @@ -31,15 +31,16 @@ while getopts h arg ; do esac done -if [ $# -lt 3 ] ; then +if [ $# -lt 4 ] ; then printf 'missing argument(s)\n\n' >&2 print_usage >&2 exit 1 fi shift $(($OPTIND - 1)) resource_type=$1 -since_file=$2 -shift 2 +project=$2 +since_file=$3 +shift 3 cmd=$* if [ ! -f "$since_file" ] ; then @@ -59,6 +60,12 @@ if [ "$resource_type" != "patch" ] & [ "$resource_type" != "series" ] ; then exit 1 fi +curl -s $URL/projects/ | jq '.[].name' | grep -qi "^\"${project}\"$" +if [ ! $? -eq 0 ] ; then + printf "The project '$project' doesn't exist.\n\n" >&2 + exit 1 +fi + URL="${URL}/events/?category=${resource_type}-completed" callcmd () # @@ -73,7 +80,8 @@ while true ; do page=1 while true ; do ids=$(curl -s "${URL}&page=${page}&since=${since}" \ - | jq "try ( .[].payload.${resource_type}.id )") + | jq "try ( .[] | select( .project.name == \"$project\" ) )" \ + | jq "try ( .payload.${resource_type}.id )") [ -z "$(echo $ids | tr -d '\n')" ] && break for id in $ids ; do callcmd $id -- 2.25.1