Analysis results are not downloaded

Template for a good new topic, formatted with Markdown:

  • ALM used: GitHub
  • AWS CodePipeline (CodeBuild)
  • Scanner command: sonar-scanner -Dsonar.organization=$Organization -Dsonar.projectKey=$Project -Dsonar.sources=. -Dsonar.host.url=$HOST -Dsonar.branch.name=$Branch
  • Languages of the repository: Python
  • Error observed: During the “Test” stage I built on my CodePipeline AWS Service, I’m getting “Project doesn’t exist” while trying to curl the analysis report
[Container] 2023/01/13 21:32:12 Running command curl ***/api/qualitygates/project_status?projectKey=*** >result.json
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100    49  100    49    0     0    117      0 --:--:-- --:--:-- --:--:--   117

[Container] 2023/01/13 21:32:12 Running command cat result.json
978 {"errors":[{"msg":"Project doesn\u0027t exist"}]}
979 [Container] 2023/01/13 21:32:12 Running command echo $CODEBUILD_BUILD_SUCCEEDING
980 1
981
982 [Container] 2023/01/13 21:32:12 Running command if [ $(jq -r '.projectStatus.status' result.json) = ERROR ] ; then $CODEBUILD_BUILD_SUCCEEDING -eq 0 ;fi
  • Steps to reproduce:

While I try to retrieve the report in json format that is given from SonarCloud in order to make my stage pass or fail, I’m able to connect to the server but not able to retrieve the proper information.

This is the URL where I’m trying to retrieve my results:
https://sonarcloud.io/api/qualitygates/project_status?projectKey=trip_ninja_api

  • Potential workaround

Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!

Hey there.

Are you providing authentication to the curl request (using a user token)?

Hi,

I get a “project doesn’t exist” error message from your URL. I take that to mean your project is private. Which means that you’ll need to authenticate your curl call.

That said, you probably want to use a webhook instead.

 
HTH,
Ann

Hey Colin, good day.

Actually, I was missing the GitHub token on the authentication method to get the JSON respond.

That part is working now, but do you think you can guide me on how to setup my build script for custom PR decorations?

Right now, I’m using the script that is attached to the email, but whenever I get a new PR, I want to scan only the new lines that are going to be added to the code, but somehow it scans more lines.

Do you think you can help me with that?

Thanks!

image001.png

(Attachment build-script.yaml is missing)

Hey there.

It looks like your attachment is missing and I’m not sure what you mean by “custom PR decorations”.

How can you tell that it scans more lines?