What is a Multi-branch Jenkins Job?

Question
With a newer version of Jenkins, you want to know what a multi-branch job is. What is a multi-branch Jenkins job?

Answer
With a given repository of Git code, you may have different branches. These branches may be for new features of a compiled program, slight changes in code (e.g., to fix a bug or make a procedure run more quickly), or to completely refactor an existing program. It is desirable to have a CI process run on each respective branch before the ultimate merge with the master branch. Multi-branch Jenkins jobs trigger a CI process on each branch of a given repository.

If you use the Pipeline Multibranch Plugin with Jenkins (1), one Jenkinsfile will have a separate job created automatically for each branch. (2) If any of these branches are deleted (aka pruned), the corresponding Jenkins job will be deleted if there are webhooks registered from GitHub into Jenkins. (2)

"Multi-branch pipelines are also possible to configure different jobs for different branches within a single project, eliminating the need for manual job creation and management and enabling automated job stop or suspension as needed. All of this results in consistency, reliability, efficiency, and increased quality." (3)

(1) https://wiki.jenkins.io/display/JENKINS/Pipeline+Multibranch+Plugin
(2) https://jenkins.io/blog/2015/12/03/pipeline-as-code-with-multibranch-workflows-in-jenkins/
(3) https://www.coveros.com/jenkins-pipelines-jenkinsfile/

Leave a comment

Your email address will not be published. Required fields are marked *