Gitlab Jenkins Webhook 执行成功但返回 HTTP 403(需要身份验证)

Gitlab Jenkins Webhook executed successfully but returned HTTP 403 (Authentication required)

我的 WebHook 成功了,但 jenkins 没有构建项目。

我检查了 gitLab 日志,其中 weebhook 收到了来自 jenkins 的 200 响应

Status 200 WebHook

首先检查这是否类似于 jenkinsci/gitlab-plugin/issue 375:

You can either add a special user in Jenkins for this and configure the Webhook in GitLab accordingly or you can uncheck the checkbox "Enable authentication for '/project' end-point" in the GitLab section of the global Jenkins configuration. But this should be unchecked by default.

更好,来自 Jun Young Lee

You can set Secret Token as well and I think this method is better than two other options since no credential exposed or no too open policy.


OP Alejandro Herrera adds in

I am using LDAP for authentication so it doesn't work with the token.

But I already fixed it: I simply added the authentication parameters in the url like this: https://USERNAME:PASSWORD@Serverjenkins.com/github-webhook