r***@ithands.biz
2018-11-27 11:57:25 UTC
Hi Team i want to deploy to the staging only when the code is pushed to
staging and to master only when the code is pushed to master Please help
that what can i do with the script that i made to achieve that
node{
currentBuild.result = "SUCCESS"
try {
stage('Pull-msater') {
// pulling master from the repo
git 'https://github.com/raj1rana/mongoDB-docker.git'
}
stage('pull-staging'){
//pulling staging from the repo
git branch: 'staging', url: '
https://github.com/raj1rana/mongoDB-docker.git'
}
stage('deploy-staging') {
//deploy to staging server
sh 'rsync -avz -e ssh --exclude .git
}
stage('deploy-production'){
//deploy to production server
sh 'rsync -avz -e ssh --exclude .git
}
stage('mail fail/sucess'){
mail body: 'project build successful',
subject: 'project build successful',
}
}
catch (err) {
currentBuild.result = "FAILURE"
mail body: "project build error is here: ${env.BUILD_URL}" ,
subject: 'project build failed',
throw err
}
}
staging and to master only when the code is pushed to master Please help
that what can i do with the script that i made to achieve that
node{
currentBuild.result = "SUCCESS"
try {
stage('Pull-msater') {
// pulling master from the repo
git 'https://github.com/raj1rana/mongoDB-docker.git'
}
stage('pull-staging'){
//pulling staging from the repo
git branch: 'staging', url: '
https://github.com/raj1rana/mongoDB-docker.git'
}
stage('deploy-staging') {
//deploy to staging server
sh 'rsync -avz -e ssh --exclude .git
}
stage('deploy-production'){
//deploy to production server
sh 'rsync -avz -e ssh --exclude .git
}
stage('mail fail/sucess'){
mail body: 'project build successful',
subject: 'project build successful',
}
}
catch (err) {
currentBuild.result = "FAILURE"
mail body: "project build error is here: ${env.BUILD_URL}" ,
subject: 'project build failed',
throw err
}
}
--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/9a3e3b37-0da7-467e-8f05-ecb7458bcf7e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/9a3e3b37-0da7-467e-8f05-ecb7458bcf7e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.