Jenkinsfile refactor
gitea/docker-discover/master This commit looks good
Details
gitea/docker-discover/master This commit looks good
Details
This commit is contained in:
parent
2b07298d5f
commit
1bd0afa8cc
|
@ -3,43 +3,29 @@
|
||||||
pipeline {
|
pipeline {
|
||||||
agent any
|
agent any
|
||||||
environment {
|
environment {
|
||||||
PROJECT_NAME = 'discover'
|
PROJECT_NAME = 'vn-autoconfig'
|
||||||
}
|
}
|
||||||
stages {
|
stages {
|
||||||
stage('Checkout') {
|
stage('Checkout') {
|
||||||
steps {
|
steps {
|
||||||
script {
|
setEnv()
|
||||||
util.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') {
|
stage('Deploy') {
|
||||||
when {
|
when {
|
||||||
branch 'master'
|
branch 'master'
|
||||||
}
|
}
|
||||||
|
environment {
|
||||||
|
CREDENTIALS = credentials('docker-registry')
|
||||||
|
}
|
||||||
steps {
|
steps {
|
||||||
sh "docker stack deploy --with-registry-auth --prune --compose-file docker-compose.yml ${env.PROJECT_NAME}"
|
dockerDeploy()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
post {
|
post {
|
||||||
always {
|
always {
|
||||||
script {
|
sendEmail()
|
||||||
util.sendEmail()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue