sonar-gitlab-plugin
sonar-gitlab-plugin copied to clipboard
Unable to update commit status - name has already been taken
Hi, We have been having an issue with sonar-gitlab-plugin on our SonarQube 6.7 instance and plugin 3.02. We since upgraded to SonarQube 7.6 CE, SonarGitlab plugin 4.1.0-SNAPSHOT but only found out about the issue, which is still present, so we suspect it comes down to GitLab version.
We also could not find any matching issue here, sorry if there's one and we missed it.
What happens, both in preview mode and in publish mode, is that "commit status update" fails with this error
1836 [ERROR] Unable to update commit status
1837 com.talanlabs.gitlab.api.v4.GitLabAPIException: {"message":{"name":["has already been taken"]}}
1838 at com.talanlabs.gitlab.api.v4.http.GitLabHTTPRequestor.handleAPIError(GitLabHTTPRequestor.java:378)
1839 at com.talanlabs.gitlab.api.v4.http.GitLabHTTPRequestor.to(GitLabHTTPRequestor.java:125)
1840 at com.talanlabs.gitlab.api.v4.http.GitLabHTTPRequestor.to(GitLabHTTPRequestor.java:95)
1841 at com.talanlabs.gitlab.api.v4.services.GitLabAPICommits.postCommitStatus(GitLabAPICommits.java:181)
...
1899 Caused by: java.io.IOException: Server returned HTTP response code: 400 for URL: https://<ourgitlab>/api/v4/projects/<id>/statuses/<sha>
is this the result of a misconfiguration, bad script, or is there something that changed in GitLab's API that is not reflected in the plugin?
Thanks in advance, Christophe
I haven't seen a maintainer here for a long time, so there's no guarantee to fix it, but only what I can say, that probably the codeline is here https://github.com/gabrie-allaigre/sonar-gitlab-plugin/blob/1a6b20737c0e034fed35f555442fa493c6268e9f/src/main/java/com/talanlabs/sonar/plugins/gitlab/GitLabApiV4Wrapper.java#L217
probably at config.refName()
which leads to https://github.com/gabrie-allaigre/sonar-gitlab-plugin/blob/1a6b20737c0e034fed35f555442fa493c6268e9f/src/main/java/com/talanlabs/sonar/plugins/gitlab/GitLabPlugin.java#L47
so check do you provide it properly, according to README. Anyway, you can try to debug this
@mig-visiblee does the proposed solution work ?
@mig-visiblee Did you fixed that error? I have exactly the same problem with :
- Gitlab 12.10.0
- Sonarqube 7.6
- SonarGitlab plugin 4.1.0-SNAPSHOT
@gabrie-allaigre Do you have any ideas?
Same here, I have exactly the same problem with :
-
Gitlab 12.9.3
-
Sonarqube 7.9.2
-
SonarGitlab plugin 4.1.0-SNAPSHOT from JavaMachr https://github.com/gabrie-allaigre/sonar-gitlab-plugin/pull/253
But it's doesn't block or throw error, it's only uglify my logs
@Limule When you click on the commit, do you see the report from Sonarqube?
I can see it but it doesn't create additional jobs to say if the code "passed" or "fail"
The external job below is missing :
@Dubouchj Yes I can see my report in commits. But externals jobs are irregular. They doesn't appear often. When they appear, they are "failed".
Maybe it's about sonar.gitlab.failure_notification_mode
.
@Limule Lucky you ! Maybe you need to change quota of your quality gate.
I set it to commit-status
...
Yep, but it doesn't stop the pipeline, so even with the quality gate failed, the deploy job behind will work. I think i should try exit-code
@Limule If you put "exit-code" your pipeline will stop everytime.
I found the issue
stages:
- test
somethingelse: #to solve it, I have replace *sonarqube* by " somethingelse "
stage: test
image: hidoraswiss/sonar-scanner
#when: manual #launch manualy
Thank you !