Environment:
- SCM: Azure DevOps Repos
- CI: Azure Pipelines
- Analyzer pipeline YAML: sonarqube-run.yml
- Branch model: SIT, UAT, main
- SonarQube project currently has default branch set to main
Problem:
- For SIT analysis, when clicking Open in Azure DevOps from SonarQube issue/code links, it opens UAT branch (or sometimes main) instead of SIT.
- In Azure Pipelines, default branch for manual and scheduled builds is already set to SIT for the SIT pipeline definition.
- Pipeline trigger in SIT branch is SIT-only, and pipeline execution itself works from SIT.
- Branch mismatch is specifically in SonarQube generated links.
Expected behavior:
- If analysis is for SIT branch, SonarQube links should open the same file in SIT branch in Azure DevOps.
Actual behavior:
- SonarQube links open UAT or main branch for the same file.
What we already checked:
- Azure pipeline trigger and default branch settings are aligned for SIT pipeline.
- Separate branch behavior in Azure UI works as expected in pipeline context.
- SonarQube default branch is main.
- Issue appears to be branch mapping/context used by SonarQube when generating Azure DevOps links.
Questions:
- Does SonarQube Azure DevOps linking always prefer project default branch unless branch metadata is explicitly provided?
- What is the exact required configuration so SonarQube issue links respect analyzed branch (SIT/UAT) for Azure DevOps repositories?
- Should we use separate SonarQube projects per long-lived branch (SIT and UAT), or is single project branch-aware linking fully supported for Azure DevOps links?
- Which SonarQube properties are mandatory to force correct branch mapping for links in CI runs?