I’m using sonar-scanner cli 7.2.0.5079. This is being used to analyze Gitlab merge requests on CI with merged result pipelines enabled. For example; Merged results pipelines | GitLab Docs. We’ve noticed that the SCM analysis often identifies the incorrect merge-base in this setup. This also changes on subsequent retries of the same pipeline.
Why does sonar-scanner prefer refs/heads/development over refs/remotes/origin/development . In a CI environment, the local reference for a branch would always be stale unless that is explcitiyl checked out.
What impact could the gitlab merge commit have on finding the correct merge base.
Analysis works from the SCM metadata in the analysis environment. refs/remotes/origin/development is not in the local environment, so it’s not available to analysis.
Analysis works on the code in the local environment. If there are changes subsequent to checkout, then you’re not analyzing what you think you are.
Is there any chance you can also provide the details for this? I’m happy to refer any documentation/code that talks about this too.
We depend on merged pipelines since that helps us avoid a lot nasty scenarios that would come up in case we were to merge based on individual branch builds and tests and I wanted to understand why the opposite would be true for running sonar analysis.