Srikanth
Srikanth

Reputation: 55

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.
Detailed description:

  1. GitHub API endpoint is URL: https://github.mycompanydomain/api/v3
  2. I have provided Library details with Name, Default version and selected Modern 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".

Please find below error code image for reference.

enter image description here

Please help,

Regards, Srikanth

Upvotes: 2

Views: 1169

Answers (2)

Srikanth
Srikanth

Reputation: 55

Details:

  1. Verified System log : [JenkinsURL]/log/all then log shows the error:

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. So later I have imported it to \jre\lib\security\cacerts which resolved the issue.

Thank you @VonC for your help.

Upvotes: 1

VonC
VonC

Reputation: 1324278

For an https URL (using a username/password type of credential), do check if the password includes any special character.

If it does, you might need to percent encode them.

The other possibility is if your account has 2FA (two factor authentication) activated.
If it does, the password should be a PTA (Personnal Token Access), not your actual account password.

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.
  • 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)

Upvotes: 2

Related Questions