如何连接 Jenkins 和 Gieta [英] How to connect Jenkins and Gieta

查看:36
本文介绍了如何连接 Jenkins 和 Gieta的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I have the problem, that I want to establish a CI/CD Pipeline between my Gitea Repo and Jenkins. So far I created a webhook with the Gitea API to Jenkins. Unfortunatly, when I try to send test packages from Gitea to Jenkins, I get the x509 Error, saying that the Certificates are not valid

Delivery: Post https://*************/jenkins: x509: certificate is valid for xxxxxxxxxxxxx, not yyyyyyyyyyyyyyyy

On the other Hand I cant add my gitea Server in the Jenkins web UI. If I try to do so, I receive an error saying that The connection cannot be established because:

Could not communicate with server: HTTP 403/Forbidden

I am quite desperate by now. I already tried to add Certs to the machine Jenkins is running on, to eliminate the x509 error, but it didnt help. Also if I try to add instead of my server the official try.gitea.io Server, it actually works. But I nedd my server in the config, so it´s not optional to use the official one.

Thanks in advance.

解决方案

I use Jenkins Version 2.190.2 runnin in Docker container with Gitea Plugin Version 1.1.2.

I see the same problem with the message

Could not communicate with server: HTTP 403/Forbidden

in

Jenkins > Manage Jenkins > Configure System > Gitea Servers

when I set the Server URL to a Gitea server with the https protocol (e.g. Server URL: https://gitea.mycompany.com and Name: mycompany_gitea)

I have tried to add the certificate of gitea.company.com to the trusted certificates of the Jenkins JVM by means of the keytool, but no success (consider the ssl certificate of gitea.company.com is a globally trusted certificate and not a locally generated or private certificate).

In the end I tried to add new Gitea Organization Folder by

Jenkins > New Item > Gitea Organization (with name e.g. mycompany)

despite the problem message.

I configured the new Gitea Organization project under 'Gitea Organization' with following values:

  • Server: mycompany_gitea
  • Credentials: (Jenkins credential of a Gitea user with access to all Gitea/git repositories)
  • Owner: (Gitea organisation/user name)

and... Ta-dah! It works! I can without any problems Scan the Gitea Organization now.

Thus it seems the message

Could not communicate with server: HTTP 403/Forbidden

is a kind of "false positive" and can be ignored...


Considering the message

Delivery: Post https://*************/jenkins: x509: certificate is valid for xxxxxxxxxxxxx, not yyyyyyyyyyyyyyyy

I had the same error by the integration with Jenkins. The problem was that Gitea does not support the "certificate discovery" feature (as for example a browser like Firefox does, see) and Jenkins was misconfigured and was sending only the end entity certificate.

After making Jenkins to send the entire certificate chain, the problem disappeared.

这篇关于如何连接 Jenkins 和 Gieta的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆