From patchwork Tue Dec 11 03:46:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russell Currey X-Patchwork-Id: 1010833 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43DQyB6dWKz9s3Z for ; Tue, 11 Dec 2018 14:52:50 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=russell.cc Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="tU9dj8x+"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 43DQyB4qY3zDqVp for ; Tue, 11 Dec 2018 14:52:50 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=russell.cc Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="tU9dj8x+"; dkim-atps=neutral X-Original-To: snowpatch@lists.ozlabs.org Delivered-To: snowpatch@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (helo) smtp.helo=out1-smtp.messagingengine.com (client-ip=66.111.4.25; helo=out1-smtp.messagingengine.com; envelope-from=ruscur@russell.cc; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=russell.cc Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="tU9dj8x+"; dkim-atps=neutral Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 43DQxx65krzDqMq for ; Tue, 11 Dec 2018 14:52:37 +1100 (AEDT) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 4208121F9B; Mon, 10 Dec 2018 22:45:46 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Mon, 10 Dec 2018 22:45:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=1QkYjGrA+idVTPaC2oJOTgoQ4FDJ8E5mmcAImku3XrM=; b=tU9dj8x+ dgg3DGycqsdoRRe2STZy1cstB42Qc/hNQxQkCxIyFdTto4KEn0azQC4gDolyXGXe 3hUGHrbSq+RA1LoDoe5fND98h4NevKk3qpd6poK/JIRRukH3ENvKxVfQiJyTIqLP +KTPGOX7XZBSqAomVZp44RQp3+nfVHfQuG54GlShO/b5plF9XXEQUU7RBiIc127Y zy3rtOrbBURZ10Kp8F5TvvjEXG924igcGIZbHu254keempkaUInAivT12RxpiiC9 StaW9CLdu2AqtECshw/meAY/9RjnCKqPydevX7zgszYgZgPOfkBqfnNuzshr9phO y0lEPj37jfQsHQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtkedrudegiedgieegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfquhhtnecuuegrihhlohhuthemucef tddtnecufghrlhcuvffnffculdeftddmnecujfgurhephffvufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpeftuhhsshgvlhhlucevuhhrrhgvhicuoehruhhstghurhes rhhushhsvghllhdrtggtqeenucffohhmrghinhepshhtrghtuhhsrdhishenucfkphepvd dtvddrkedurddukedrfedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehruhhstghurhes rhhushhsvghllhdrtggtnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from crackle.ozlabs.ibm.com.au.ibm.com (bh02i525f01.au.ibm.com [202.81.18.30]) by mail.messagingengine.com (Postfix) with ESMTPA id D8DE8E4430; Mon, 10 Dec 2018 22:45:44 -0500 (EST) From: Russell Currey To: snowpatch@lists.ozlabs.org Date: Tue, 11 Dec 2018 14:46:01 +1100 Message-Id: <20181211034601.29061-5-ruscur@russell.cc> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181211034601.29061-1-ruscur@russell.cc> References: <20181211034601.29061-1-ruscur@russell.cc> MIME-Version: 1.0 Subject: [snowpatch] [PATCH v2 5/5] jenkins: Only link to artifact if it actually exists X-BeenThere: snowpatch@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Continuous Integration for patch-based workflows List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Russell Currey Errors-To: snowpatch-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "snowpatch" Signed-off-by: Russell Currey --- src/jenkins.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/jenkins.rs b/src/jenkins.rs index 1fbcc49..67d729e 100644 --- a/src/jenkins.rs +++ b/src/jenkins.rs @@ -191,9 +191,19 @@ impl JenkinsBackend { } pub fn get_results_url(&self, build_url: &str, job: &BTreeMap) -> String { + let default_url = format!("{}/", build_url); match job.get("artifact") { - Some(artifact) => format!("{}/artifact/{}", build_url, artifact), - None => format!("{}/", build_url), + Some(artifact) => { + let artifact_url = format!("{}/artifact/{}", build_url, artifact); + match self.get_url(&artifact_url) { + Ok(mut resp) => match resp.status().is_success() { + true => artifact_url, + false => default_url, + }, + Err(_e) => default_url, + } + } + None => default_url, } }