Error on preparation for CSS analysis

I’m building a c#/.net application using jenkins pipeline. Application is build in a docker container with dotnet-sonarscanner installed using following commands in pipeline:

            withSonarQubeEnv('SonarQube') {
                sh "dotnet sonarscanner begin /k:\"PROJECT_KEY\" /d:sonar.verbose=true /d:sonar.links.ci=${env.JOB_URL}"
                sh "dotnet build --configuration Release PROJECT.sln -p:Version=${buildVersion}"
                sh "dotnet sonarscanner end"
              }

during analysis I receive the error CSS rules were not executed. Failed to start server (60s timeout) and sonarqube displays the warning for this analysis CSS rules were not executed. Failed to start server (60s timeout). For detailed error information see log below.

I observed that analysis tries to run the command [PATH_IN_WORKSPACE]/.sonarqube/out/.sonar/mod1/css-bundle/bin/server 36071 127.0.0.1 BUT the workspace does only contain a file server.jsin this location. See attachment.

May this is similar to the following bug https://community.sonarsource.com/t/sonar-scanner-cli-failing-to-analyze-css/35562 BUT I have no chance to change the filename in pipeline during anaylsis.

Does anyone have an Idea to solve this issue or maybe a workaround for that?

versions used

  • Sonarqube 9.0 (build 45539) Developer Edition
  • dotnet-sonarscanner 5.3.1
  • Jenkins Plugin 2.13.1
  • netcore 5.0

Error observed

13:04:57  11:04:57.397 INFO: Sensor CSS Rules [cssfamily]
13:04:57  11:04:57.399 DEBUG: Deploying bundle
13:04:57  11:04:57.399 DEBUG: Deploying css-bundle into [PATH_IN_WORKSPACE]/.sonarqube/out/.sonar/mod1
13:04:57  11:04:57.400 DEBUG: Deploying css-bundle to [PATH_IN_WORKSPACE]/.sonarqube/out/.sonar/mod1
13:04:58  11:04:58.246 DEBUG: Deploying bundle (done) | time=847ms
13:04:58  11:04:58.247 DEBUG: Starting server
13:04:58  11:04:58.253 DEBUG: Using default Node.js executable: 'node'.
13:04:58  11:04:58.254 DEBUG: Checking Node.js version
13:04:58  11:04:58.255 DEBUG: Launching command node -v
13:04:58  11:04:58.263 DEBUG: Using Node.js v14.18.0.
13:04:58  11:04:58.263 DEBUG: Starting Node.js process to start css-bundle server at port 36071
13:04:58  11:04:58.264 DEBUG: Launching command node [PATH_IN_WORKSPACE]/.sonarqube/out/.sonar/mod1/css-bundle/bin/server 36071 127.0.0.1
13:04:58  11:04:58.710 DEBUG: starting stylelint-bridge server at port 36071
13:04:58  11:04:58.719 DEBUG: stylelint-bridge server is running at port 36071
13:04:59  11:04:58.830 DEBUG: Thread[JGit-FileStoreAttributeReader-1,5,main]: no failures when measuring minimal racy interval
13:04:59  11:04:58.831 DEBUG: FileStoreAttributes[fsTimestampResolution=3 ?s, minimalRacyInterval=0 ?s]
13:04:59  11:04:58.832 DEBUG: loading config FileBasedConfig[/home/jenkins/.config/jgit/config]
13:06:06  11:05:58.425 ERROR: CSS rules were not executed. Failed to start server (60s timeout)
13:06:06  org.sonarsource.nodejs.NodeCommandException: Failed to start server (60s timeout)
13:06:06  	at org.sonar.css.plugin.server.CssAnalyzerBridgeServer.startServer(CssAnalyzerBridgeServer.java:113)
13:06:06  	at org.sonar.css.plugin.server.CssAnalyzerBridgeServer.startServerLazily(CssAnalyzerBridgeServer.java:177)
13:06:06  	at org.sonar.css.plugin.CssRuleSensor.execute(CssRuleSensor.java:99)
13:06:06  	at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48)
13:06:06  	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85)
13:06:06  	at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:59)
13:06:06  	at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:77)
13:06:06  	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:59)
13:06:06  	at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:79)
13:06:06  	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
13:06:06  	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
13:06:06  	at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:382)
13:06:06  	at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:378)
13:06:06  	at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:375)
13:06:06  	at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:347)
13:06:06  	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
13:06:06  	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
13:06:06  	at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:136)
13:06:06  	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
13:06:06  	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
13:06:06  	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
13:06:06  	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
13:06:06  	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
13:06:06  	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
13:06:06  	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
13:06:06  	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
13:06:06  	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
13:06:06  	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
13:06:06  	at com.sun.proxy.$Proxy0.execute(Unknown Source)
13:06:06  	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
13:06:06  	at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
13:06:06  	at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
13:06:06  	at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
13:06:06  	at org.sonarsource.scanner.cli.Main.main(Main.java:61)
13:06:06  
13:06:06  11:05:58.457 INFO: Sensor CSS Rules [cssfamily] (done) | time=61060ms

  • potential workaround
    NONE

Does anyone have a minute to have a look at this topic?

Hi,

It’s all good with filename, you can see in the logs that stylelint-bridge server is running at port 36071 so JS script was started properly. That’s Java process fails to hear the server (running in NodeJS process) for some reason, unfortunately so far I have no idea why.

Note that this error does not prevent any other analysis to happen, and to avoid seeing this exception you can exclude all CSS files from analysis.

Soon we plan to change a bit how CSS analysis is done, to make it more robust, so that might fix your problem in future.

Hi, thanks for your feedback.
Excluding all CSS files from analysis doesn’t display this exception, but this doesn’t solve my problem.
I would like to analyze CSS files as well as all other source files in this project.

Hi,

We made the change I was talking about, it will be part of SQ 9.3 (it will be released by the end of January). Let us know if you continue having the problem with SQ 9.3.