-
-
Notifications
You must be signed in to change notification settings - Fork 534
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exception when analysing PR targeting long lived branch #4
Comments
To help with replicating this can you provide the following information:
Are you also able to check if also providing |
We are doing tests on SQ 7.7 with plugin version 1.0.1 as downloaded on the release tab. Forcing sonar.pullrequest.base fails too. A successful POST is made to From a DB point-of-view, the master branch exists as a long-lived branch.
|
A lookup is performed on the target branch of a pull request to ensure the branch exists, since SonarQube uses this as the base for collecting metrics on the Pull Request. However, the retrieved branch is then used incorrectly, with the UUID of the retrieved branch's target branch being returned as the target for the Pull Request, rather than the UUID of the retrieved branch. As long-lived branches that are generally targeted by Pull Requests will not have a target branch, this may result in a `NoSuchElementException` from SonarQube's Compute Engine when trying to use the non-existent UUID, or SonarQube showing the wrong branch as being targeted for a pull request and picking up new issues on the source branch incorrectly where a short-lived branch is targeted. This change updates the generation of the pull request details to use the UUID of the retrieved target branch when creating Pull Request details, rather than the UUID of the target of the retrieved target branch.
Could you try using unzipping and installing sonarqube-community-branch-plugin-1.1.0-SNAPSHOT.zip to see if this fixes your issue? It's built from the |
Same :
|
That's a different stack-trace, so it looks like it has progressed beyond the initial failure. Can you confirm what plugins you have installed in SonarQube? I believe my testing didn't face this issue since I may not have any Post Analysis Tasks requiring execution but the code would indicate that you have something that's performing additional activities (Pull Request decoration, report publishing etc). Can you also confirm if this is still on a 'new' project that was created after the Branch Plugin was installed, and the Pull Request target branch does exist? |
Here are all the plugins installed :
The project has been deleted this morning after the 1.1.0-SNAPSHOT was installed. |
I'm unable to replicate your second exception on a clean SonarQube 7.7 installation running a build of this plugin containing the currently proposed fixes for #4 and #6 and a dummy Post Post Analysis Task executing on every scan. As the 2 open issues are both blockers to performing Pull Request analysis and have fixes identified, I'm going to merge the current branches and release the plugin and close the issues as having their initial causes resolved. If you continue to face issues after upgrading to the new plugin then please raise a further issue that details each problem and any steps to replicate it. |
Would you mind posting the commands you’re using for full and PR analysis ? We may miss useful arguments. |
Finally got a PR but ran into #6 (got a String but try to unmarshall as long) |
What did you have to change to get it to work (or what would I need to do to replicate the failure)? |
Don"t really know : we did another clean up (full erasure) of the project in SQ then ran an analysis with a PR name with another name than just digits (we used to set sonar.pullrequest.key to a digits-only key) |
And we dropped the whole ce_activity history table. |
A lookup is performed on the target branch of a pull request to ensure the branch exists, since SonarQube uses this as the base for collecting metrics on the Pull Request. However, the retrieved branch is then used incorrectly, with the UUID of the retrieved branch's target branch being returned as the target for the Pull Request, rather than the UUID of the retrieved branch. As long-lived branches that are generally targeted by Pull Requests will not have a target branch, this may result in a `NoSuchElementException` from SonarQube's Compute Engine when trying to use the non-existent UUID, or SonarQube showing the wrong branch as being targeted for a pull request and picking up new issues on the source branch incorrectly where a short-lived branch is targeted. This change updates the generation of the pull request details to use the UUID of the retrieved target branch when creating Pull Request details, rather than the UUID of the target of the retrieved target branch.
Released in 1.0.2 |
The following exception is raised when analysing a PR.
The master branch already exists for the project.
SonarScanner is started with parameters
-Dsonar.pullrequest.branch=changes/19/14219/2 -Dsonar.pullrequest.key=14219
Any ideas ?
The text was updated successfully, but these errors were encountered: