cathive / concourse-sonarqube-resource

performs SonarQube analyses and checks quality gates https://concourse-ci.org/ https://sonarqube.org/
Apache License 2.0
46 stars 50 forks source link

When __debug flag is enabled, reading task report fails. #61

Closed xsorifc28 closed 3 years ago

xsorifc28 commented 4 years ago

I am trying to perform a PR analysis. Code coverage information is missing in PR analysis when run through concourse. If I run locally, the code coverage information is there.

I went to debug, but when I enable __debug flag I get:

[INFO] ------------------------------------------------------------------------/sonar/report-task.txt ]]
+ echo 'error: SonarQube report could not be located.'
error: SonarQube report could not be located.
+ exit 1

If I turn off the debug flag, the put step passes. Reading SonarQube scanner report (/tmp/build/put/build/target/sonar/report-task.txt)...

headcr4sh commented 4 years ago

Thanks for the bug report. Probably, the bash +x flag causes this issue. I assume it might lead to unexpected output on stdout when calling bash functions, but I am not sure....

xsorifc28 commented 4 years ago

Any insight into why the coverage would be not working for PR analysis or branch analysis?

headcr4sh commented 4 years ago

Not (yet). I haven't had the time to look into this issue and probably won't find the time during the next few days, either. :-(

(This is an unpaid side-project, so my resources are a bit limited,... :-()

I can only guess, that +x messes up stuff that goes to stdout when calling bash functions. But that's just a theory for now....

Etone commented 4 years ago

As I had the same Issue just now, i might help. The Problem seems to be, that maven prints out the BUILD SUCCESS Info even with the -q flag in debug mode. This leads to a corrupted path that is not present and therefore reading the report fails.

Path with debug enabled

/tmp/build/put/build-artifacts/target
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  12.703 s
[INFO] Finished at: 2020-06-25T07:13:45Z
[INFO] ------------------------------------------------------------------------/sonar/report-task.txt

As it looks, this looks to be from the +x flag

xsorifc28 commented 4 years ago

Ah..so it thinks the path is [INFO] ------------------------------------------------------------------------/sonar/report-task.txt?

headcr4sh commented 3 years ago

Hopefully this issue has been fixed by #62