Template for a good new topic, formatted with Markdown:
ALM used: GitHub
CI system used: GitHub
Scanner command used when applicable (private details masked): N/A
Languages of the repository: Swift
Only if the SonarCloud project is public, the URL: private
Error observed (wrap logs/code around with triple quotes ``` for proper formatting): see below
Steps to reproduce: Merge PR to main branch
Potential workaround: N/A
Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!
We’re getting this error: Project or branch in report (projectKey) does not match the project or branch under which it was submitted (projectKey:BRANCH:mainBranch)
projectKey and mainBranch are NOT the real values. This only happens when merging a PR to the main branch. When a PR is created, the scan is done correctly. The only change is that the main branch was changed from a different branch some months ago. What makes it difficult to understand is that the sonar scan wasn’t setup properly before, so when it was configured properly is when the main branch was changed.
What other information do I need to share? Or is there anything that anyone knows that could cause this and we can fix in some configuration? Appreciate any help.
Are you using a sonar-project.properties file to detail your project key and other settings? Would you be able to share this if you are? Alternatively are you passing the values manually. If you can share some information of the parameters you are passing this would help to isolate the issue. Also if you have a recent date and time of a failure I could try and find this in our logs to further assess the issue.
hi Shane. Apparently I can’t tag you lol. sorry for the late reply. I do appreciate you getting back.
The last failure was:
May 15, 2024 - 11:24:12 AM
Started/Ended: 11:24:12 AM
We’re using a sonar_token in GitHub actions so I believe all of that information gets injected, because I don’t see it on the build.yml. the only thing we put there are custom settings for the coverage/exclusions/etc. I do see on the task that failed, it shows you everything, so if you can access that and let us know what’s going on. that would be great
This is what the task is: iOSToolbox Project Analysis
ID: AY982plhk64-NvkBkgsL
can you view that and access everything? the project key is correct. It’s just strange because this error only occurs when a PR is merged onto the main branch. when we create PRs and make revisions, the sonar scan works correctly.
We are struggling to reproduce the behavior. To get some additional data, I’ll start a private thread with you and a colleague who joined me in the effort.