Configure different build jobs for different branches

Configure different build jobs for different branches

With the Bitbucket Branch Source plugin, you can configure different build jobs for different branches from the Jenkinsfile for multi-branch projects. The sample Jenkinsfile below specifies different build jobs for branches, development, and production.

pipeline { agent any stages { stage('Build') { sh 'echo "Building project"' } stage('Test') { sh 'echo "Running unit tests"' } stage('Deliver for development') { when { branch 'development' } sh 'echo "This is only run for the development branch"' } stage('Deploy for production') { when { branch 'production' } sh 'echo "This is only run for the production branch"' } } }

For more information, see the Jenkins build-a-multibranch-pipeline-project document.

Need support? Create a request with our support team.

Copyright © 2005 - 2025 Appfire | All rights reserved.