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:
- SonarQube says its result could have been better if had passed the location on the my byte-code classes.
- JUnit reports doesn't show up after configuring the correct path of the reports created by Maven's Surefire plugin.
- The SonarScanner that runs by this plugin takes to long since it's downloading all the plugins from the SonarQube server every time it runs. I tried to solve it using Meltwaters's Drone Cache Plugin and caching the
/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:
- Using
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.
- Using
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.
- Using
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:
- Can you perhaps think of a better, less messy workaround, one that won't require adding the url/token manually to the configuration file?
- Do you know of a way I can gain access to the secrets in SonarQube?
- Do you have any future plans on adding more arguments to the plugin which will allow more control of the Sonar Scanner, I wouldn't mind PR'ing it myself, but I'm not familiar with Go, so it might take some time.
Thank you very much!