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

Gitlab runner hangs on execute project builders #153

Open CaptainChemist opened 6 years ago

CaptainChemist commented 6 years ago

I can get sonarqube to work with the default sonar-runner command but when I start to add the gitlab variables, my runner hangs for 10 minutes on the Execute project builders step. I am running version 7.0 build 36138 of sonar and version 3.0.0 of the gitlab plugin (the latest available in the marketplace). Here is my sonar-project.properties file.

sonar.projectKey=mykey
sonar.host.url=http://34.230.xx.xx
sonar.login=myLogin
sonar.sourceEncoding=UTF-8

sonar.modules=backend,frontend

backend.sonar.sources=.
frontend.sonar.sources=.
backend.sonar.exclusions=src/flow-typed/**/*
sonar.projectName=mytitle
sonar.gitlab.commit_sha=$CI_COMMIT_SHA
sonar.gitlab.ref_name=$CI_COMMIT_REF_NAME
sonar.gitlab.project_id=$CI_PROJECT_PATH
sonar.analysisMode=preview

The error I get is:

ERROR: Error during SonarQube Scanner execution
ERROR: Failed to execute project builder: com.talanlabs.sonar.plugins.gitlab.CommitProjectBuilder
ERROR: Caused by: Unable to perform GitLab WS operation
ERROR: Caused by: GitLab is not responding
ERROR: Caused by: Server returned HTTP response code: 502 for URL: https://gitlab.com/api/v4/projects?archived=false&membership=false&order_by=created_at&owned=false&page=164&per_page=20&simple=false&sort=desc&starred=false&statistics=false&with_custom_attributes=false&with_issues_enabled=false&with_merge_requests_enabled=false

What's interesting, is that if I curl that web address from the runner's terminal, it works fine. (Don't really know what I'm getting but at least it isn't a 502) In sonar, for the project under gitlab I have set the project Id to match the output when I echo CI_PROJECT_PATH. In the gitlab general tab in sonar, I set the url and the user token.

gabrie-allaigre commented 6 years ago

Hi, Change sonar.gitlab.project_id=$CI_PROJECT_PATH by sonar.gitlab.project_id=$CI_PROJECT_ID

Other method is very slow, in your example page=164 !!