-
Notifications
You must be signed in to change notification settings - Fork 2
/
Jenkinsfile
59 lines (53 loc) · 2.49 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
import java.text.SimpleDateFormat
jobName = "python-biteback"
version = "0.1.61"
build_dir = "deb_dist"
@Library('jenkins-shared') _
node {
try {
notifyBuild('STARTED')
// Be sure that workspace is cleaned
deleteDir()
stage ('Git') {
git branch: 'master', url: '[email protected]:MONROE-PROJECT/Watchdog.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']]])
}
withDockerRegistry(credentialsId: 'gcr:nimbus-tools-gcr', url: 'http://eu.gcr.io/nimbus-tools') {
docker.image('eu.gcr.io/nimbus-tools/monroe-builder:stretch').inside('-u jenkins') {
stage ('Build') {
sh "python setup.py --command-packages=stdeb.command bdist_deb"
sh """chmod +x versionize/versionize.sh
cp versionize/versionize.sh deb_dist/
# Sticky bit is set on directory during build. Removing it.
chmod -R g-s deb_dist"""
dir(build_dir) {
sh "./versionize.sh ${jobName}_0.1.0-1_all.deb ${jobName} ${version} ${shortCommit}"
sh "rm ${jobName}_0.1.0-1_all.deb"
}
}
stage ('Archive artifacts') {
archiveArtifacts "${build_dir}/*.deb"
}
}
}
} catch (e) {
currentBuild.result = "FAILED"
throw e
} finally {
// Success or failure, always send notifications
notifyBuild(currentBuild.result)
} // end of try catch finally block
}