37 lines
848 B
Groovy
37 lines
848 B
Groovy
#!/usr/bin/env groovy
|
|
|
|
pipeline {
|
|
agent any
|
|
environment {
|
|
PROJECT_NAME = 'worker-time-control'
|
|
STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}"
|
|
}
|
|
stages {
|
|
stage('Checkout') {
|
|
steps {
|
|
setEnv()
|
|
}
|
|
}
|
|
stage('Build') {
|
|
environment {
|
|
CREDENTIALS = credentials('docker-registry')
|
|
}
|
|
steps {
|
|
dockerBuild()
|
|
}
|
|
}
|
|
stage('Deploy') {
|
|
environment {
|
|
DOCKER_HOST = "${env.SWARM_HOST}"
|
|
}
|
|
steps {
|
|
sh "docker stack deploy --with-registry-auth --prune --compose-file docker-compose.yml ${env.STACK_NAME}"
|
|
}
|
|
}
|
|
}
|
|
post {
|
|
always {
|
|
sendEmail()
|
|
}
|
|
}
|
|
} |