The latest update of the sonarqube scan action (v5.3.1) introduced a massive regression on which you as a developer don’t know how to quote the paths for source/test.
For example, if you have a source path containing spaces, what you would do (that works perfectly on shell) is -Dsonar.sources=”My path,Anotherpath”, with the change introduced in 5.3.1 this causes an error as it’s trying to look for the the path ‘My path,Anotherpath' and of course that does not exist.
A suggestion was given in the github PR to lose the quotes, which causes other issues as it’s trying to parse as something and fails with an error Unrecognized option: My Path,Anotherpath
I have put together a sample project using the old and new version of the action.
EDIT: quoting only the spaced path also causes the same error “unrecognized option”
Thank you for pointing this out, and I am glad that you have already found a workaround.
An alternative option, to avoid quoting issues, would be to add the property in the sonar-project.properties file. This is applicable in @kronenthaler’s case as well.
Sorry, this is not a solution in my case. I need it to be dynamic because a mono repo with multiple sonar projects, so the sonar.sources has to be dynamic to scope the right paths, and some paths have spaces. This dynamic paths are read from an env var already.
@rceluch-pg This issue doesn’t seem related to the one in the initial report.
Looking at the console output, the SONAR_TOKEN env var seems empty (not resolving to anything) thus generating a 401 error. Are you sure the token is defined in the secrets, under that name?
Ok. Maybe not the very same root cause as for OP, but for sure related to v5.3.1, as the very same setup works for us on v5.2.0 and v5.3.0. And yes, SONAR_TOKEN is there and it’s valid.
Looks like args are not well managed, as it works on v5.3.1 after commenting them:
Apologies for the inconveniences, we acknowledge the quotes regression and we are looking into this.
@rceluch-pg, I agree with @kronenthaler that this is another issue, but rather related to the token than to the arguments, as I could not reproduce it with a similar example here.
Please check if there is something else besides the commented-out args in your latest post that could have resolved the issue.
Hi Aleksandra,I don’t see -Dsonar.python.coverage.reportPaths or any path related attribute in your repro. Anyway, our issue must be related to the original issue with “quoting” because below works for us, when I just added single quotes for -Dsonar.python.coverage.reportPaths value: