Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins - GitHub Enterprise API, HTTP Code -1

Tags:

git

jenkins

I'm trying to use Jenkins with GitHub Enterprise. However, I keep getting HTTP Response Code -1, and message 'null'.

enter image description here

For repository owner/name, I've tried my own account name, account name/repo name, and then repo name, however, it had the same message.

enter image description here

I added my token by pressing the add credentials button, and added my token to the secret text.

enter image description here

I also sent the request to requestbin, which allows to analysis my http request, and it uses headers to pass the token key. I've tried the same curl command, but it works for me.

Has anyone encountered this before? Thanks

These are my settings for Jenkins and GitHub:

enter image description here

enter image description here

enter image description here

enter image description here

It doesn't work, since Jenkins complains that it cannot connect to GitHub in the logs with http error code -1, and message null.

like image 647
user1157751 Avatar asked May 09 '16 22:05

user1157751


People also ask

How does Jenkins connect to GitHub Enterprise?

Configuring GitHubStep 1: go to your GitHub repository and click on 'Settings'. Step 2: Click on Webhooks and then click on 'Add webhook'. Step 3: In the 'Payload URL' field, paste your Jenkins environment URL. At the end of this URL add /github-webhook/.

How do I authenticate GitHub with Jenkins?

The GitHub Authentication Plugin provides a security realm to authenticate Jenkins users via GitHub OAuth. In the Global Security configuration choose the Security Realm to be GitHub Authentication Plugin. The settings to configure are: GitHub Web URI, GitHub API URI, Client ID, Client Secret, and OAuth Scope(s).

What is GitHub Jenkins?

Jenkins scans your entire GitHub organization and creates Pipeline jobs for each repository containing a Jenkinsfile—a text file that defines the process of building, testing, and deploying your project using Jenkins.


2 Answers

I was able to solve it by upgrading to a newer Jenkins (now using 1.5) to 2.3.

like image 130
user1157751 Avatar answered Oct 09 '22 21:10

user1157751


Facts:
1. Request to requestbin works, whereas request to github.xxx.com does not work.
2. Curl request to github.xxx.com works

Assumptions:
1. Curl request was fired presumably from your local computer.If I go ahead and risk a guess, the curl command test probably was not done in the computer/server where jenkins is running from. If not, please ignore this point.
2. Github did not go crazy.
3. There was no human error

More facts:
1. Github plugin uses git client
2. Git client would return with a -1 when any error occurs. Usual convention - 0 is okay and any non zero is not okay.

Possibilities:
1. You could have hit a known issue in git client of Jenkins (may be https://issues.jenkins-ci.org/browse/JENKINS-20261) which was solved by upgrading to new version of jenkins, since jenkins upgrade requires some plugin upgrades.
2. DNS caching could be a problem in your Jenkins computer/server
3. Your Jenkins server/computer was out of your VPN for sometime and came back into VPN exactly after you completed upgrade.

Hope this helps.

like image 36
vivek_ganesan Avatar answered Oct 09 '22 20:10

vivek_ganesan