2020-01-16 10:07:20 +00:00
|
|
|
#!/usr/bin/env groovy
|
|
|
|
|
|
|
|
pipeline {
|
|
|
|
agent any
|
|
|
|
environment {
|
|
|
|
PROJECT_NAME = 'vn-vmware'
|
2020-01-16 13:48:59 +00:00
|
|
|
IMAGE = 'registry.verdnatura.es/vn-debuild'
|
2020-01-16 10:07:20 +00:00
|
|
|
}
|
|
|
|
stages {
|
|
|
|
stage('Checkout') {
|
|
|
|
steps {
|
|
|
|
script {
|
|
|
|
if (!env.GIT_COMMITTER_EMAIL) {
|
|
|
|
env.COMMITTER_EMAIL = sh(
|
|
|
|
script: 'git --no-pager show -s --format="%ae"',
|
|
|
|
returnStdout: true
|
|
|
|
).trim()
|
|
|
|
} else {
|
|
|
|
env.COMMITTER_EMAIL = env.GIT_COMMITTER_EMAIL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sh 'printenv'
|
|
|
|
}
|
|
|
|
}
|
2020-01-16 13:48:59 +00:00
|
|
|
stage('Deploy') {
|
|
|
|
when {
|
|
|
|
branch 'master'
|
|
|
|
}
|
2020-01-16 14:17:57 +00:00
|
|
|
agent {
|
|
|
|
docker {
|
|
|
|
image 'registry.verdnatura.es/vn-debuild'
|
|
|
|
registryUrl 'https://registry.verdnatura.es/'
|
|
|
|
registryCredentialsId 'docker-registry'
|
|
|
|
args '-v jenkins_master:"$JENKINS_HOME" -v /mnt/storage/reprepro:/reprepro'
|
|
|
|
}
|
|
|
|
}
|
2020-01-16 13:48:59 +00:00
|
|
|
steps {
|
2020-01-16 15:19:05 +00:00
|
|
|
sh 'pwd'
|
2020-01-16 14:17:57 +00:00
|
|
|
sh 'vn-debuild "$WORKSPACE"'
|
2020-01-16 15:12:43 +00:00
|
|
|
}
|
|
|
|
}
|
2020-01-16 15:14:51 +00:00
|
|
|
stage('Upload') {
|
2020-01-16 15:12:43 +00:00
|
|
|
when {
|
|
|
|
branch 'master'
|
|
|
|
}
|
|
|
|
agent {
|
|
|
|
docker {
|
|
|
|
image 'registry.verdnatura.es/vn-debuild'
|
|
|
|
registryUrl 'https://registry.verdnatura.es/'
|
|
|
|
registryCredentialsId 'docker-registry'
|
|
|
|
args '-u www-data -v jenkins_master:"$JENKINS_HOME" -v /mnt/storage/reprepro:/reprepro'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
steps {
|
2020-01-16 15:13:21 +00:00
|
|
|
sh 'pwd'
|
2020-01-16 14:17:57 +00:00
|
|
|
sh 'vn-include "$WORKSPACE"'
|
2020-01-16 10:07:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
post {
|
|
|
|
always {
|
|
|
|
script {
|
|
|
|
if (!env.COMMITTER_EMAIL) return
|
|
|
|
try {
|
|
|
|
mail(
|
|
|
|
to: env.COMMITTER_EMAIL,
|
|
|
|
subject: "Pipeline: ${env.JOB_NAME} (${env.BUILD_NUMBER}): ${currentBuild.currentResult}",
|
|
|
|
body: "Check status at ${env.BUILD_URL}"
|
|
|
|
)
|
|
|
|
} catch (e) {
|
|
|
|
echo e.toString()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|