Hello everyone!
I’m Roberta and I’m new to the community!
I’m a DevOps engineer and thank you in advance for the help you will give me!
Today I tried to create the SonarQube - GitLab integration but to no avail.
Here’s some information about the environment I’m working on.
SonarQube | GitLab |
---|---|
Community Edition v10.5.1 | Community Edition v16.11.0 |
self-hosted | self-hosted |
Docker | Docker |
https://sonarqube.xxx.xxx.com/ |
https://gitlab.xxx.xxx.io/ |
I created an account on GitLab that I’m going to use for SonarQube and I followed the guide shown here.
After all i received the error:
Could not validate GitLab url. Got an unexpected answer.
My Server Web logs contains the following:
2024.05.03 15:17:51 DEBUG web[][o.s.a.c.g.GitlabApplicationClient] get projects : [https://gitlab.xxx.xxx.io/api/v4/projects]
2024.05.03 15:17:51 INFO web[][o.s.a.c.g.GitlabApplicationClient] Gitlab API call to [https://gitlab.xxx.xxx.io/api/v4/projects] failed with error message : [Unexpected response code for CONNECT: 500]
java.io.IOException: Unexpected response code for CONNECT: 500
at okhttp3.internal.connection.RealConnection.createTunnel(RealConnection.kt:483)
at okhttp3.internal.connection.RealConnection.connectTunnel(RealConnection.kt:262)
at okhttp3.internal.connection.RealConnection.connect(RealConnection.kt:201)
at okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.kt:226)
at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.kt:106)
at okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.kt:74)
at okhttp3.internal.connection.RealCall.initExchange$okhttp(RealCall.kt:255)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:32)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:95)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
at okhttp3.internal.connection.RealCall.execute(RealCall.kt:154)
at org.sonar.alm.client.gitlab.GitlabApplicationClient.checkProjectAccess(GitlabApplicationClient.java:103)
at org.sonar.alm.client.gitlab.GitlabApplicationClient.checkUrl(GitlabApplicationClient.java:86)
at org.sonar.alm.client.gitlab.GitlabGlobalSettingsValidator.validate(GitlabGlobalSettingsValidator.java:53)
at org.sonar.alm.client.gitlab.GitlabGlobalSettingsValidator.validate(GitlabGlobalSettingsValidator.java:46)
at org.sonar.server.monitoring.devops.GitlabMetricsTask.validateGitlab(GitlabMetricsTask.java:58)
at org.sonar.server.monitoring.devops.GitlabMetricsTask.run(GitlabMetricsTask.java:51)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.runAndReset(Unknown Source)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Finally, from inside my sonarqube container I executed
curl --header "PRIVATE-TOKEN: $mytoken" "https://gitlab.xxx.xxx.io/api/v4/projects"
and I received the correct JSON.
The only thing that came to mind is that the format of my GitLab’s URL could be a problem, because by trying with
https://gitlab.io/api/v4
I don’t get the previous error, but:
Request was redirected, please provide the correct URL
https://gitlab.com/api/v4
I don’t get the previous error, but:
Invalid personal access token
Can you help me, please?