aosapps / drone-sonar-plugin Goto Github PK
View Code? Open in Web Editor NEWThe plugin of Drone CI to integrate with SonarQube (previously called Sonar), which is an open source code quality management platform.
License: MIT License
The plugin of Drone CI to integrate with SonarQube (previously called Sonar), which is an open source code quality management platform.
License: MIT License
According to docs:
projectKey: DRONE_REPO
projectName: DRONE_REPO
You could also add a file named sonar-project.properties at the root of your project to specify parameters.
why not be able to set projectKey and projectName using settings in drone pipeline?
I have a project with a lot of git branches, and I want to send to sonarqube each branch as a different project. With the actual approach, I need to set different settings in sonar-project.properties for each branch to get that.
It would be great if I can set key and project name in the plugin settings, as I have different steps in drone.yml for each branch.
I dont know if there is any technical reason for this
Hi,
Do you plan to support retrieving the quality gate value once SonarQube is done processing the code, so the pipeline can succeed or fail in Drone based on it ?
Thanks.
Version 1.0 of drone-sonar-plugin does not support
I believe that by default, this plugin should support the following project types as listed on the sonarqube web page:
ABAP
Apex
C/C++
C#
CSS
COBOL
Flex
Go
HTML
Java
JavaScript
Kotlin
Objective-C
PL/SQL
PL/I
PHP
Python
RPG
Ruby
Scala
Swift
T-SQL
TypeScript
VB.NET
VB6
XML
latest: Pulling from aosapps/drone-sonar-plugin
Digest: sha256:003649539ba1c47a529d4bd9f021e0193ba61ead19459c621c2dc94ea1d5c52a
Status: Image is up to date for aosapps/drone-sonar-plugin:latest
==> Code Analysis Result: INFO: Scanner configuration file: /bin/sonar-scanner-4.2.0.1873/conf/sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarQube Scanner 4.2.0.1873
INFO: Java 1.8.0_212 IcedTea (64-bit)
INFO: Linux 4.9.0-13-amd64 amd64
INFO: User cache: /root/.sonar/cache
INFO: SonarQube server 8.4.2
INFO: Default locale: "en_US", source code encoding: "UTF-8" (analysis is platform dependent)
WARN: SonarScanner will require Java 11 to run starting in SonarQube 8.x
INFO: Load global settings
INFO: Load global settings (done) | time=551ms
INFO: Server id: 243B8A4D-AXTFgNTeSeSoX_ViyX39
INFO: User cache: /root/.sonar/cache
INFO: Load/download plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=163ms
INFO: Load/download plugins (done) | time=2635ms
INFO: Process project properties
INFO: Process project properties (done) | time=16ms
INFO: Project key: Webteam:Intern
INFO: Base dir: /drone/src
INFO: Working dir: /drone/src/.scannerwork
INFO: Load project settings for component key: 'Webteam:Intern'
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=145ms
INFO: Auto-configuring with CI 'DroneCI'
INFO: Load active rules
INFO: Load active rules (done) | time=758ms
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 9.730s
INFO: Final Memory: 10M/144M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
java.lang.IllegalArgumentException: SCM provider was set to "git" but no SCM provider found for this key. No SCM provider installed
at org.sonar.scanner.scm.ScmConfiguration.setProviderIfSupported(ScmConfiguration.java:120)
at java.util.Optional.ifPresent(Optional.java:159)
at org.sonar.scanner.scm.ScmConfiguration.start(ScmConfiguration.java:96)
at org.sonar.core.platform.StartableCloseableSafeLifecyleStrategy.start(StartableCloseableSafeLifecyleStrategy.java:40)
at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.start(AbstractInjectionFactory.java:84)
at org.picocontainer.behaviors.AbstractBehavior.start(AbstractBehavior.java:169)
at org.picocontainer.behaviors.Stored$RealComponentLifecycle.start(Stored.java:132)
at org.picocontainer.behaviors.Stored.start(Stored.java:110)
at org.picocontainer.DefaultPicoContainer.potentiallyStartAdapter(DefaultPicoContainer.java:1016)
at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1009)
at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:767)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:144)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
at com.sun.proxy.$Proxy0.execute(Unknown Source)
at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
at org.sonarsource.scanner.cli.Main.main(Main.java:61)
ERROR:
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.
exit status 1
Hi !
Nodejs version used on this drone runner is 10, it's reaching EOL and will probably not be supported for a long time by sonarqube.
Updating to 16 (latest LTS) would be nice ๐
Thanks for your work :)
Hello
I'm trying to run drone sonarqube plugin get an error.
SonarQube 7.6.0.21501
drone 0.8
Enviroment Rancher 2.2.2
pipeline:
code-analysis:
image: aosapps/drone-sonar-plugin
secrets: [ sonar_host, sonar_token ]
==> Code Analysis Result: INFO: Scanner configuration file: /bin/sonar-scanner-3.3.0.1492/conf/sonar-scanner.properties
INFO: Project root configuration file: /drone/src/-------/-----/--------/sonar-project.properties
INFO: SonarQube Scanner 3.3.0.1492
INFO: Java 1.8.0_171 Oracle Corporation (64-bit)
INFO: Linux 4.15.0-46-generic amd64
INFO: User cache: /root/.sonar/cache
ERROR: SonarQube server [] can not be reached
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 0.645s
INFO: Final Memory: 3M/59M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
ERROR: Unable to execute SonarQube
ERROR: Caused by: Fail to get bootstrap index from server
ERROR: Caused by: Expected URL scheme 'http' or 'https' but no colon was found
ERROR:
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.
exit status 1
I know sonarqube webhook might be able to send an email to certain people,
but I would like to send an IM message in the drone-sonar-plugin, showing how many bugs are detected.
I see that you updated the Dockerfile to use Java 11. Are you planning on pushing that change to dockerhub?
When running drone-sonar-plugin against my nodejs project, I get the following error.
ERROR: Failed to get Node.js version. No CSS files will be analyzed.
--
java.io.IOException: Cannot run program "node": error=2, No such file or directory
Is there someway to account for this?
When the drone pipeline is started following a pull request, the sonar analyzer is not called in pull request mode.
Hello,
Apparently the docker image is built using the wrong java version.
blocking the scan process on a simple check.
java.lang.NumberFormatException: For input string: "14-ea"
INFO: ------------------------------------------------------------------------
at com.google.gson.internal.reflect.ReflectionAccessor.(ReflectionAccessor.java:36)
at com.google.gson.internal.ConstructorConstructor.(ConstructorConstructor.java:51)
at com.google.gson.Gson.(Gson.java:205)
at com.google.gson.Gson.(Gson.java:185)
at org.sonar.scanner.bootstrap.ScannerPluginInstaller.listInstalledPlugins(ScannerPluginInstaller.java:104)
at org.sonar.scanner.bootstrap.ScannerPluginInstaller.loadPlugins(ScannerPluginInstaller.java:76)
at org.sonar.scanner.bootstrap.ScannerPluginInstaller.installRemotes(ScannerPluginInstaller.java:60)
at org.sonar.scanner.bootstrap.ScannerPluginRepository.start(ScannerPluginRepository.java:59)
at org.sonar.core.platform.StartableCloseableSafeLifecyleStrategy.start(StartableCloseableSafeLifecyleStrategy.java:40)
at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.start(AbstractInjectionFactory.java:84)
at org.picocontainer.behaviors.AbstractBehavior.start(AbstractBehavior.java:169)
at org.picocontainer.behaviors.Stored$RealComponentLifecycle.start(Stored.java:132)
at org.picocontainer.behaviors.Stored.start(Stored.java:110)
at org.picocontainer.DefaultPicoContainer.potentiallyStartAdapter(DefaultPicoContainer.java:1016)
at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1009)
at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:767)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:73)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
at com.sun.proxy.$Proxy0.execute(Unknown Source)
at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
at org.sonarsource.scanner.cli.Main.main(Main.java:61)
Caused by: java.lang.NumberFormatException: For input string: "14-ea"
at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:68)
at java.base/java.lang.Integer.parseInt(Integer.java:652)
at java.base/java.lang.Integer.parseInt(Integer.java:770)
at com.google.gson.util.VersionUtils.determineMajorJavaVersion(VersionUtils.java:28)
at com.google.gson.util.VersionUtils.(VersionUtils.java:24)
... 32 more
ERROR:
ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.
SonarQube 8.3.1
Drone v1.6.5
Drone Kube Runer 1.0.0-beta.1
Community Branch Plugin 1.3.1
step config
- name: code-analysis
image: aosapps/drone-sonar-plugin
settings:
sonar_host:
from_secret: sonar_host
sonar_token:
from_secret: sonar_token
timeout: 20
sources: .
level: TRACE
showProfiling: true
branchAnalysis: true
Logs step
12:03:07.826 INFO: Load project pull requests (done) | time=8ms
12:03:07.826 INFO: Load branch configuration
12:03:07.839 INFO: ------------------------------------------------------------------------
12:03:07.839 INFO: EXECUTION FAILURE
12:03:07.839 INFO: ------------------------------------------------------------------------
12:03:07.840 INFO: Total time: 8.859s
12:03:07.886 INFO: Final Memory: 15M/181M
12:03:07.886 INFO: ------------------------------------------------------------------------
12:03:07.886 ERROR: Error during SonarQube Scanner execution
java.lang.IllegalStateException: Unable to load component class org.sonar.scanner.scan.filesystem.InputComponentStore
at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:66)
at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:632)
at org.picocontainer.parameters.BasicComponentParameter$1.resolveInstance(BasicComponentParameter.java:118)
at org.picocontainer.parameters.ComponentParameter$1.resolveInstance(ComponentParameter.java:136)
at org.picocontainer.injectors.SingleMemberInjector.getParameter(SingleMemberInjector.java:78)
at org.picocontainer.injectors.ConstructorInjector$CtorAndAdapters.getParameterArguments(ConstructorInjector.java:309)
at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:335)
at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364)
at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56)
at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64)
at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91)
at org.picocontainer.DefaultPicoContainer.instantiateComponentAsIsStartable(DefaultPicoContainer.java:1034)
at org.picocontainer.DefaultPicoContainer.addAdapterIfStartable(DefaultPicoContainer.java:1026)
at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1003)
at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:767)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:141)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
at com.sun.proxy.$Proxy0.execute(Unknown Source)
at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
at org.sonarsource.scanner.cli.Main.main(Main.java:61)
Caused by: java.lang.IllegalStateException: Unable to load component interface org.sonar.scanner.scan.branch.BranchConfiguration
at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:66)
at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:632)
at org.picocontainer.parameters.BasicComponentParameter$1.resolveInstance(BasicComponentParameter.java:118)
at org.picocontainer.parameters.ComponentParameter$1.resolveInstance(ComponentParameter.java:136)
at org.picocontainer.injectors.SingleMemberInjector.getParameter(SingleMemberInjector.java:78)
at org.picocontainer.injectors.ConstructorInjector$CtorAndAdapters.getParameterArguments(ConstructorInjector.java:309)
at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:335)
at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364)
at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56)
at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64)
at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91)
at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:699)
at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:647)
at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:64)
... 34 more
Caused by: java.lang.NoSuchFieldError: SHORT
at com.github.mc1arke.sonarqube.plugin.scanner.CommunityBranchConfigurationLoader.computeBranchType(CommunityBranchConfigurationLoader.java:147)
at com.github.mc1arke.sonarqube.plugin.scanner.CommunityBranchConfigurationLoader.createBranchConfiguration(CommunityBranchConfigurationLoader.java:127)
at com.github.mc1arke.sonarqube.plugin.scanner.CommunityBranchConfigurationLoader.load(CommunityBranchConfigurationLoader.java:96)
at org.sonar.scanner.scan.branch.BranchConfigurationProvider.provide(BranchConfigurationProvider.java:43)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.picocontainer.injectors.MethodInjector.invokeMethod(MethodInjector.java:129)
at org.picocontainer.injectors.MethodInjector.access$000(MethodInjector.java:39)
at org.picocontainer.injectors.MethodInjector$2.run(MethodInjector.java:113)
at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
at org.picocontainer.injectors.MethodInjector.decorateComponentInstance(MethodInjector.java:120)
at org.picocontainer.injectors.CompositeInjector.decorateComponentInstance(CompositeInjector.java:58)
at org.picocontainer.injectors.Reinjector.reinject(Reinjector.java:142)
at org.picocontainer.injectors.ProviderAdapter.getComponentInstance(ProviderAdapter.java:96)
at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:699)
at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:647)
at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:64)
... 48 more
12:03:07.890 ERROR:
12:03:07.890 ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.
exit status 1
i want to transfer DRONE environment variable to specify some of sonar properties. How can i do this ??
Thanks for this plugin.
I'm just trying to use this with our newly setup drone, and though I'm sure I have the sonar_host and sonar_token values set correctly in secrets, I'm unable to see in the logs that it's actually being read:
My pipeline section looks like:
pipeline:
code-analysis:
image: aosapps/drone-sonar-plugin
settings:
sonar_host:
from_secret: sonar_host
sonar_token:
from_secret: sonar_token
I could just be missing something simple. Thank you.
I am trying to use projectKey and projectName parameters using sonar-project.properties file in drone v 0.8 but it is not picking the correct configuration.
Reference file:
sonar.projectName=preprocessor
sonar.projectKey=com.xyz.abc:preprocessor
Can you please let me know any other alternative ?
Hi, I'd like to thank you for creating this awesome plugin. I was playing around with it and found it very intuitive to use. I'm facing a small problem, and would like to make sure that it isn't a bug. The documentation mentions:
The projectKey and projectName of SonarQube project are filled using the full repository name. You could also add a file named sonar-project.properties at the root of your project to specify parameters.
I specified a sonar-project.properties file, but the plugin still seems to use the repository name, instead of the one specified as the project key. The sonar-project.properties file is:
sonar.projectKey=testing-drone-sonar
sonar.projectName=testing-drone-sonar
sonar.sources=src
sonar.language=py
sonar.python.coverage.reportPath=coverage.xml
sonar.python.xunit.reportPath=pytest.xml
The .drone.yml file is:
---
kind: pipeline
name: test-drone
type: docker
steps:
- name: deploy
image: python:3.8
commands:
- pip install pipenv
- pipenv install --dev
- pipenv run python -m pytest --cov-report=html:htmlcov --cov=src --junitxml=pytest.xml
- pipenv run python -m coverage xml -i
- name: code-analysis
image: aosapps/drone-sonar-plugin
settings:
sonar_host:
from_secret: sonar_host
sonar_token:
from_secret: sonar_token
And I have my .drone.yml and the sonar-project.properties file at my root.
Can you take a look at this and let me know if it is a bug, or if I need to change the configurations in some way? Thanks for your help.
i use drone to implement my ci process. but this plugin seems a little weak. Can it do this function ?
pp
I have a sonar-project.properties file and set the
name: code-analysis
image: aosapps/drone-sonar-plugin
settings:
usingProperties: true
However i get:
1 | ==> Code Analysis Result:
-- | --
2 | INFO: Scanner configuration file: /bin/sonar-scanner-4.4.0.2170/conf/sonar-scanner.properties
3 | INFO: Project root configuration file: NONE
47 | INFO: ------------------------------------------------------------------------
48 | INFO: Total time: 6.901s
49 | INFO: Final Memory: 18M/119M
50 | INFO: ------------------------------------------------------------------------
51 | ERROR: Error during SonarQube Scanner execution
52 | org.sonar.java.AnalysisException: Your project contains .java files, please provide compiled classes with sonar.java.binaries property, or exclude them from the analysis with sonar.exclusions property.
53 | at org.sonar.java.JavaClasspath.init(JavaClasspath.java:64)
54 | at org.sonar.java.AbstractJavaClasspath.getElements(AbstractJavaClasspath.java:280)
55 | at org.sonar.java.SonarComponents.getJavaClasspath(SonarComponents.java:149)
56 | at org.sonar.java.JavaSquid.(JavaSquid.java:81)
57 | at org.sonar.plugins.java.JavaSquidSensor.execute(JavaSquidSensor.java:102)
58 | at
ERROR: Error during SonarScanner execution
64 | org.sonar.java.AnalysisException: Please provide compiled classes of your project with sonar.java.binaries property
65 | at org.sonar.java.JavaClasspath.init(JavaClasspath.java:64)
66 | at org.sonar.java.AbstractJavaClasspath.getElements(AbstractJavaClasspath.java:280)
67 | at
I use the lastest plugin image, and my .drone.yml
just like this:
- name: sonar
image: aosapps/drone-sonar-plugin
pull: if-not-exists
settings:
sonar_host:
from_secret: sonar_host
sonar_token:
from_secret: sonar_token
when:
event:
- push
Please help.
I have issue run lastest drone-sonar-plugin
my config
- name: code analysis
image: aosapps/drone-sonar-plugin
settings:
sonar_host:
from_secret: sonar_host
sonar_token:
from_secret: sonar_token
key: project-key
name: project-name
ver: 1.0
timeout: 20
sources: .
level: DEBUG
showProfiling: true
exclusions: "**/static/**/*,**/dist/**/*.js"
`
error log
```console
==> Code Analysis Result: INFO: Scanner configuration file: /bin/sonar-scanner-3.2.0.1227/conf/sonar-scanner.properties
--
3 | INFO: Project root configuration file: NONE
4 | 08:48:30.266 INFO: SonarQube Scanner 3.2.0.1227
5 | 08:48:30.271 INFO: Java 1.8.0_171 Oracle Corporation (64-bit)
6 | 08:48:30.271 INFO: Linux 5.0.0-2.el7.elrepo.x86_64 amd64
7 | 08:48:30.545 DEBUG: keyStore is :
8 | 08:48:30.545 DEBUG: keyStore type is : jks
9 | 08:48:30.546 DEBUG: keyStore provider is :
10 | 08:48:30.546 DEBUG: init keystore
11 | 08:48:30.546 DEBUG: init keymanager of type SunX509
12 | 08:48:30.725 DEBUG: Create: /root/.sonar/cache
13 | 08:48:30.733 INFO: User cache: /root/.sonar/cache
14 | 08:48:30.733 DEBUG: Create: /root/.sonar/cache/_tmp
15 | 08:48:30.741 DEBUG: Extract sonar-scanner-api-batch in temp...
16 | 08:48:30.759 DEBUG: Get bootstrap index...
17 | 08:48:30.759 DEBUG: Download: /batch/index
18 | 08:48:30.764 ERROR: SonarQube server [] can not be reached
19 | 08:48:30.765 INFO: ------------------------------------------------------------------------
20 | 08:48:30.765 INFO: EXECUTION FAILURE
21 | 08:48:30.765 INFO: ------------------------------------------------------------------------
22 | 08:48:30.765 INFO: Total time: 0.652s
23 | 08:48:30.839 INFO: Final Memory: 4M/151M
24 | 08:48:30.839 INFO: ------------------------------------------------------------------------
25 | 08:48:30.840 ERROR: Error during SonarQube Scanner execution
26 | 08:48:30.840 ERROR: Unable to execute SonarQube
27 | 08:48:30.840 ERROR: Caused by: Fail to get bootstrap index from server
28 | 08:48:30.840 ERROR: Caused by: unexpected url: /batch/index
29 | 08:48:30.840 ERROR:
30 | 08:48:30.840 ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.
31 | ย
32 | exit status 1
`
Hello
First off, Great plugin - Thank you! ๐ ๐
I have a Java Maven project on my Gitea, with it I use Drone for CI purposes and your plugin to communicate between Drone and SonarQube.
I have an Issue/Question/FeatureRequest, I'm not sure what category the following belongs to...
I'm trying to fix three issues I've encountered using this plugin:
/root/.sonar
folder the downloaded plugin are saved, but to no avail.I was able to workaround all these issues using the Scanner Analysis Parameters:
sonar.java.libraries=target/classes
fixed the first issue, since now SonarQube knows where the class files are, I'm no longer seeing the warning.sonar.tests=src/test/java
fixed the second issue, since now SonarQube knows where the test files are and can match Surfire's reports to them. The Junit Reports are displayed.sonar.userHome=sqplugins
fixed my third and final issue, since the sqplugins
is a new folder I've created and can be cached using Meltwaters's Drone Cache Plugin. The plugin runtime has reduced from 4-8 minutes (depending on the amount of plugins I use) to less then 20 seconds, since the previous downloaded plugins are now accessible.Going through your code, I've noticed this plugin is not handling these three "life-saving" arguments.
So as a workaround, I ended up with this step in my .drone.yml
configuration:
- name: sonar-scanner
image: aosapps/drone-sonar-plugin:1.0
commands:
- mkdir -p sqplugins
- >-
sonar-scanner -Dsonar.projectKey=tomerfi:selfhost-test2
-Dsonar.projectName=tomerfi/selfhost-test2
-Dsonar.host.url=[REDUCTED]
-Dsonar.login=[REDUCTED]
-Dsonar.projectVersion=0.0.1
-Dsonar.links.scm=[REDUCTED]
-Dsonar.sources=src/main/java
-Dsonar.tests=src/test/java
-Dsonar.java.libraries=target/classes
-Dsonar.scm.provider=git
-Dsonar.userHome=sqplugins
The sqplugins
folder, is of course cached in the next step and restored in the previous one using Meltwaters's Drone Cache Plugin.
As you can see, It's a messy solution, it works, but it's messy.
My main issue now is that I don't have access to the plugin configuration or the repository secrets, so the arguments values, especially the host url
and host token
needs to manually added to the .drone.yml
file, which is of course a very bad practice.
To sum it up:
Thank you very much!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.