64 lines
2.0 KiB
Groovy
64 lines
2.0 KiB
Groovy
pipeline {
|
|
agent any
|
|
options {
|
|
buildDiscarder logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '5', daysToKeepStr: '', numToKeepStr: '5')
|
|
}
|
|
stages {
|
|
stage('Develop Branch Deploy Code') {
|
|
when {
|
|
branch 'develop'
|
|
}
|
|
environment {
|
|
github_branch = "develop"
|
|
dockerimagename = "devteambflows/gepafin-api-dev"
|
|
dockerImage = ""
|
|
registryCredential = 'dockerhublogin'
|
|
}
|
|
steps {
|
|
git branch: "${github_branch}", url: 'https://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@github.com/Kitzanos/GEPAFIN-BE.git'
|
|
script {
|
|
sh '/usr/share/maven/bin/mvn clean install -Dmaven.test.skip=true -Dspring.profiles.active=dev'
|
|
}
|
|
script {
|
|
dockerImage = docker.build dockerimagename
|
|
}
|
|
script {
|
|
docker.withRegistry('https://registry.hub.docker.com', registryCredential) {
|
|
dockerImage.push("latest")
|
|
}
|
|
}
|
|
script {
|
|
sh 'ssh ubuntu@jenkins-server1.bflows.ai "sh gepafin-dev-api.sh"'
|
|
}
|
|
}
|
|
}
|
|
stage('Production Branch Deploy Code') {
|
|
when {
|
|
branch 'master'
|
|
}
|
|
environment {
|
|
github_branch = "master"
|
|
dockerimagename = "devteambflows/gepafin-api-production"
|
|
dockerImage = ""
|
|
registryCredential = 'dockerhublogin'
|
|
}
|
|
steps {
|
|
git branch: "${github_branch}", url: 'https://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@github.com/Kitzanos/GEPAFIN-BE.git'
|
|
script {
|
|
sh '/usr/share/maven/bin/mvn clean install -Dmaven.test.skip=true -Dspring.profiles.active=production'
|
|
}
|
|
script {
|
|
dockerImage = docker.build dockerimagename
|
|
}
|
|
script {
|
|
docker.withRegistry('https://registry.hub.docker.com', registryCredential) {
|
|
dockerImage.push("latest")
|
|
}
|
|
}
|
|
script {
|
|
sh 'ssh ubuntu@79.137.88.15 "sh gepafin-production-api.sh"'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |