When aborting a Gradle run with SonarQube analysis, the analysis continues running

With the SonarQube Gradle plugin 6.1.0.5360, if you are executing a SonarQube analysis and during the analysis abort the Gradle build, the Analysis nevertheless continues running and finishes, uploading the result.

When the Gradle build is aborted, the analysis should also stop, and in no case the result should be uploaded to the SQ server.

Hi,

Could you share how you’re aborting?

Also, could you perhaps provide an --info log of this behavior, please?

 
Thx,
Ann

Just Ctrl+C.

I cannot provide info logging of the project in question unfortunately, as it is closed source proprietary project.

Hi,

So you Ctrl-c and… what happens?

 
Ann

The Gradle build is stopped as usual, but the analysis process which now happens in a separate process in latest version continues running.

I notified it because I had a debugger attached on the analysis process to find out why our custom rules are not triggered anymore, but even without the debugger it would then have continued running and submit the analysis result to SonarQube server even though the intention was to abort the analysis.

Maybe there needs to be some mechanics that the scanner can control how the analysis process is forked, so that for example with the Gradle plugin a Gradle worker process via Worker API is used to execute the analysis which can then be properly aborted by Gradle when the build is aborted or something like that.

Hi,

Thanks for those details. I’ll flag this for the team.

On the custom rule side, depending on what version they were written against, you probably need to catch up with some API changes, requiredForLanguages among them..

 
HTH,
Ann

Yes, we already found out that requiredForLanguages was the culprit, thanks.
It was additionally confusing, that in SonarLint the rules were still used, just during normal SonarQube analysis they were ignored.

Hi,

Yeah, I get that. requiredForLanguages was added to limit what’s downloaded during CI-side analysis to limit bandwidth and speed up analysis.

 
Ann

That’s interesting, because the rules were download and also the plugin code was called, just then the rules were not used.

Hi,

Now that you mention it, that stirs a vague memory about order of operations and dependencies.

 
Ann