简体   繁体   English

Jenkins全球管道配置 - GitHub帐户问题

[英]Jenkins Global Pipeline Configuration - GitHub account issue

I have been trying to configure Global Pipeline libraries in Jenkins using GitHub repo, but encountered an issue "invalid account" even though GitHub credentials are correct. 我一直在尝试使用GitHub repo在Jenkins中配置Global Pipeline库,但遇到问题“无效帐户”,即使GitHub凭据是正确的。
Detailed description: 详细说明:

  1. GitHub API endpoint is URL: https://github.mycompanydomain/api/v3 GitHub API端点是URL: https://github.mycompanydomain/api/v3
  2. I have provided Library details with Name, Default version and selected Modern SCM 我已经使用名称,默认版本和选定的现代SCM提供了库详细信息
  3. In Modern SCM, I have selected GitHub, I am able to select API end point from dropdown but when I selected "Credentials" (I have configured this in credentials option in Jenkins with username and password which I have been used to connect gitHub), it is giving "invalid credentials". 在Modern SCM中,我选择了GitHub,我可以从下拉列表中选择API端点,但是当我选择“Credentials”时(我在Jenkins中使用用户名和密码配置了这个凭据选项,我用它来连接gitHub),它提供“无效凭据”。

Please find below error code image for reference. 请在下面找到错误代码图片以供参考。

在此输入图像描述

Please help, 请帮忙,

Regards, Srikanth 此致,Srikanth

For an https URL (using a username/password type of credential), do check if the password includes any special character. 对于https URL(使用用户名/密码类型的凭证),请检查密码是否包含任何特殊字符。

If it does, you might need to percent encode them . 如果是,您可能需要对它们进行百分比编码

The other possibility is if your account has 2FA (two factor authentication) activated. 另一种可能性是您的帐户激活了2FA(双因素身份验证)
If it does, the password should be a PTA (Personnal Token Access) , not your actual account password. 如果是,则密码应为PTA(Personnal Token Access) ,而不是您的实际帐户密码。

Third possibility (from the chat): there is a proxy. 第三种可能性(来自聊天):有一个代理。

So: 所以:

  • either the client and GHE (GitHub Enterprise) are on the same LAN and Git, incorrectly, tries to go through the proxy while it shouldn't: a NO_PROXY is necessary. 客户端和GHE(GitHub企业版)在同一个局域网上,Git错误地尝试通过代理,而不应该:代理NO_PROXY。
  • or GHE is accessible only through the proxy, and neither Git or Jenkins are aware of the proxy (HTTP_PROXY/HTTPS_PROXY environment variable should be set) 或GHE只能通过代理访问,Git或Jenkins都不知道代理(应设置HTTP_PROXY / HTTPS_PROXY环境变量)

Details: 细节:

  1. Verified System log : [JenkinsURL]/log/all then log shows the error: 验证系统日志: [JenkinsURL] / log / all然后日志显示错误:

 Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target 

  1. Initially imported certificate from GitHub Enterprise to \\jre\\lib\\security\\cacerts but Jenkins by default referring to jre which ships with installer. 最初从GitHub Enterprise导入证书到\\ jre \\ lib \\ security \\ cacerts,但Jenkins默认引用安装程序附带的jre。 So later I have imported it to \\jre\\lib\\security\\cacerts which resolved the issue. 所以后来我把它导入了\\ jre \\ lib \\ security \\ cacerts,解决了这个问题。

Thank you @VonC for your help. 谢谢@VonC的帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM