This is an old revision of the document!
Jenkins: Multibranch Pipeline
General Information
A Jenkins Multibranch pipeline job is flexible because it scans your project for all available branches that have a matching Jenkinsfile and adds that pipeline job.
Checklist
- Jenkins master server installed
- Available Git repo
Creating a multibranch pipeline
Creating a multibranch pipeline is similar to creating a standard pipeline job.
- Click “New Item”
- Enter an item name: <name of multibranch job>
- Click “Multibranch Pipeline”, then click “Ok”
Initial Configuration
After creation, you are brought to the initial multibranch pipeline configuration page.
- Under “Branch Sources”, click “Add source”, then click the type of project (such as Git)
- Project Repository: <paste URL that you can clone the project from>
- Credentials: Select your saved project credentials (if required)
- Behaviors: Default is to discover all branches
- Build strategies: There are a number of build strategies that can influence which branches are built and when.
- See the next section for some of them.
- Note: The default of no build strategies will execute each pipeline found in each branch upon initial discovery (such as when you click Save) OR after each scan that finds a commit change. If this is NOT the desired behavior, look at the available build strategies.
- Build Configuration
- Mode: by Jenkinsfile
- Script Path: Enter the path to the Jenkinsfile stored in the project. This is the pipeline file that will be scanned for in each branch.
- Scan Multibranch Pipeline Triggers: Check this box and select how often to scan the project for branches and Jenkinsfiles in those branches.
- Click “Save” to save the job configuration
Build Strategies
Build strategies are ways to limit what branches are built and when.
- - to add some build strategies.