I am intermittently getting the below error in Jenkins. Nothing has been changed so far. Jenkins version 2.150.3 and Gitlab plugin version 1.5.11
20:31:01 Failed to update Gitlab commit status for project '10750': HTTP 400 Bad Request
Errors in jenkins server logs:
SEVERE: Failed to update Gitlab commit status for project '10750'
javax.ws.rs.BadRequestException: HTTP 400 Bad Request
at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.handleErrorStatus(ClientInvocation.java:197)
at org.jboss.resteasy.client.jaxrs.internal.proxy.extractors.DefaultEntityExtractorFactory$3.extractEntity(DefaultEn
tityExtractorFactory.java:50)
at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientInvoker.invoke(ClientInvoker.java:104)
at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientProxy.invoke(ClientProxy.java:64)
at com.dabsquared.gitlabjenkins.gitlab.api.impl.$Proxy152.changeBuildStatus(Unknown Source)
at com.dabsquared.gitlabjenkins.gitlab.api.impl.ResteasyGitLabClient.changeBuildStatus(ResteasyGitLabClient.java:60)
at com.dabsquared.gitlabjenkins.gitlab.api.impl.AutodetectingGitLabClient$7.execute(AutodetectingGitLabClient.java:1
12)
at com.dabsquared.gitlabjenkins.gitlab.api.impl.AutodetectingGitLabClient$7.execute(AutodetectingGitLabClient.java:1
09)
at com.dabsquared.gitlabjenkins.gitlab.api.impl.AutodetectingGitLabClient$GitLabOperation.execute(AutodetectingGitLa
bClient.java:335)
at com.dabsquared.gitlabjenkins.gitlab.api.impl.AutodetectingGitLabClient$GitLabOperation.access$100(AutodetectingGi
tLabClient.java:332)
at com.dabsquared.gitlabjenkins.gitlab.api.impl.AutodetectingGitLabClient.execute(AutodetectingGitLabClient.java:328
)
After investigating this issue I came across this:
Commit status create (API): Can no longer use links under NAT with 'target_url'
In our organization error occurs since Gitlab Community Edition has been updated to 11.11.8
Status: 400 Bad Request
Response body: {
"message" : {
"target_url" : [ "is blocked: Host cannot be resolved or invalid" ]
}
}
@devops What version of Gitlab are you using? Can you provide response body from Jenkins logs?
See if comments of jenkinsci/gitlab-plugin issue 522 could help:
Just for others who may stumble on this.
My issue is that I was trying to describe gitLabBuilds before my main project SCM checkout, and then update them afterwards.
This had the weird side-effect of creating GitLab Pipeline jobs for the repo which contains my Jenkinsfile (not the same repo as my main one), and so the attempts to update the status of the wrong repo may well have caused this error.Took me a minute to relaise gitlabBuilds and gitlabCommitStatus update the last repo checked out, and if the ordering is wrong, it'll try to update the Jenkinsfile repo instead.
I believe this also occurs if you're re-running a build (either resending the hook manually, or rebuilding) to a merge request that has already been merged/closed. Seems like you can't update the status of merged PRs, which makes sense. Possible to add some informational messages for that scenario?
The
BadRequestException: HTTP 400 Bad Request
is always thrown when we use a shared library in a pipeline as explained here.
Obviously Jenkins clones two repositories to build any project: (1) shared library, and (2) project repository.
Aslo jenkinsci/gitlab-plugin
issue 885
We've seen this error as well.
In our case it was due to the Jenkins web hook being registered twice for the Merge Request events in the GitLab project settings.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With