Skip to main content

Command Palette

Search for a command to run...

Part 8: Multibranch Pipelines

Scaling with branches

Published
3 min read
Part 8: Multibranch Pipelines

Jenkins CI/CD Series

Part Article
1 Install Jenkins with Docker
2 Creating Your First Jenkins Pipeline
3 Jenkins SSH Remote Execution
4 Automating MySQL Backup to AWS S3
5 Making Jenkins Automation Scalable
6 Running Ansible from Jenkins
7 Jenkins Pipeline from GitHub
8 Multibranch Pipelines
9 Parameterized Pipelines
10 Environment Variables in Pipelines

Goal

  • Implement a Multibranch Pipeline in Jenkins

  • Automatically detect and build multiple Git branches

  • Enable Jenkins to run pipelines per branch dynamically

  • Understand how code changes in different branches trigger separate builds


Purpose

  • The purpose of this part is to move from a single pipeline setup to a scalable, branch-aware CI/CD system.

    In real-world DevOps environments:

    • Teams work on multiple branches (feature, dev, release, main)

    • Each branch may have different code and pipeline behavior

    • Manual pipeline creation per branch is not scalable

    Multibranch Pipelines solve this by:

    • Automatically discovering branches from GitHub

    • Running pipelines based on Jenkinsfile inside each branch

    • Allowing parallel and independent builds per branch

    This is a key step toward production-grade CI/CD pipelines.


Prerequisites

Before starting this part, ensure:

Infrastructure Setup

  • Ready to use Host and the directory structure to run Dockerfiles and docker-compose.yml (Refer to Part 1)

  • GitHub repository demo-app

  • Jenkins has:

    • Git plugin installed

    • Access to GitHub repository (public or credentials configured)


Step-by-step implementation

  • Go to the repo and add another branch.
  • Scan the Multibranch pipeline now, and it will populate the branches
  • Let's make some changes to the repo and commit to the new branch."devbranch"

Here, I removed a small block from the Jenkinsfile and merged it to devbranch

  • Let's check the last Build from devbranch

Done!!!


Conclusion

In this part, you successfully evolved your CI/CD pipeline to a branch-aware automation system

You learned how to:

  • Automatically detect new branches in GitHub

  • Run pipelines dynamically per branch

  • Manage different code versions using Jenkins pipelines

  • Enable scalable CI/CD workflows for team-based development

This is exactly how modern DevOps teams handle:

  • Feature development

  • Parallel testing


🔗 Continue the Series

⬅️ Previous Article: Part 7 Control Jenkins Pipeline through GitHub
➡️ Next Article: Part 9 Parameterized Pipelines


⭐ If you found this article useful, follow https://ask-abhi.com for more DevOps tutorials.