-
Notifications
You must be signed in to change notification settings - Fork 3
/
ice-watchdog.jenkins
48 lines (44 loc) · 1.94 KB
/
ice-watchdog.jenkins
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
import java.text.SimpleDateFormat
jobName = "ice-watchdog"
version = "0.1.1"
// build_dir = "."
@Library('jenkins-shared') _
node ('dockermonroe') {
try {
notifyBuild('STARTED')
// Be sure that workspace is cleaned
deleteDir()
stage ('Git') {
git branch: 'master', url: '[email protected]:MONROE-PROJECT/Utilities.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') {
sh "fakeroot dpkg-deb --build ice-watchdog ${jobName}.deb"
sh "chmod +x versionize/versionize.sh; cp versionize/versionize.sh ."
sh "./versionize.sh ${jobName}.deb ${jobName} ${version} ${shortCommit}"
sh "rm ${jobName}.deb"
}
stage ('Archive artifacts') {
archiveArtifacts "*.deb"
}
} catch (e) {
currentBuild.result = "FAILED"
throw e
} finally {
// Success or failure, always send notifications
notifyBuild(currentBuild.result)
} // end of try catch finally block
}