diff options
author | Guillaume Tucker <guillaume.tucker@collabora.com> | 2018-07-05 14:35:25 +0100 |
---|---|---|
committer | Guillaume Tucker <guillaume.tucker@collabora.com> | 2018-07-30 16:42:59 +0200 |
commit | ed369df840fa9e73c2344c0ebc808c5c90ecab23 (patch) | |
tree | b8675f245bee04a3917182482abaf4fc413e9e82 /src | |
parent | ea7beb87bd514e1617847f1fdcdd6f3a4fdaff0d (diff) |
Add initial org.kernelci shared library
Add org.kernelci shared library with some classes to use in multiple
build jobs:
* org.kernelci.build.Kernel with functions to download a Linux kernel
source tarball and build it
* org.kernelci.util.Job with common functions to trigger other Jenkins
jobs (populate the parameters...)
Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/org/kernelci/build/Kernel.groovy | 48 | ||||
-rw-r--r-- | src/org/kernelci/util/Job.groovy | 35 |
2 files changed, 83 insertions, 0 deletions
diff --git a/src/org/kernelci/build/Kernel.groovy b/src/org/kernelci/build/Kernel.groovy new file mode 100644 index 0000000..c78141d --- /dev/null +++ b/src/org/kernelci/build/Kernel.groovy @@ -0,0 +1,48 @@ +/* + Copyright (C) 2018 Collabora Limited + Author: Guillaume Tucker <guillaume.tucker@collabora.com> + + This module is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free + Software Foundation; either version 2.1 of the License, or (at your option) + any later version. + + This library is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + + +package org.kernelci.build; + +def cloneKCIBuild(path, url, branch) { + sh(script: "rm -rf ${path}") + dir("${path}") { + git(url: url, + branch: branch, + poll: false) + } +} + +def downloadTarball(kdir, url, filename="linux-src.tar.gz") { + sh(script: "rm -rf ${kdir}") + dir(kdir) { + sh(script: "\ +wget \ +--no-hsts \ +--progress=dot:giga \ +--retry-connrefused \ +--waitretry=5 \ +--read-timeout=20 \ +--timeout=15 \ +--tries 20 \ +--continue \ +${url}") + sh(script: "tar xzf ${filename}") + } +} diff --git a/src/org/kernelci/util/Job.groovy b/src/org/kernelci/util/Job.groovy new file mode 100644 index 0000000..0c9ab9b --- /dev/null +++ b/src/org/kernelci/util/Job.groovy @@ -0,0 +1,35 @@ +/* + Copyright (C) 2018 Collabora Limited + Author: Guillaume Tucker <guillaume.tucker@collabora.com> + + This module is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free + Software Foundation; either version 2.1 of the License, or (at your option) + any later version. + + This library is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + + +package org.kernelci.util; + +def addStrParams(params, str_params) { + for (p in str_params) { + params.push( + [$class: "StringParameterValue", name: p.key, value: p.value]) + } +} + +def addBoolParams(params, bool_params) { + for (p in bool_params) { + params.push( + [$class: "BooleanParameterValue", name: p.key, value: p.value]) + } +} |