vn-autoconfig/Jenkinsfile

41 lines
966 B
Groovy

#!/usr/bin/env groovy
pipeline {
agent any
environment {
PROJECT_NAME = 'vn-autoconfig'
}
stages {
stage('Checkout') {
steps {
setEnv()
}
}
stage('Build') {
when {
branch 'master'
}
environment {
CREDS = credentials('docker-registry')
}
steps {
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 --prune --compose-file docker-compose.yml ${env.PROJECT_NAME}"
}
}
}
post {
always {
sendEmail()
}
}
}