- ALM used: GitHub
- CI system used: GitHub actions
- Languages of the repository: English
- SonarCloud the URL: SonarCloud
Hello,
I am trying to run sonar analysis on our project.
I am using GitHub actions to run CI and try to run sonar via this.
Command I am using:
mvn package -DskipTests org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=EmbedITCZ_jbehave-support -Dsonar.organization=embeditcz -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=${{ secrets.SONAR_TOKEN }} -Dsonar.coverage.jacoco.xmlReportPaths=/home/runner/work/jbehave-support/jbehave-support/jacoco/jacoco.xml,/home/runner/work/jbehave-support/jbehave-support/jacoco-it/jacoco.xml
Our CI first build project, run unit and integration tests then run sonar (without clearing project as I am donwloading jacoco results from previous steps).
As SONAR_TOKEN we have token generated on sonarcloud by our organization owner. (defined in master project secrets, in my fork I have my own token from sonar_cloud).
As GITHUB_TOKEN we use default one.
You can see pipeline in PR (it is the first attemps to set up pipeline) and branch originated in my fork not in master.
Maven run in pipeline fails with error:
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar (default-cli) on project jbehave-support: You’re not authorized to run analysis. Please contact the project administrator. → [Help 1]
Last successful lines are:
[INFO] Analysis report generated in 127ms, dir size=345 KB
[INFO] Analysis report compressed in 164ms, zip size=212 KB
Can you please help me with setup? I have no idea what I’m doing wrong.
edit:
Branch analysis si completed: https://sonarcloud.io/dashboard?branch=sonar5&id=EmbedITCZ_jbehave-support
but build still fails.
edit:
Here is a part of debug log:
[INFO] 08:27:32.041 Analysis report compressed in 189ms, zip size=212 KB
[INFO] 08:27:32.041 Analysis report generated in /home/runner/work/jbehave-support/jbehave-support/target/sonar/scanner-report
[DEBUG] 08:27:32.042 Upload report
[DEBUG] 08:27:32.589 POST 403 https://sonarcloud.io/api/ce/submit?organization=embeditcz&projectKey=EmbedITCZ_jbehave-support&projectName=jbehave-support&characteristic=pullRequest%3D272 | time=547ms
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for jbehave-support 1.0.10-SNAPSHOT:
[INFO]
[INFO] jbehave-support-core-test … SUCCESS [ 0.008 s]
[INFO] jbehave-support-core-test-oxm … SUCCESS [ 6.384 s]
[INFO] jbehave-support-core-test-app-domain … SUCCESS [ 3.584 s]
[INFO] jbehave-support-core-test-app … SUCCESS [ 4.660 s]
[INFO] jbehave-support … FAILURE [01:11 min]
[INFO] jbehave-support-core … SUCCESS [ 16.536 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:44 min
[INFO] Finished at: 2020-01-23T08:27:32Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar (default-cli) on project jbehave-support: You’re not authorized to run analysis. Please contact the project administrator. → [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar (default-cli) on project jbehave-support: You’re not authorized to run analysis. Please contact the project administrator.
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)