add Jenkinsfile
This commit is contained in:
parent
7661ca2322
commit
b8fb525ab7
|
@ -1,34 +1,29 @@
|
|||
@Library('eo-jenkins-lib@master') import eo.Utils
|
||||
|
||||
pipeline {
|
||||
agent any
|
||||
triggers {
|
||||
pollSCM('*/3 * * * *')
|
||||
}
|
||||
options {
|
||||
// Keep the 50 most recent builds
|
||||
buildDiscarder(logRotator(numToKeepStr:'50'))
|
||||
}
|
||||
stages {
|
||||
stage('Build') {
|
||||
environment {
|
||||
VERSION= sh (script: "sh version.sh", returnStdout: true)
|
||||
}
|
||||
stage('Packaging') {
|
||||
steps {
|
||||
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''')
|
||||
script {
|
||||
if (env.JOB_NAME == 'passerelle-imio-ia-delib' && env.GIT_BRANCH == 'origin/master') {
|
||||
sh 'sudo -H -u eobuilder /usr/local/bin/eobuilder -d stretch passerelle-imio-ia-delib'
|
||||
} else if (env.GIT_BRANCH.startsWith('hotfix/')) {
|
||||
sh "sudo -H -u eobuilder /usr/local/bin/eobuilder -d stretch --branch ${env.GIT_BRANCH} --hotfix passerelle-imio-ia-delib"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Deploy') {
|
||||
environment {
|
||||
VERSION= sh (script: "sh version.sh", returnStdout: true)
|
||||
}
|
||||
steps {
|
||||
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')
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
script {
|
||||
utils = new Utils()
|
||||
utils.mail_notify(currentBuild, env, 'admin+jenkins-passerelle-imio-ia-delib@entrouvert.com')
|
||||
}
|
||||
}
|
||||
success {
|
||||
cleanWs()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue