Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to update commit status - name has already been taken #274

Open
mig-visiblee opened this issue Mar 2, 2020 · 11 comments
Open

Unable to update commit status - name has already been taken #274

mig-visiblee opened this issue Mar 2, 2020 · 11 comments

Comments

@mig-visiblee
Copy link

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

@kortov
Copy link

kortov commented Mar 2, 2020

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

.postCommitStatus(gitLabProject.getId(), getFirstCommitSHA(), status, config.refName(), COMMIT_CONTEXT, null, statusDescription);

probably at config.refName() which leads to

public static final String GITLAB_REF_NAME = "sonar.gitlab.ref_name";

so check do you provide it properly, according to README. Anyway, you can try to debug this

@centerboy88
Copy link

@mig-visiblee does the proposed solution work ?

@Dubouchj
Copy link

Dubouchj commented May 5, 2020

@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?

@Limule
Copy link

Limule commented May 5, 2020

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

@Dubouchj
Copy link

Dubouchj commented May 6, 2020

@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 :
image

@Limule
Copy link

Limule commented May 6, 2020

@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.

@Dubouchj
Copy link

Dubouchj commented May 6, 2020

@Limule Lucky you ! Maybe you need to change quota of your quality gate.

I set it to commit-status ...

@Limule
Copy link

Limule commented May 6, 2020

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

@Dubouchj
Copy link

Dubouchj commented May 7, 2020

@Limule If you put "exit-code" your pipeline will stop everytime.

@Dubouchj
Copy link

Dubouchj commented May 8, 2020

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

@Limule
Copy link

Limule commented May 8, 2020

Thank you !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants