Analysis on python code in AWS CodeBuild

Hi,

We are using AWS CodeBuild as CI tool, and we want to show our build reports in sonarcloud.

what is the process for integrating CodeBuild with sonar cloud ? please give us steps or documentation which we need to follow.

Thanks,
Santosh.

Hi Santosh,

What SonarScanner do you usually use with your project?
You will just have to run it as usual in the CI, configuring using the yml configuration file for that CI tool. We don’t have specific documentation about this integration.
Here is an example with Scanner for Maven:

1 Like

I got solution to get it, I got report through sonarqube. but when I am running using sonar cloud account, its saying ERROR: You’re not authorized to run analysis. Please contact the project administrator. but I have created key in sonarcloud and using it

Make sure that the account on sonarcloud has the required permissions to analyze the project. Also, double check if you set the property sonar.host.url to point to SonarCloud.
If you still have problems, please post the scanner logs (with debug enabled) so that we can have a look.

1 Like

SonarResult.txt (228.9 KB)

I am passing below properties in sonar-project.properties file and executing below command in CodeBuild.
command: - sonar-scanner
and using below commands to install SonarScanner in container:

properties section:

sonar.projectKey=SDC-Sonar
sonar.projectName=SDC-vulcan-Sonar
sonar.projectVersion=1.0
sonar.sources=.
sonar.sourceEncoding=UTF-8
sonar.host.url=https://sonarcloud.io
sonar.login=I have passed secret key here(and I have all admin access on account)
#sonar.sourceEncoding=UTF-8

and getting issues, attached log file , please check

Thanks for all the information.
From the logs it looks like there is a problem with permissions.
The user for which you passed the token has permissions to browse and access information about the project (hence not failing at the beginning of the analysis) but is apparently lacking permissions to upload the analysis results. When you say it has admin access, is it in the organization or for that specific project? Please check at both levels.

Also note the warning, in the logs, about the shallow clone. You will miss a couple of features due to this.

15%20PM

I have admin access on both Organisation and project.
please check attached image to check admin access.

any update on this?

Hi,

You should add the missing property sonar.organization to your scanner configuration. Value is displayed on the project dashboard, in the right panel.

Regards