问题
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.
回答1:
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.
来源:https://stackoverflow.com/questions/54672300/how-to-connect-jenkins-and-gieta