sonar-gitlab-plugin icon indicating copy to clipboard operation
sonar-gitlab-plugin copied to clipboard

post-job 'GitLab Commit Issue Publisher' always fails

Open johlandabee opened this issue 6 years ago • 10 comments

I cannot get the plugin to work properly. The post-job will always fail and there are no artifacts generated. I've tried a few things and the configuration seems fine.

GitLab: 11.5.0 SonarQube: 7.4 (build 18908) gitlab-plugin: 4.0.0 (marketplace)

I'm using the .Net Core (MSBuild) analyzer: https://www.nuget.org/packages/dotnet-sonarscanner/

Error log (does not really reveal anything):

INFO: Executing post-job 'GitLab Commit Issue Publisher'
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 29.524s
INFO: Final Memory: 25M/443M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
ERROR: null
ERROR: 
The SonarQube Scanner did not complete successfully
15:05:36.58  Creating a summary markdown file...
15:05:36.583  Post-processing failed. Exit code: 1

.gitlab-ci.yml call (PowerShell):

dotnet sonarscanner begin
/k:"$env:SONAR_PROJECT_KEY"
/d:sonar.host.url="$env:SONAR_URL"
/d:sonar.login="$env:SONAR_AUTH_KEY"
/d:sonar.gitlab.project_id="$env:CI_PROJECT_PATH"
/d:sonar.gitlab.commit_sha="$env:CI_COMMIT_SHA"
/d:sonar.gitlab.ref_name="$env:CI_COMMIT_REF_NAME"
/d:sonar.gitlab.failure_notification_mode=commit-status
/d:sonar.gitlab.json_mode=CODECLIMATE
/d:sonar.analysis.mode=preview

johlandabee avatar Dec 04 '18 16:12 johlandabee

Having the same error on Gitlab 11.4.0-ee with plugin version

INFO: SonarQube Scanner 3.2.0.1227 INFO: Java 1.8.0_181 Oracle Corporation (64-bit) INFO: Linux 3.10.0-693.21.1.el7.x86_64 amd64 INFO: SONAR_SCANNER_OPTS=-XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -XX:MaxRAMFraction=1 -XshowSettings:vm INFO: User cache: /root/.sonar/cache INFO: SonarQube server 7.3.0

stipo42 avatar Dec 13 '18 15:12 stipo42

I believe you need to set failure_notification_mode to exit-code

byahia avatar Dec 13 '18 18:12 byahia

I'm running following command for my gitlab-sonarqube and getting Nullpointer exception.

./gradlew sonarqube -Dsonar.host.url=$SONAR_URL -Dsonar.analysis.mode=preview -Dsonar.login=$SONAR_TOKEN -Dsonar.gitlab.project_id=$CI_PROJECT_ID -Dsonar.gitlab.commit_sha=$CI_COMMIT_SHA -Dsonar.gitlab.ref_name=$CI_COMMIT_REF_NAME -Dsonar.gitlab.disable_proxy=true -Dsonar.gitlab.ignore_certificate=true -Dsonar.branch.name=$CI_COMMIT_REF_NAME -Dsonar.gitlab.failure_notification_mode=commit-status

Sonarqube - 7.5 GitLab - CI_SERVER_VERSION=11.7.3-ee sonar-gitlab-plugin-4.0.0

manasatest avatar Feb 03 '19 21:02 manasatest

@manasatest can you post the entire error message with stack trace?

byahia avatar Feb 04 '19 08:02 byahia

@BilelYahia Gitlab post-job commit issue publisher always fails with NullPointerException #215

I'm facing a different issues now. SonarQube failed to complete the review of this commit: Fail to request https://company.com/sonarqube/api/ce/task?id=XXXXXXXXXXXXXXX

manasatest avatar Feb 04 '19 18:02 manasatest

@BilelYahia I could able to resolve the issue. Thanks for checking!

manasatest avatar Feb 04 '19 20:02 manasatest

Would you mind explaining how you resolved it? I'm having the same error. :)

jaymehoward avatar Feb 04 '19 21:02 jaymehoward

@jaymehoward We are using a http://sonar.company.com:port/sonarqube instead of actual https://company.com/sonarqube. It was able to publish the analysis to sonarqube but wasn't able to get them for gitlab ui. I've had the Server base URL configuration on sonarqube to https which caused the issue. Remove the base url configuration from your sonarqube server settings Configuration -> General -> Server Base URL.

manasatest avatar Feb 04 '19 21:02 manasatest

I was facing a similar issue but it turned out to be just a permissions problem in the specific Gitlab repository being scanned. The "service account" sonarqube uses wasn't added to the repository / org i was trying to scan. After I added the account everything started working normally. Not sure if this is the case for others here but I thought I'd share this. Maybe it helps...

unitysipu avatar Feb 19 '19 11:02 unitysipu

An update on mine, it turns out its the same as the issue for @unitysipu Recently switched to a different gitlab instance, which didn't have credentials setup properly for the instance of sonarqube I was using. Perhaps better error messaging could be added to the plugin for such cases, if its even detectable, and possibly still generate the artifacts? (what is concerning is that the scan still completed for me, though there might be permission issues with my sonarqube instance, still unrelated to the plugin)

stipo42 avatar Feb 19 '19 12:02 stipo42