worker-time-control/Jenkinsfile

45 lines
1.0 KiB
Plaintext
Raw Normal View History

2021-10-18 08:54:32 +00:00
#!/usr/bin/env groovy
pipeline {
agent any
environment {
2021-10-20 13:26:27 +00:00
PROJECT_NAME = 'worker-time-control'
2021-10-21 11:36:27 +00:00
STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}"
2021-10-18 08:54:32 +00:00
}
stages {
stage('Checkout') {
steps {
setEnv()
}
}
stage('Build') {
2021-10-21 11:41:24 +00:00
when { anyOf {
branch 'test'
branch 'master'
}}
2021-10-18 08:54:32 +00:00
environment {
CREDENTIALS = credentials('docker-registry')
}
steps {
dockerBuild()
}
}
stage('Deploy') {
2021-10-21 11:41:24 +00:00
when { anyOf {
branch 'test'
branch 'master'
}}
2021-10-18 08:54:32 +00:00
environment {
DOCKER_HOST = "${env.SWARM_HOST}"
}
steps {
2021-10-21 11:36:27 +00:00
sh "docker stack deploy --with-registry-auth --prune --compose-file docker-compose.yml ${env.STACK_NAME}"
2021-10-18 08:54:32 +00:00
}
}
}
post {
always {
sendEmail()
}
}
}