Template for a good new topic, formatted with Markdown:
ALM used (GitHub, Bitbucket Cloud, Azure DevOps)
CI system used - github action
Scanner command used when applicable (private details masked)
Languages of the repository
Only if the SonarCloud project is public, the URL
And if you need help with pull request decoration, then the URL to the PR too
Error observed (wrap logs/code around with triple quotes ``` for proper formatting)
/home/runner/work/_temp/b182405e-fe35-4d9c-aa9a-feb2f4a243a3.sh: line 2: -Dsonar.pullrequest.branch=feat/<branch_name>: No such file or directory
[482](https://github.com/<org_name>/<repo_name>/actions/runs/12257616714/job/34250403096#step:5:490)Error: Process completed with exit code 127.
Steps to reproduce:
We have github action workflow configured which uses following:
- name: Push result to SonarCloud server
uses: sonarsource/sonarcloud-github-action@master
with:
args: |
-Dsonar.pullrequest.key=${{ github.event.pull_request.number }}
-Dsonar.pullrequest.branch=${{ github.head_ref }}
-Dsonar.pullrequest.base=${{ github.base_ref }}
env:
GITHUB_TOKEN: ${{ secrets.SVC_DOT_BOT_GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_CLOUD_TOKEN }}
With the above configurations things were working fine until week before but now workflows are failing with the above mentioned error.
Potential workaround
As a workaround I switched to uses: sonarsource/sonarcloud-github-action@v3.1.0 and now pipeline is working as expected. Can you please help me troubleshot the issue. I even tried using uses: sonarsource/sonarqube-scan-action@master but still pipeline fails with the above error.
Do not share screenshots of logs β share the text itself (bonus points for being well-formatted)!
I have just run another test, and >- (stripping all newlines, including the last one) also works.
See here for further info.
What is important is to resolve all options on a single line.
With the above configurations things were working fine until week before but now workflows are failing with the above mentioned error.
It would help to have logs for one of your failed runs and one of your successful runs on v3.1.0, in particular where the Sonar Scanner CLI is called. Something like the following:
My hypothesis is that v3.1.0 (the Docker-based version of the GitHub action) flattened parameters to a single line, when specified as a multiline string, whereas v4.0.0 does not.
Though the warning is there which I suppose should go with using sonarqube-scan-action@v4.1.0. I think its better to use specific version instead of using master.
Run echo β::warning title=SonarScanner::This action is deprecated and will be removed in a future release. Please use the sonarqube-scan-action action instead. The sonarqube-scan-action is a drop-in replacement for this action.β
30Warning: This action is deprecated and will be removed in a future release. Please use the sonarqube-scan-action action instead. The sonarqube-scan-action is a drop-in replacement for this action.
Yes, the warning should disappear as soon as you switch to sonarqube-scan-action@v4.1.0.
The change from sonarcloud-github-action@v4.0.0 to sonarqube-scan-action@v4.1.0 should be painless, since sonarcloud-github-action@v4.0.0 just forwards to sonarqube-scan-action@v4.1.0.
So I encourage you to try sonarqube-scan-action out, and open a new issue in the community if you encounter any problem.
I agree itβs better to use a fix version, rather than master, to avoid breaking main pipelines when an issue arises.