GitHub Action sonarsource/sonarcloud-github-action stopped working

Over night, the sonarsource/sonarcloud-github-action stopped working. It immediately fails with the error:

/entrypoint.sh: line 24: sonar-scanner: command not found

Unfortunately, I do not have two builds of the same commit, since I simply re-run the workflow on GitHub. But I have a workflow run of the PR before and one after the merge, which should be identical code-wise:

Workflow of PR: https://github.com/php-mqtt/client/runs/1643821787?check_suite_focus=true
Workflow after merge (re-run just now): https://github.com/php-mqtt/client/runs/1661419154?check_suite_focus=true

(Hint: only the PHP 8.0 on Mosquitto job uses the SonarCloud action)

The virtual environment in which the workflows were executed is identical, according to GitHub. I also tried pinning the sonarsource/sonarcloud-github-action at version v1.4, without luck.

Any help is greatly appreciated!

Hello @Namoshek, welcome to our Community!

It seems related to a recent change in setup-php action, which introduced a PATH overriding and because of that SonarCloud action fails to find the scanner. You can see at the failing action the big PATH environment introduced.

I would suggest you to try a previous version of setup-php: 2.8.0 (it is from from November 2020, so not that old) to check if it works. Other alternative is to include these in the PATH env for the action: /opt/sonar-scanner and /opt/nodejs.

Hi, both didn’t work.

echo “/opt/sonar-scanner” >> $GITHUB_PATH
echo “/opt/nodejs” >> $GITHUB_PATH

echo “/opt/sonar-scanner/bin” >> $GITHUB_PATH
echo “/opt/nodejs/bin” >> $GITHUB_PATH

Hi, did you faced the same issue as @Namoshek? did you check the logs and the PATH value if is correctly configured? Could you share the logs with us, please?

Hi Alexandre,

thank you for the quick reply! I think your analysis is on point and I’ve tried to run shivammathur/setup-php@2.8.0 to resolve the issue, but unfortunately with some different issue instead (pcov coverage driver not found anymore). I’ll dive into this a bit more right now and let you know when I find a satisfying solution.

aradhell has opened an issue for the shivammathur/setup-php action as well, since it introduced the problematic change: https://github.com/shivammathur/setup-php/issues/390

Edit: it seems shivammathur accepted it as their bug and is working on a fix. Let’s wait and see. :slight_smile:

Edit 2: the issue has been fixed by shivammathur and it works again.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.