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

GitHub branches with hash in name fail to build

XMLWordPrintable

      I'm not sure when exactly this has started happening, but I've noticed last week that GitHub branches with a hash (#) in the name fail to build in pipeline jobs.

      From the logs it looks like the hash should be url encoded, but isn't. I'm pretty sure this was working before though so not sure what's going on.

      Relevant stack trace. Branch name in question is feature/#1234/xxx (redacted):

      ERROR: {"message":"Branch not found","documentation_url":"https://developer.github.com/v3/repos/#get-branch"}
      java.io.FileNotFoundException: https://api.github.com/repos/xxx/xxx/branches/feature/#1234/xxx
      	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.Requester.parse(Requester.java:602)
      	at org.kohsuke.github.Requester.parse(Requester.java:584)
      	at org.kohsuke.github.Requester._to(Requester.java:264)
      Caused: java.io.FileNotFoundException: {"message":"Branch not found","documentation_url":"https://developer.github.com/v3/repos/#get-branch"}
      	at org.kohsuke.github.Requester.handleApiError(Requester.java:660)
      	at org.kohsuke.github.Requester._to(Requester.java:285)
      	at org.kohsuke.github.Requester.to(Requester.java:226)
      	at org.kohsuke.github.GHRepository.getBranch(GHRepository.java:1234)
      	at org.jenkinsci.plugins.github_branch_source.GitHubSCMSource$LazyBranches.create(GitHubSCMSource.java:1773)
      	at org.jenkinsci.plugins.github_branch_source.LazyIterable.iterator(LazyIterable.java:57)
      	at org.jenkinsci.plugins.github_branch_source.GitHubSCMSource.retrieve(GitHubSCMSource.java:869)
      	at jenkins.scm.api.SCMSource._retrieve(SCMSource.java:355)
      	at jenkins.scm.api.SCMSource.fetch(SCMSource.java:309)
      

            Unassigned Unassigned
            pascalw Pascal Widdershoven
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: