Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-62765

GH Plugin uses wrong URL - GHFileNotFoundException

      Trying to run a build produces this error:

      Connecting to https://github-enterprise.systems.uk.domain/api/v3 using ihubplegit/****** (github service account)Connecting to https://github-enterprise.systems.uk.domain/api/v3 using ihubplegit/****** (github service account)java.io.FileNotFoundException: https://github-enterprise.systems.uk.domain/api/v3/repos/org/repo/git/ref/heads/BRANCH-NAME 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://github-enterprise.systems.uk.domain/api/v3/repos/org/repo/git/ref/heads/BRANCH-NAME {"message":"Not Found","documentation_url":"https://developer.github.com/enterprise/2.20/v3/git/refs/#get-a-single-reference"} 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:428)Finished: FAILURE
      

      The issue is that this URL https://github-enterprise.systems.uk.domain/api/v3/repos/org/repo/git/ref/heads/BRANCH-NAME doesn't exist.

      Should be this URL https://github-enterprise.systems.uk.domain/api/v3/repos/org/repo/git/refs/heads/BRANCH-NAME

       

      So Jenkins is using "ref" instead of "refs"

          [JENKINS-62765] GH Plugin uses wrong URL - GHFileNotFoundException

          Jonathan Strickland added a comment - This commit looks to have broke it:  https://github.com/hub4j/github-api/commit/965c9cb0af975d06e32a8c78fa9edbaa49a14302

          Jonathan Strickland added a comment - Initial breakage in https://github.com/hub4j/github-api/releases/tag/github-api-1.112 ...

          Liam Newman added a comment - - edited

          Fixed in github-api-plugin v1.114

          Liam Newman added a comment - - edited Fixed in github-api-plugin v1.114

            lanwen Kirill Merkushev
            paoloventriglia Paolo Ventriglia
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: