Multibranch Pipeline in Jenkins
Step 1: Add GitHub Credentials
Navigate to Dashboard → Manage Jenkins → Credentials.
Click Global credentials (or the appropriate domain).
Click Add Credentials.
Select Username and Password:
Username: GitHub username
Password: GitHub personal access token
Click Save.
Step 2: Create a Multibranch Pipeline
Go to Dashboard → Click on New Item.
Select Multibranch Pipeline.
Provide the following details:
Display Name: <Project Name>
Description: <Short Description (Optional)>
Step 3: Configure Branch Sources
Under Branch Sources, click Add source and select GitHub.
Set the following options:
Credentials: Select the previously added GitHub credentials.
Repository HTTPS URL: Copy and paste the project repository URL.
Click Validate to check the connection.
Step 4: Configure Behaviors
Discover Branches (Strategy): All branches.
Discover Pull Requests from Origin (Strategy): The current pull revision.
Discover Pull Requests from Forks (Strategy): The current pull revision.
Trust: Everyone.
Step 5: Add Filters
Click Add → Select Filter by name (with wildcards).
Set Include: <Branch Name>*.
Step 6: Configure Build Settings
Property Strategy: All branches get the same properties.
Build Configuration Mode: By Jenkinsfile.
Script Path: Jenkinsfile (Specify the location of the pipeline script in the repository).
Keep other options as default.
Step 7: Save and Run the Pipeline
Click Save.
The pipeline will automatically scan for branches and pull requests matching the filters.
It will trigger builds based on changes in the repository.