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

'%' in branch name causes GitHub multi-branch job failures

    XMLWordPrintable

Details

    Description

      A '%' character in a branch name breaks the GitHub API calls on a git repository if the job performing the clone is generated by GitHub Organization Folder plugin (windows or Linux) or the GitHub branch source (windows or Linux).

      Steps to duplicate the problem:

      1. Define a GitHub multibranch PIpeline job referencing the MarkEWaite/jenkins-bugs repository (or a GitHub Organization Folders job which references the GitHub organization MarkEWaite, looking only at the repository jenkins-bugs)
      2. Scan the repository, watch the jobs run
      3. Open the has-percent-%-JENKINS-44360 job and confirm it failed to clone

      Steps to show the same branch working with a multibranch pipeline:

      1. Define a multi-branch pipeline job using the MarkEWaite/jenkins-bugs github repo using Git as the branch source rather than GitHub
      2. Scan the repository, watch the jobs run
      3. Open the has-percent-%-JENKINS-44360 job and confirm it cloned successfully

      The issue seems to require:

      • GitHub Organization Folders or GitHub multibranch
      • '%' in the branch name on the repository

      Attachments

        Issue Links

          Activity

            Removing myself as assignee. My current work assignments do not provide sufficient bandwidth to review these issues and in the majority of cases I am only assigned by virtue of being the default assignee. For the credentials-api and scm-api related plugins I have permission to allocate time reviewing changes to these APIs themselves to ensure these APIs remain cohesive, but that can be handled through PR reviews rather than assigning issues in JIRA

            stephenconnolly Stephen Connolly added a comment - Removing myself as assignee. My current work assignments do not provide sufficient bandwidth to review these issues and in the majority of cases I am only assigned by virtue of being the default assignee. For the credentials-api and scm-api related plugins I have permission to allocate time reviewing changes to these APIs themselves to ensure these APIs remain cohesive, but that can be handled through PR reviews rather than assigning issues in JIRA
            jglick Jesse Glick added a comment -

            Likely obsolete as of JENKINS-2111.

            jglick Jesse Glick added a comment - Likely obsolete as of JENKINS-2111 .
            markewaite Mark Waite added a comment - - edited

            I continue to see job failures when using a branch name containing '%' with either a GitHub organization folder or a GitHub branch source. I don't see those job failures when I use Git as a branch source, only if I use GitHub as the branch source or a GitHub organization folder.

            I haven't checked Bitbucket branch source or Gitea to see if the issue is specific to GitHub or is connected to something unrelated to the branch API plugin.

            The failing job writes the following surprising log file into build/1/log:

            Connecting to https://api.github.com using MarkEWaite/****** (MarkEWaite github username/password)
            java.io.FileNotFoundException: https://api.github.com/repos/MarkEWaite/jenkins-bugs/git/refs/heads/has-percent-%-JENKINS-44360
                    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:625)
                    at org.kohsuke.github.Requester.parse(Requester.java:607)
                    at org.kohsuke.github.Requester._to(Requester.java:285)
            Caused: org.kohsuke.github.GHFileNotFoundException:
            ...  Long content that looks like an HTML file ...
                    at org.kohsuke.github.Requester.handleApiError(Requester.java:699)
                    at org.kohsuke.github.Requester._to(Requester.java:306)
                    at org.kohsuke.github.Requester.to(Requester.java:247)
                    at org.kohsuke.github.GHRepository.getRef(GHRepository.java:891)
                    at org.jenkinsci.plugins.github_branch_source.GitHubSCMSource.retrieve(GitHubSCMSource.java:1531)
                    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:293)
                    at hudson.model.ResourceController.execute(ResourceController.java:97)
                    at hudson.model.Executor.run(Executor.java:429)
            Finished: FAILURE
            

            I've uploaded build/1/log as JENKINS-44360.log

            The specific branch that shows the failure is in my jenkins-bugs GitHub repository.

            markewaite Mark Waite added a comment - - edited I continue to see job failures when using a branch name containing '%' with either a GitHub organization folder or a GitHub branch source. I don't see those job failures when I use Git as a branch source, only if I use GitHub as the branch source or a GitHub organization folder. I haven't checked Bitbucket branch source or Gitea to see if the issue is specific to GitHub or is connected to something unrelated to the branch API plugin. The failing job writes the following surprising log file into build/1/log : Connecting to https://api.github.com using MarkEWaite/****** (MarkEWaite github username/password) java.io.FileNotFoundException: https://api.github.com/repos/MarkEWaite/jenkins-bugs/git/refs/heads/has-percent-%-JENKINS-44360 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:625) at org.kohsuke.github.Requester.parse(Requester.java:607) at org.kohsuke.github.Requester._to(Requester.java:285) Caused: org.kohsuke.github.GHFileNotFoundException: ... Long content that looks like an HTML file ... at org.kohsuke.github.Requester.handleApiError(Requester.java:699) at org.kohsuke.github.Requester._to(Requester.java:306) at org.kohsuke.github.Requester.to(Requester.java:247) at org.kohsuke.github.GHRepository.getRef(GHRepository.java:891) at org.jenkinsci.plugins.github_branch_source.GitHubSCMSource.retrieve(GitHubSCMSource.java:1531) 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:293) at hudson.model.ResourceController.execute(ResourceController.java:97) at hudson.model.Executor.run(Executor.java:429) Finished: FAILURE I've uploaded build/1/log as JENKINS-44360.log The specific branch that shows the failure is in my jenkins-bugs GitHub repository .
            jglick Jesse Glick added a comment -

            markewaite you changed the Status to be IN REVIEW but there is no Assignee and I see no linked PR purporting to fix the issue.

            Perhaps you just meant to set this to Open, and change the component to github-branch-source-plugin since that seems to be the source of the problem?

            jglick Jesse Glick added a comment - markewaite you changed the Status to be IN REVIEW but there is no Assignee and I see no linked PR purporting to fix the issue. Perhaps you just meant to set this to Open , and change the component to github-branch-source-plugin since that seems to be the source of the problem?
            markewaite Mark Waite added a comment - - edited

            Thanks jglick! I took too simple approach and chose the bug status as one of the proposed in the flow for next status, rather than setting it to the correct state of Open. Status has been corrected and reassigned to github-branch-source-plugin.

            markewaite Mark Waite added a comment - - edited Thanks jglick ! I took too simple approach and chose the bug status as one of the proposed in the flow for next status, rather than setting it to the correct state of Open . Status has been corrected and reassigned to github-branch-source-plugin.

            People

              Unassigned Unassigned
              markewaite Mark Waite
              Votes:
              5 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated: