Skip to content
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

#309: Add support for Sonarqube 8.7 #310

Merged
merged 1 commit into from
Mar 6, 2021
Merged

#309: Add support for Sonarqube 8.7 #310

merged 1 commit into from
Mar 6, 2021

Conversation

mc1arke
Copy link
Owner

@mc1arke mc1arke commented Mar 1, 2021

Sonarqube 8.7 removed the concept of the OrganizationDto and removed the reference to this class in the BranchSupportDelegate interface, so the CommunityBranchSupportDelegate implementation has had to update the relevant method signature, therefore making this version of the plugin binary incompatible with older versions of Sonarqube.

Alongside this, various webservice endpoints for configuring the global ALM definitions have been moved into the Community edition from the commercial Sonarqube editions, so have been removed from this plugin to prevent the bundled definitions conflicting with the plugin versions.

As Sonarqube Community Edition now has direct UI options for configuring Bitbucket Cloud, the relevant endpoints have been introduced for supporting this UI, and the Bitbucket Cloud client used for Pull Request decorating has been updated to use OAuth 2 credential negotiation for authenticating, rather than using the Basic authentication previously used on all requests.

Sonarqube 8.7 removed the concept of the `OrganizationDto` and removed the reference to this class in the `BranchSupportDelegate` interface, so the `CommunityBranchSupportDelegate` implementation has had to update the relevant method signature, therefore making this version of the plugin binary incompatible with older versions of Sonarqube.

Alongside this, various webservice endpoints for configuring the global ALM definitions have been moved into the Community edition from the commercial Sonarqube editions, so have been removed from this plugin to prevent the bundled definitions conflicting with the plugin versions.

As Sonarqube Community Edition now has direct UI options for configuring Bitbucket Cloud, the relevant endpoints have been introduced for supporting this UI, and the Bitbucket Cloud client used for Pull Request decorating has been updated to use OAuth 2 credential negotiation for authenticating, rather than using the Basic authentication previously used on all requests.
@sonarcloud
Copy link

sonarcloud bot commented Mar 1, 2021

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

90.8% 90.8% Coverage
0.0% 0.0% Duplication

@mc1arke
Copy link
Owner Author

mc1arke commented Mar 1, 2021

For anyone wanting to test this change, the build of the last pipeline is available by clicking the Artifacts link on the pipeline, or can download and build the branch directly.

@dpandolfo
Copy link

Hi @mc1arke ,

I tested the 1.7.0-SNAPSHOT plugin with Sonarqube 8.7 and it worked normally using the GITLAB integration.

Pull Request Decoration and Project Import - OK

Thank you for your excellent work on this plugin. 😄

@alekberovvusal
Copy link

I have tested also.

Used below variables in different ways(as parameter, inside build.gradle file, as global variable ).

sonar.pullrequest.key
sonar.pullrequest.base
sonar.pullrequest.branch

Same Error.
This is the error message:

Error Details
java.lang.IllegalStateException: Could not find target branch 'null' in project
	at com.github.mc1arke.sonarqube.plugin.ce.CommunityBranchLoaderDelegate.createPullRequest(CommunityBranchLoaderDelegate.java:98)
	at com.github.mc1arke.sonarqube.plugin.ce.CommunityBranchLoaderDelegate.load(CommunityBranchLoaderDelegate.java:78)
	at com.github.mc1arke.sonarqube.plugin.ce.CommunityBranchLoaderDelegate.load(CommunityBranchLoaderDelegate.java:50)
	at org.sonar.ce.task.projectanalysis.component.BranchLoader.load(BranchLoader.java:44)
	at org.sonar.ce.task.projectanalysis.step.LoadReportAnalysisMetadataHolderStep.execute(LoadReportAnalysisMetadataHolderStep.java:74)
	at org.sonar.ce.task.step.ComputationStepExecutor.executeStep(ComputationStepExecutor.java:81)
	at org.sonar.ce.task.step.ComputationStepExecutor.executeSteps(ComputationStepExecutor.java:72)
	at org.sonar.ce.task.step.ComputationStepExecutor.execute(ComputationStepExecutor.java:59)
	at org.sonar.ce.task.projectanalysis.taskprocessor.ReportTaskProcessor.process(ReportTaskProcessor.java:81)
	at org.sonar.ce.taskprocessor.CeWorkerImpl$ExecuteTask.executeTask(CeWorkerImpl.java:235)
	at org.sonar.ce.taskprocessor.CeWorkerImpl$ExecuteTask.run(CeWorkerImpl.java:217)
	at org.sonar.ce.taskprocessor.CeWorkerImpl.findAndProcessTask(CeWorkerImpl.java:162)
	at org.sonar.ce.taskprocessor.CeWorkerImpl$TrackRunningState.get(CeWorkerImpl.java:137)
	at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:89)
	at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:53)
	at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:125)
	at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:69)
	at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:78)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)

@mc1arke
Copy link
Owner Author

mc1arke commented Mar 3, 2021

@alekberovvusal Can you check your CE log, as you're likely to have an exception logged just before that error. I suspect you're targeting a branch that sonarqube hasn't scanned yet, so it's failing to resolve it:

2021.03.03 20:23:51 ERROR ce[AXf5ws0EF0StF50gBF9y][o.s.c.t.s.ComputationStepExecutor] Execution of listener failed
java.lang.IllegalStateException: Branch has not been set
	at com.google.common.base.Preconditions.checkState(Preconditions.java:508)
	at org.sonar.ce.task.projectanalysis.analysis.AnalysisMetadataHolderImpl.getBranch(AnalysisMetadataHolderImpl.java:150)
	at org.sonar.ce.task.projectanalysis.api.posttask.PostProjectAnalysisTasksExecutor.createBranch(PostProjectAnalysisTasksExecutor.java:222)
	at org.sonar.ce.task.projectanalysis.api.posttask.PostProjectAnalysisTasksExecutor.createProjectAnalysis(PostProjectAnalysisTasksExecutor.java:175)
	at org.sonar.ce.task.projectanalysis.api.posttask.PostProjectAnalysisTasksExecutor.finished(PostProjectAnalysisTasksExecutor.java:107)
	at org.sonar.ce.task.step.ComputationStepExecutor.executeListener(ComputationStepExecutor.java:91)
	at org.sonar.ce.task.step.ComputationStepExecutor.execute(ComputationStepExecutor.java:63)
	at org.sonar.ce.task.projectanalysis.taskprocessor.ReportTaskProcessor.process(ReportTaskProcessor.java:81)
	at org.sonar.ce.taskprocessor.CeWorkerImpl$ExecuteTask.executeTask(CeWorkerImpl.java:235)
	at org.sonar.ce.taskprocessor.CeWorkerImpl$ExecuteTask.run(CeWorkerImpl.java:217)
	at org.sonar.ce.taskprocessor.CeWorkerImpl.findAndProcessTask(CeWorkerImpl.java:162)
	at org.sonar.ce.taskprocessor.CeWorkerImpl$TrackRunningState.get(CeWorkerImpl.java:137)
	at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:89)
	at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:53)
	at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:125)
	at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:69)
	at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:78)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:835)
2021.03.03 20:23:51 ERROR ce[AXf5ws0EF0StF50gBF9y][o.s.c.t.CeWorkerImpl] Failed to execute task AXf5ws0EF0StF50gBF9y
java.lang.IllegalStateException: Could not find target branch 'null' in project
	at com.github.mc1arke.sonarqube.plugin.ce.CommunityBranchLoaderDelegate.createPullRequest(CommunityBranchLoaderDelegate.java:98)
	at com.github.mc1arke.sonarqube.plugin.ce.CommunityBranchLoaderDelegate.load(CommunityBranchLoaderDelegate.java:78)
	at com.github.mc1arke.sonarqube.plugin.ce.CommunityBranchLoaderDelegate.load(CommunityBranchLoaderDelegate.java:50)
	at org.sonar.ce.task.projectanalysis.component.BranchLoader.load(BranchLoader.java:44)
	at org.sonar.ce.task.projectanalysis.step.LoadReportAnalysisMetadataHolderStep.execute(LoadReportAnalysisMetadataHolderStep.java:74)
	at org.sonar.ce.task.step.ComputationStepExecutor.executeStep(ComputationStepExecutor.java:81)
	at org.sonar.ce.task.step.ComputationStepExecutor.executeSteps(ComputationStepExecutor.java:72)
	at org.sonar.ce.task.step.ComputationStepExecutor.execute(ComputationStepExecutor.java:59)
	at org.sonar.ce.task.projectanalysis.taskprocessor.ReportTaskProcessor.process(ReportTaskProcessor.java:81)
	at org.sonar.ce.taskprocessor.CeWorkerImpl$ExecuteTask.executeTask(CeWorkerImpl.java:235)
	at org.sonar.ce.taskprocessor.CeWorkerImpl$ExecuteTask.run(CeWorkerImpl.java:217)
	at org.sonar.ce.taskprocessor.CeWorkerImpl.findAndProcessTask(CeWorkerImpl.java:162)
	at org.sonar.ce.taskprocessor.CeWorkerImpl$TrackRunningState.get(CeWorkerImpl.java:137)
	at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:89)
	at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:53)
	at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:125)
	at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:69)
	at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:78)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:835)

The error handling could be better here, but it's not a new issue in this release.

@mc1arke mc1arke merged commit 9970d5c into master Mar 6, 2021
@mc1arke mc1arke deleted the sq-8_7-support branch March 6, 2021 22:18
@adpeyre
Copy link

adpeyre commented Mar 15, 2021

No problem with the master version. ;) Thx

@robmaas
Copy link

robmaas commented Mar 19, 2021

@mc1arke Thanks, will there be a 'official' release for 8.7 anytime soon? Otherwise I'll have to revert to a manual build which I'd rather not do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants