DevOps Automation

DevOps Automation

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.


#DevOps
 View Only

Using one Jenklinsfile accross multiple branch

  • 1.  Using one Jenklinsfile accross multiple branch

    Posted 11 days ago

    I am currently using a Multibranch pipeline in Jenkins. My Project repository contains a Jenkinsfile at its root so every time I create a new branch, Jenkins automatically detects it and runs the pipeline which works fine.

    However, I'm questioning whether this is the right approach. Every branch ends up with its own copy of the `Jenkinsfile`, and keeping them all in sync can become painful as the project grows.

    I'm considering an alternative: having a **separate, dedicated repository** that contains only the `Jenkinsfile`, which would clone the project repository and checkout the target branch passed as a parameter.

    My questions are:

    - Is this a recognized good practice?

    - What are the trade-offs between both approaches (co-located vs. centralized Jenkinsfile)?

    - Are there Jenkins-native features (Shared Libraries, etc.) that address this better?

    Thanks in advance!



    ------------------------------
    Adeel Bablu
    ------------------------------