We are deploying our application using Jenkins pipeline like this -
pipeline {
agent any
stages {
stage('Build For Production') {
when { branch 'development' }
steps {
sh './bin/build.sh'
}
}
stage('Build For Production') {
when { branch 'master' }
steps {
sh './bin/copy_needed_auth.sh'
sh './bin/build.sh'
}
}
}
}
When a developer pushes code on bitbucket, The application is deployed automatically. Using branch, we set our deployment strategy.
when { branch 'master' }
But we need to set a manual chacking for deploying on production (master branch) like - when a developer will merge code in the master branch, he will also set some tag or something like that so that Jenkins pipeline will check branch + other manual logic to deploy in production.
we are doing like this -
when {
branch 'master'
tag: 'release-*'
}
But it's not working. Is there any other strategy to do that?