Sonar-scanner doesn't respect -Dsonar.scanner.os=linux for "helm/kubernetes" stuff and aborts

Must-share information (formatted with Markdown):

  • scanner 6.2.1.4610
  • how is SonarQube deployed: zip
  • run the sonar scanner on the source of wordpress
  • what have you tried so far to achieve this: set -Dsonar.scanner.os=linux

Scanning the wordpress source with the linux version of the sonar scanner on a system which (for whatever reason) doesn’t return “linux” as the osname, but setting -Dsonar.scanner.os=linux parses the currently 2788 files in the wordpress repo, and then trips over the exception below and aborts everything. My expectation would be that the helm/kubernetes part respects the sonar.scanner.os setting and proceeds to what I told it to do (assuming to run on linux) or at least not abort the entire scan and provide a warning instead of a complete failure. In this particular case I’m not interested in the kubernetes part. Alternatively to fix what I consider to be a bug, is there the possibility to disable the kubernetes part? Just because some files may be related to kubernetes, it doesn’t mean for my use case I care about it. For your own development you may want to care, but regarding a 3rd party development which you use (think about supply chain scenarios), you may only be interested in parts of what can be done. If it wouldn’t fail, I wouldn’t mind to check what I have no use case for, but given that it fails completely, it’s reasonable to disable it.

The exception:

java.lang.IllegalStateException: Unsupported OS: freebsd
        at org.sonar.iac.helm.utils.OperatingSystemUtils.getNormalizedOsName(OperatingSystemUtils.java:52)
        at org.sonar.iac.helm.utils.OperatingSystemUtils.getCurrentPlatformIfSupported(OperatingSystemUtils.java:36)
        at org.sonar.iac.kubernetes.plugin.HelmProcessor.isHelmEvaluatorExecutableAvailable(HelmProcessor.java:53)
        at org.sonar.iac.kubernetes.plugin.KubernetesSensor.shouldEnableHelmAnalysis(KubernetesSensor.java:187)
        at org.sonar.iac.kubernetes.plugin.KubernetesSensor.initContext(KubernetesSensor.java:91)
        at org.sonar.iac.common.extension.IacSensor.execute(IacSensor.java:93)

Hi,

Try passing -Dsonar.kubernetes.activate=false.

 
HTH,
Ann