0
1
Fork 0
hedera-web-mindshore/Jenkinsfile

88 lines
2.5 KiB
Plaintext
Raw Normal View History

2020-01-17 12:07:01 +00:00
#!/usr/bin/env groovy
pipeline {
environment {
PROJECT_NAME = 'hedera-web'
}
stages {
stage('Checkout') {
steps {
2020-01-21 08:00:03 +00:00
configFileProvider([
configFile(fileId: "${PROJECT_NAME}.groovy",
variable: 'GROOVY_FILE')
]) {
load env.GROOVY_FILE
}
2020-01-17 12:07:01 +00:00
sh 'printenv'
}
}
2020-01-21 08:00:03 +00:00
stage('Package') {
2020-01-17 12:07:01 +00:00
when {
branch 'master'
}
2020-01-21 08:00:03 +00:00
agent {
docker {
image 'registry.verdnatura.es/vn-debuild'
registryUrl 'https://registry.verdnatura.es/'
registryCredentialsId 'docker-registry'
args '-v /mnt/storage/reprepro:/reprepro'
}
}
2020-01-17 12:07:01 +00:00
steps {
sh 'debuild -us -uc -b'
sh 'vn-includedeb'
}
}
2020-01-21 08:00:03 +00:00
stage('Build') {
when {
branch 'master'
}
environment {
CREDS = credentials('docker-registry')
}
steps {
nodejs('node-lts') {
sh 'gulp build'
}
sh 'docker login --username $CREDS_USR --password $CREDS_PSW $REGISTRY'
sh 'docker-compose build --parallel'
sh 'docker-compose push'
}
}
stage('Deploy') {
when {
branch 'master'
}
steps {
sh "docker stack deploy --with-registry-auth --compose-file docker-compose.yml ${env.PROJECT_NAME}"
}
}
2020-01-17 12:07:01 +00:00
}
post {
always {
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;
}
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()
}
}
}
}
}