gabrie-allaigre / sonar-gitlab-plugin

Add to each commit GitLab in a global commentary on the new anomalies added by this commit and add comment lines of modified files
GNU Lesser General Public License v3.0
713 stars 208 forks source link

org.sonarqube.ws.client.HttpException: Error 401 #277

Open ichasco opened 4 years ago

ichasco commented 4 years ago

Hi I am getting the next error: Caused by: org.sonarqube.ws.client.HttpException: Error 401 on https:

I have add a gitlab token with administrator permissions.

Gitlab: GitLab Community Edition 12.9.2 SonarQube version: 8.2 Plugins:

GitLab: 4.1.0-SNAPSHOT
Community Branch Plugin: 1.4.0-SNAPSHOT

Gitlab-ci.yml

code_quality:
  stage: code_quality
  image:
    name: sonarsource/sonar-scanner-cli:latest
    entrypoint: [""]
  variables:
    GIT_DEPTH: 0
  script:
    - sonar-scanner -X
      -Dsonar.qualitygate.wait=true
      -Dsonar.projectKey=$CI_PROJECT_ID
      -Dsonar.projectName=$CI_PROJECT_TITLE
      -Dsonar.branch.name=$CI_COMMIT_REF_NAME
      -Dsonar.projectVersion=$CI_COMMIT_TAG
      -Dsonar.sourceEncoding=UTF-8
      -Dsonar.sources=/
      -Dsonar.links.ci=$CI_PROJECT_URL
      -Dsonar.links.homepage=${CI_PROJECT_URL}/pipelines
      -Dsonar.gitlab.commit_sha=$CI_COMMIT_SHA
      -Dsonar.gitlab.ref_name=$CI_COMMIT_REF_NAME
      -Dsonar.gitlab.project_id=$CI_PROJECT_PATH
  allow_failure: true
  only:
    - master

Error log:

18:13:30.411 DEBUG: Post-jobs : GitLab Commit Issue Publisher
2673 18:13:30.415 INFO: Executing post-job 'GitLab Commit Issue Publisher'
2674 18:13:32.471 DEBUG: getPatchPositionsToLineMapping {6e1cf1a0ccfb4a091ac1da3898bab6fddb8d84a7={.gitlab-ci.yml=[Line{number=32, content='      -Dsonar.gitlab.project_id=$CI_PROJECT_PATH'}]}}
2675 18:13:32.868 INFO: ------------------------------------------------------------------------
2676 18:13:32.868 INFO: EXECUTION FAILURE
2677 18:13:32.868 INFO: ------------------------------------------------------------------------
2678 18:13:32.868 INFO: Total time: 1:04.310s
2679 18:13:32.945 ERROR: Error during SonarScanner execution
2680 SonarQube failed to complete the review of this commit: Error 401 on https://sonar.example.com/api/ce/task?id=AXFV2NHW8AsmU0XD-O5P : 
2681 Caused by: org.sonarqube.ws.client.HttpException: Error 401 on https://sonar.example.com/api/ce/task?id=AXFV2NHW8AsmU0XD-O5P : 
2682    at org.sonarqube.ws.client.BaseResponse.failIfNotSuccessful(BaseResponse.java:36)
2683    at org.sonarqube.ws.client.BaseService.call(BaseService.java:52)
2684    at org.sonarqube.ws.client.BaseService.call(BaseService.java:47)
2685    at org.sonarqube.ws.client.ce.CeService.task(CeService.java:156)
2686    at com.talanlabs.sonar.plugins.gitlab.SonarFacade.getTask(SonarFacade.java:165)
2687    at com.talanlabs.sonar.plugins.gitlab.SonarFacade.getAnalysisId(SonarFacade.java:135)
2688    at com.talanlabs.sonar.plugins.gitlab.SonarFacade.loadQualityGate(SonarFacade.java:98)
2689    at com.talanlabs.sonar.plugins.gitlab.CommitPublishPostJob.execute(CommitPublishPostJob.java:93)
2690    at org.sonar.scanner.postjob.PostJobWrapper.execute(PostJobWrapper.java:49)
2691    at org.sonar.scanner.postjob.PostJobsExecutor.execute(PostJobsExecutor.java:48)
2692    at org.sonar.scanner.postjob.PostJobsExecutor.execute(PostJobsExecutor.java:39)
2693    at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:366)
2694    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
2695    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
2696    at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:141)
2697    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
2698    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
2699    at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
2700    at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
2701    at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
2702    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2703    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
2704    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
2705    at java.base/java.lang.reflect.Method.invoke(Unknown Source)
2706    at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
2707    at com.sun.proxy.$Proxy0.execute(Unknown Source)
2708    at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
2709    at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
2710    at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
2711    at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
2712    at org.sonarsource.scanner.cli.Main.main(Main.java:61)
kortov commented 4 years ago

I doubt that this plugin works with Sonar 8.2. Even this PR works with 7.9 #253

ichasco commented 4 years ago

I have tried that patch of plugin but it stills not working.