Update Jenkinsfile and version

This commit is contained in:
Christophe Boulanger 2018-12-06 14:40:15 +01:00
parent 3b5e7bdd04
commit 7661ca2322
2 changed files with 16 additions and 2 deletions

16
Jenkinsfile vendored
View File

@ -9,14 +9,26 @@ pipeline {
}
stages {
stage('Build') {
environment {
VERSION= sh (script: "sh version.sh", returnStdout: true)
}
steps {
sh "fpm -n passerelle-imio-ia-delib -s python -t deb -v `cat version` --prefix /usr -d passerelle setup.py"
sh "fpm -a amd64 -n passerelle-imio-ia-delib -s python -t deb -v `echo ${VERSION}` --prefix /usr -d passerelle setup.py"
withCredentials([string(credentialsId: 'gpg-passphrase-system@imio.be', variable:'PASSPHRASE')]){
sh ('''dpkg-sig --gpg-options "--yes --batch --passphrase '$PASSPHRASE' " -s builder -k 9D4C79E197D914CF60C05332C0025EEBC59B875B passerelle-imio-ia-delib_`echo ${VERSION}`_amd64.deb''')
}
}
}
stage('Deploy') {
environment {
VERSION= sh (script: "sh version.sh", returnStdout: true)
}
steps {
sh "scp passerelle-imio-ia-delib_`cat version`_all.deb root@puppetmaster.imio.be:/tmp"
withCredentials([usernameColonPassword(credentialsId: 'nexus-teleservices', variable: 'CREDENTIALS'),string(credentialsId: 'nexus-url', variable:'NEXUS_URL')]) {
sh ('curl -v --fail -u $CREDENTIALS -X POST -H Content-Type:multipart/form-data --data-binary @passerelle-imio-ia-delib_`echo ${VERSION}`_amd64.deb $NEXUS_URL')
}
}
}
}
}

2
version.sh Normal file
View File

@ -0,0 +1,2 @@
version=`echo $(cat version && echo "-" && git log --pretty=format:'%h' -n 1) | tr -d "[:space:]"`
echo $version