From patchwork Tue Mar 5 06:22:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Donnellan X-Patchwork-Id: 1051636 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44D6JB5xlLz9s4V for ; Tue, 5 Mar 2019 17:22:34 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=au1.ibm.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 44D6JB4jwjzDqDS for ; Tue, 5 Mar 2019 17:22:34 +1100 (AEDT) X-Original-To: snowpatch@lists.ozlabs.org Delivered-To: snowpatch@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=au1.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=andrew.donnellan@au1.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=au1.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 44D6J55cT6zDqCx for ; Tue, 5 Mar 2019 17:22:29 +1100 (AEDT) Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x2569QIT137586 for ; Tue, 5 Mar 2019 01:22:26 -0500 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0b-001b2d01.pphosted.com with ESMTP id 2r1hqycge3-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 05 Mar 2019 01:22:26 -0500 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 5 Mar 2019 06:22:24 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 5 Mar 2019 06:22:22 -0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x256MLX837552286 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 5 Mar 2019 06:22:21 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 268E042045 for ; Tue, 5 Mar 2019 06:22:21 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 87AA842047 for ; Tue, 5 Mar 2019 06:22:20 +0000 (GMT) Received: from ozlabs.au.ibm.com (unknown [9.192.253.14]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP for ; Tue, 5 Mar 2019 06:22:20 +0000 (GMT) Received: from intelligence.ozlabs.ibm.com (haven.au.ibm.com [9.192.254.114]) (using TLSv1.2 with cipher DHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.au.ibm.com (Postfix) with ESMTPSA id 78CE5A026B for ; Tue, 5 Mar 2019 17:22:18 +1100 (AEDT) From: Andrew Donnellan To: snowpatch@lists.ozlabs.org Date: Tue, 5 Mar 2019 17:22:06 +1100 X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190305062206.25872-1-andrew.donnellan@au1.ibm.com> References: <20190305062206.25872-1-andrew.donnellan@au1.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19030506-0020-0000-0000-0000031E9D5D X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19030506-0021-0000-0000-00002170A3FD Message-Id: <20190305062206.25872-2-andrew.donnellan@au1.ibm.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-03-05_03:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1903050045 Subject: [snowpatch] [PATCH 2/2] Post base SHA as a parameter to job 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: , Errors-To: snowpatch-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "snowpatch" It's often useful for jobs to be able to know the specific commit on top of which the patches have been applied. Add an extra job parameter, "base", which allows us to send the base commit ID to Jenkins. Update documentation accordingly. Closes: #56 ("Post base SHA as a parameter to job") Signed-off-by: Andrew Donnellan --- docs/configuration.md | 3 +++ examples/openpower.toml | 1 + src/main.rs | 11 +++++++++-- src/settings.rs | 9 +++++++++ 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/docs/configuration.md b/docs/configuration.md index c7b3b8d66a8e..4402693cab99 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -159,6 +159,9 @@ Individual jobs contain the following: - `branch`: the name of the Jenkins build parameter in which the name of the git branch to which the patch has been applied will be filled +- `base`: the name of the Jenkins build parameter in which the commit ID on top + of which the patch has been applied will be filled (Optional) + - `hefty`: whether this job is a "hefty" test. Hefty tests will only be run on the final patch of a series, while non-hefty tests will be run on every patch in the series. (Optional, defaults to false) diff --git a/examples/openpower.toml b/examples/openpower.toml index c3aedc5f0a57..59331455fc68 100644 --- a/examples/openpower.toml +++ b/examples/openpower.toml @@ -47,6 +47,7 @@ token = "33333333333333333333333333333333" job = "skiboot-compile-test-snowpatch" remote = "GIT_REPO" branch = "GIT_REF" + base = "GIT_BASE" [[projects.skiboot.jobs]] job = "skiboot-boot-test-snowpatch" diff --git a/src/main.rs b/src/main.rs index 5f60cc2293ea..ba8c54d792d9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -107,6 +107,7 @@ fn run_test( project: &Project, tag: &str, branch_name: &str, + base: &str, job: &Job, ) -> TestResult { let mut params = Vec::<(&str, &str)>::new(); @@ -117,6 +118,10 @@ fn run_test( } params.push((&job.remote, &project.remote_uri)); params.push((&job.branch, tag)); + match job.base { + Some(ref base_param) => params.push((&base_param, base)), + _ => { } + }; info!("Starting job: {}", &job.title); let res = backend @@ -158,6 +163,7 @@ fn run_tests( project: &Project, tag: &str, branch_name: &str, + base: &str, hefty_tests: bool, ) -> Vec { let mut results: Vec = Vec::new(); @@ -174,7 +180,7 @@ fn run_tests( continue; } - let result = run_test(&jenkins, &project, &tag, &branch_name, &job); + let result = run_test(&jenkins, &project, &tag, &branch_name, &base, &job); results.push(result); } @@ -277,11 +283,12 @@ fn test_patch( let project = project.clone(); let client = client.clone(); let test_all_branches = project.test_all_branches.unwrap_or(true); + let base = commit.id().to_string(); // We've set up a remote branch, time to kick off tests let test = thread::Builder::new() .name(tag.to_string()) - .spawn(move || run_tests(&settings, client, &project, &tag, &branch_name, hefty_tests)) + .spawn(move || run_tests(&settings, client, &project, &tag, &branch_name, &base, hefty_tests)) .unwrap(); results.append(&mut test.join().unwrap()); diff --git a/src/settings.rs b/src/settings.rs index 83097dde1e27..128f2030e467 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -82,6 +82,7 @@ pub struct Job { pub title: String, pub remote: String, pub branch: String, + pub base: Option, pub hefty: bool, pub warn_on_fail: bool, pub parameters: BTreeMap, @@ -109,6 +110,7 @@ impl<'de> Deserialize<'de> for Job { let mut title = None; let mut remote = None; let mut branch = None; + let mut base = None; let mut hefty = None; let mut warn_on_fail = None; let mut parameters = BTreeMap::new(); @@ -138,6 +140,12 @@ impl<'de> Deserialize<'de> for Job { } branch = Some(map.next_value()?); } + "base" => { + if base.is_some() { + return Err(de::Error::duplicate_field("base")); + } + base = Some(map.next_value()?); + } "hefty" => { if hefty.is_some() { return Err(de::Error::duplicate_field("hefty")); @@ -168,6 +176,7 @@ impl<'de> Deserialize<'de> for Job { title, remote, branch, + base, hefty, warn_on_fail, parameters,