Hi Team,
First and foremost, could you please suggest which plugins or options available in the Jenkins pipeline job → Configure → Build Triggers section would be most helpful for triggering builds when a Bitbucket PR is opened? Additionally, I need the PR-related Bitbucket environment variables to use in my pipeline script for subsequent stages, specifically for SonarQube analysis. This analysis should be performed on the branch specified in the PR request, meaning it should analyze the PR branch.
Our goal is to ensure that SonarQube decorates each pull request in Bitbucket separately when a PR is opened. The project team will use the SonarQube analysis report to make decisions about merging into the master branch.
We want to use a single pipeline job script that can handle all branches—master, feature, develop, and PR branches—without any manual intervention to change pipeline values. Could you please suggest how we can achieve this or any other approaches we might consider?
Additionally, when a PR is merged into master, the SonarQube analysis should be performed on the master branch. The pipeline script for the entire Bitbucket repository should remain the same, but its variables should adapt based on the specific branches.