Github action failure with sonarcloud-github-c-cpp@v3 on Windows 11

  • ALM used: GitHub
  • CI system used: Github Actions
  • Languages of the repository: C++, Objective C
  • Error observed
Running WSL as local system is not supported.
Error code: Bash/WSL_E_LOCAL_SYSTEM_NOT_SUPPORTED

  • Steps to reproduce: Use SonarSource/sonarcloud-github-c-cpp@v3 on a Windows 11 CI runner

Dear SonarCloud Community,

I am using the following action inside a github workflow that is run on my Windows 11 CI runner:

      - name: Install sonar-scanner
        uses: SonarSource/sonarcloud-github-c-cpp@v3
        env:
          SONAR_HOST_URL: https://sonarcloud.io

This action fails with the following error message :

Run ${GITHUB_ACTION_PATH}/scripts/create_install_path.sh
  ${GITHUB_ACTION_PATH}/scripts/create_install_path.sh
  shell: C:\Windows\system32\bash.EXE --noprofile --norc -e -o pipefail {0}
  env:
    SONAR_HOST_URL: https://sonarcloud.io
    INSTALL_PATH: .sonar
Running WSL as local system is not supported.

Error code: Bash/WSL_E_LOCAL_SYSTEM_NOT_SUPPORTED

Is it an expected limitation? If yes, is there a way to workaround it?

Hi @luc.guyot ,

The action is expected to work on Windows too, here is a working example:

It uses windows-latest, which is based on Windows Server 2022. You can see its latest run from a few days ago at Workflow runs · sonarsource-cfamily-examples/windows-msbuild-vscoverage-gh-actions-sc · GitHub.

If you could provide a bit more context and help us understand your environment, we can see if there is something to be improved on our side.

Dear Massimo,

Thanks a lot for responding so promptly.

You are asking for details regarding my setup. Here there are:

  • I am using an Analysis of type CI for my C++/Objective C project (automatic analysis disabled from the SonarCloud web interface)
  • I am using a Github workflow run by a self-hosted Window 11 CI runner.
  • The Windows OS version is: Microsoft Windows [version 10.0.22631.4249].
  • The failure occurs with the Github action SonarSource/sonarcloud-github-c-cpp@v3. The syntax I am using is the syntax suggested in the SonarCloud web interface (Administration > Analyse Method > View Github Actions, " Analyze a project with a GitHub Action")
  • In a previous step, I installed the Windows Subsystem for Linux (WSL) on my Windows runner because the action failed: the action required the bash command to be installed.
  • Now that bash is installed on the Windows 11 runner, the error is different: the action fails, informing me that Running WSL as local system is not supported. (Is this message generated by Sonar’s code?)

Would you need something else that would help you help me?

Thanks in advance for your answer.

Best regards,
Luc

Hi @luc.guyot ,

by looking a the GitHub hosted runner image configuration and the run of our example we see that Git bash is used rather than the wsl bash. You can install Git for Windows and add the bash path at first.

1 Like

Hi @mpaladin,

Thanks a lot for the head ups.

Git for Windows and its bash command were already installed on my runner, but the Github actions couldn’t see it without the following addition to my Github workflow:

      - name: Load system Path into Github environment
        run : echo Path=%Path%>> %GITHUB_ENV%
        shell: cmd

Problem solved.

It was not related to SonarCloud scripts, just to my Github Actions setup and my environment variables. My apologies for this.

Your super useful advice has been extremely well appreciated!

Best regards,
Luc

1 Like