-
Notifications
You must be signed in to change notification settings - Fork 6
/
Jenkinsfile
64 lines (58 loc) · 2.95 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import java.text.SimpleDateFormat
jobName = "metadata-exporter"
version = "0.1.50"
build_dir = "build"
buildPackageName = "meta-exporter"
node ('dockerslave') {
// Be sure that workspace is cleaned
deleteDir()
stage ('Git') {
git branch: 'master', url: '[email protected]:MONROE-PROJECT/Utilities.git'
checkout([$class: 'GitSCM',
branches: [[name: 'master']],
doGenerateSubmoduleConfigurations: false,
extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'metadata-exporter-alt']],
submoduleCfg: [],
userRemoteConfigs: [[url: '[email protected]:kristrev/data-exporter.git']]])
gitCommit = sh(returnStdout: true, script: 'git rev-parse HEAD').trim()
shortCommit = gitCommit.take(6)
commitChangeset = sh(returnStdout: true, script: 'git diff-tree --no-commit-id --name-status -r HEAD').trim()
commitMessage = sh(returnStdout: true, script: "git show ${gitCommit} --format=%B --name-status").trim()
sh """echo "${commitMessage}" > CHANGELIST"""
def dateFormat = new SimpleDateFormat("yyyyMMddHHmm")
def date = new Date()
def timestamp = dateFormat.format(date).toString()
checkout([$class: 'GitSCM',
branches: [[name: 'monroe']],
doGenerateSubmoduleConfigurations: false,
extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'versionize']],
submoduleCfg: [],
userRemoteConfigs: [[url: '[email protected]:Celerway/celerway-jenkins.git']]])
}
stage ('Build') {
dir(build_dir) {
sh "cmake ../metadata-exporter-alt -DNNE=1 -DSQLITE3=1 -DZEROMQ_WRITER=1 -DGPS_NSB=1 -DMUNIN=1 -DSYSEVENT=1 && make && make package"
}
sh "chmod +x versionize/versionize.sh; cp versionize/versionize.sh build/"
dir(build_dir) {
sh "mv meta_exporter-0.1.0-Linux.deb meta-exporter-0.1.0-Linux.deb"
sh "./versionize.sh meta-exporter-0.1.0-Linux.deb ${buildPackageName} ${version} ${shortCommit} || true"
sh "rm meta-exporter-0.1.0-Linux.deb"
}
}
stage ('Configure') {
dir(build_dir) {
sh """echo `cat pk_${buildPackageName}/DEBIAN/control |grep Version|sed -e 's/Version: //'` > pkgver"""
}
sh """cp -an metadata-exporter/* build/pk_${buildPackageName}/"""
dir(build_dir) {
sh """sed -i -e 's/${buildPackageName}/metadata-exporter/g' pk_${buildPackageName}/DEBIAN/md5sums pk_${buildPackageName}/DEBIAN/control"""
sh """mkdir -p pk_${buildPackageName}/usr/sbin && mv pk_${buildPackageName}/usr/sbin/meta_exporter pk_${buildPackageName}/usr/sbin/metadata-exporter"""
sh '''PKGVER=`cat pkgver` ;dpkg -b pk_meta-exporter metadata-exporter-${PKGVER}-Linux.deb'''
sh "rm meta-exporter*.deb"
}
}
stage ('Archive artifacts') {
archiveArtifacts "${build_dir}/*.deb"
}
}