Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GHE returning 404 when trying to fetch reference file for master branch #844

Closed
suryatej16 opened this issue Jun 11, 2020 · 4 comments
Closed
Labels

Comments

@suryatej16
Copy link

suryatej16 commented Jun 11, 2020

Describe the bug
Due to the change introduced in #822, GHE v2.18 will return a 404 when you attempt to access api/v3/repos/:org/:repo/git/ref/heads/master instead of api/v3/repos/:org/:repo/git/refs/heads/master. This is causing the Jenkins Github Branch Source plugin to throw the following stacktrace:

java.io.FileNotFoundException: https://xxxxxxxxx/api/v3/repos/:org/:repo/git/ref/heads/master
	at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:243)
	at com.squareup.okhttp.internal.huc.DelegatingHttpsURLConnection.getInputStream(DelegatingHttpsURLConnection.java:210)
	at com.squareup.okhttp.internal.huc.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:25)
	at org.kohsuke.github.GitHubHttpUrlConnectionClient$HttpURLConnectionResponseInfo.bodyStream(GitHubHttpUrlConnectionClient.java:197)
	at org.kohsuke.github.GitHubResponse$ResponseInfo.getBodyAsString(GitHubResponse.java:321)
	at org.kohsuke.github.GitHubResponse.parseBody(GitHubResponse.java:85)
	at org.kohsuke.github.Requester.lambda$fetch$1(Requester.java:71)
	at org.kohsuke.github.GitHubClient.createResponse(GitHubClient.java:420)
	at org.kohsuke.github.GitHubClient.sendRequest(GitHubClient.java:374)
Caused: org.kohsuke.github.GHFileNotFoundException: https://xxxxxx/api/v3/repos/:org/:repo/git/ref/heads/master {"message":"Not Found","documentation_url":"https://developer.github.com/enterprise/2.18/v3"}
	at org.kohsuke.github.GitHubClient.interpretApiError(GitHubClient.java:451)
	at org.kohsuke.github.GitHubClient.sendRequest(GitHubClient.java:382)
	at org.kohsuke.github.GitHubClient.sendRequest(GitHubClient.java:326)
	at org.kohsuke.github.Requester.fetch(Requester.java:71)
	at org.kohsuke.github.GHRepository.getRef(GHRepository.java:1594)
	at org.jenkinsci.plugins.github_branch_source.GitHubSCMSource.retrieve(GitHubSCMSource.java:1602)
	at jenkins.scm.api.SCMSource.fetch(SCMSource.java:582)
	at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:98)
	at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:309)
	at hudson.model.ResourceController.execute(ResourceController.java:97)
	at hudson.model.Executor.run(Executor.java:429)

To Reproduce
Steps to reproduce the behavior:

  1. Run a curl -X GET https://<host>/api/v3/repos/:org/:repo/git/ref/heads/master against GHE v.2.18 and you'll get a 404 in response

Expected behavior
Should return the ref for master branch.

Desktop (please complete the following information):
Jenkins Github Branch Source plugin 2.8.0
GHE 2.18

Additional context
Add any other context about the problem here.

@suryatej16
Copy link
Author

@bitwiseman I tried to file an issue with the Jenkins plugin (https://github.com/jenkinsci/github-branch-source-plugin) as well, but don't see the Issues tab active. I see you're a contributor there as well. Once this is fixed, could you update the plugin and release a new version?

bitwiseman added a commit to bitwiseman/github-api that referenced this issue Jun 11, 2020
bitwiseman added a commit to bitwiseman/github-api that referenced this issue Jun 11, 2020
@bitwiseman
Copy link
Member

bitwiseman commented Jun 11, 2020

@suryatej16
Thanks!
Issues for Jenkins are filed on the Jenkins JIRA - issues.jenkins.io .

I'll update shortly.

@bitwiseman
Copy link
Member

Waiting for repo's to update to publish the plugin.

@solvingj
Copy link

was very confused until i found this issue. thanks to all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants