Fix build of libvirt-exporter
Change-Id: I7a5cdd5b069d96f4f79e5ca2173751f6440f278d
diff --git a/build-debian-packages-libvirt-exporter.groovy b/build-debian-packages-libvirt-exporter.groovy
index 2b27851..eb109cb 100644
--- a/build-debian-packages-libvirt-exporter.groovy
+++ b/build-debian-packages-libvirt-exporter.groovy
@@ -1,6 +1,7 @@
def common = new com.mirantis.mk.Common()
def git = new com.mirantis.mk.Git()
def aptly = new com.mirantis.mk.Aptly()
+def dockerLib = new com.mirantis.mk.Docker()
def timestamp = common.getDatetime()
def version = "0.1~${timestamp}"
@@ -26,16 +27,24 @@
stage("build binary") {
dir("libvirt-exporter-${version}") {
- sh("""sed -i 's/VERSION/${version}/g' debian/changelog &&
- scripts/build.py --package --version=\"${version}\" --platform=linux --arch=amd64""")
+ sh("sed -i 's/VERSION/${version}/g' debian/changelog && ./build_static.sh")
+ }
+ }
+
+ def img = dockerLib.getImage("tcpcloud/debian-build-ubuntu-xenial")
+ stage("build package") {
+ img.inside("-u root:root") {
+ sh("apt-get update && apt-get install ruby ruby-dev && gem install fpm")
+ sh("cd libvirt-exporter-${version} && scripts/build.py --package --version=\"${version}\" --platform=linux --arch=amd64")
}
archiveArtifacts artifacts: "libvirt-exporter-${version}/build/*.deb"
}
+
if (UPLOAD_APTLY.toBoolean()) {
lock("aptly-api") {
stage("upload") {
def buildSteps = [:]
- def debFiles = sh script: "ls *.deb", returnStdout: true
+ def debFiles = sh(script: "ls libvirt-exporter-${version}/build/*.deb", returnStdout: true)
def debFilesArray = debFiles.trim().tokenize()
def workspace = common.getWorkspace()
for (int i = 0; i < debFilesArray.size(); i++) {
@@ -56,6 +65,10 @@
}
}
+ img.inside("-u root:root") {
+ sh("rm -rf * || true")
+ }
+
} catch (Throwable e) {
// If there was an exception thrown, the build failed
currentBuild.result = "FAILURE"