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

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

      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

          [JENKINS-44360] '%' in branch name causes GitHub multi-branch job failures

          Mark Waite created issue -
          Mark Waite made changes -
          Summary Original: '%' in branch name of GitHub Organization Folders causes strange job Windows failure New: '%' in branch name of GitHub Organization Folders repository causes job failure
          Mark Waite made changes -
          Description Original: A '%' character in a branch name breaks clone on a git repository if the job performing the clone is generated by GitHub Organization Folder plugin. The same character in the same branch does not break clone with a multi-branch pipeline automatically defined job.

          Steps to duplicate the problem:

          # Define a GitHub Organization Folders job which references the GitHub organization MarkEWaite, looking only at the repository jenkins-bugs
          # Scan the repository, watch the jobs run
          # Open the has-percent-%-JENKINS-44041 job and confirm it failed to clone

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

          # Define a multi-branch pipeline job using the MarkEWaite/jenkins-bugs github repo
          # Scan the repository, watch the jobs run
          # Open the has-percent-%-JENKINS-44041 job and confirm it cloned successfully

          The issue seems to require:
          * GitHub Organization Folders
          * '%' in the branch name on the repository
          New: A '%' character in a branch name breaks clone on a git repository if the job performing the clone is generated by GitHub Organization Folder plugin. The same character in the same branch does not break clone with a multi-branch pipeline automatically defined job.

          Steps to duplicate the problem:

          # Define a GitHub Organization Folders job which references the GitHub organization MarkEWaite, looking only at the repository jenkins-bugs
          # Scan the repository, watch the jobs run
          # Open the has-percent-%-JENKINS-44360 job and confirm it failed to clone

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

          # Define a multi-branch pipeline job using the MarkEWaite/jenkins-bugs github repo
          # Scan the repository, watch the jobs run
          # Open the has-percent-%-JENKINS-44360 job and confirm it cloned successfully

          The issue seems to require:
          * GitHub Organization Folders
          * '%' in the branch name on the repository

          Nick Jones added a comment - - edited

          In my experience earlier today, this happens with a Multibranch Pipeline pointed at a GitHub repository; it does not require a GitHub Organization Folders job. I had an established Multibranch Pipeline job (which had built master) and when I added a branch called "percents are 100% good", the new branch build in Jenkins failed with a java.io.FileNotFoundException (and dumped a large chunk of HTML to the console log). It looks like GitHub expects the "%" to be escaped as %25 when cloning the remote repository, and it wasn't.

          I should add that this was on a Windows Jenkins node, and was pointed at GitHub Enterprise, in case either is a relevant detail.

          Nick Jones added a comment - - edited In my experience earlier today, this happens with a Multibranch Pipeline pointed at a GitHub repository; it does not require a GitHub Organization Folders job. I had an established Multibranch Pipeline job (which had built master) and when I added a branch called "percents are 100% good", the new branch build in Jenkins failed with a java.io.FileNotFoundException (and dumped a large chunk of HTML to the console log). It looks like GitHub expects the "%" to be escaped as %25 when cloning the remote repository, and it wasn't. I should add that this was on a Windows Jenkins node, and was pointed at GitHub Enterprise, in case either is a relevant detail.

          Mark Waite added a comment - - edited

          medianick any chance that you've modified the PATH_MAX value (as described in the branch api pliugin)? That changes the workspace naming rules, and may be why you're seeing different results than I'm seeing.

          I modified the Jenkinsfile in my validation job to only run on Windows agents, and still only see the problem in the context of a GitHub Organization Folder.

          I'm sure you're seeing a problem, but I don't understand what is different between your environment and mine which makes it so that I can't see the problem you're seeing.

          Another possible difference: Is your master node running on WIndows? Mine is a docker instance and I haven't yet expended the effort to do docker on Windows

          Mark Waite added a comment - - edited medianick any chance that you've modified the PATH_MAX value (as described in the branch api pliugin )? That changes the workspace naming rules, and may be why you're seeing different results than I'm seeing. I modified the Jenkinsfile in my validation job to only run on Windows agents, and still only see the problem in the context of a GitHub Organization Folder. I'm sure you're seeing a problem, but I don't understand what is different between your environment and mine which makes it so that I can't see the problem you're seeing. Another possible difference: Is your master node running on WIndows? Mine is a docker instance and I haven't yet expended the effort to do docker on Windows

          Nick Jones added a comment -

          markewaite, I haven't modified PATH_MAX; it's still the default (80). The only thing I've done to accommodate the longer paths generated by Multibranch Pipelines is to set the core.longpaths setting for Git to true. I'm running Windows Server 2012 with everything Jenkins-related under a C:\Jenkins folder.

          Perhaps the difference is GitHub.com vs. GitHub Enterprise (which I'm using)?

          Nick Jones added a comment - markewaite , I haven't modified PATH_MAX; it's still the default (80). The only thing I've done to accommodate the longer paths generated by Multibranch Pipelines is to set the core.longpaths setting for Git to true. I'm running Windows Server 2012 with everything Jenkins-related under a C:\Jenkins folder. Perhaps the difference is GitHub.com vs. GitHub Enterprise (which I'm using)?

          Mark Waite added a comment -

          medianick I interpret your statement:

          I'm running Windows Server 2012 with everything Jenkins-related under a C:\Jenkins folder.

          to mean that your master is on Windows. If so, then that is the most likely cause of the difference between your case and mine.

          Mark Waite added a comment - medianick I interpret your statement: I'm running Windows Server 2012 with everything Jenkins-related under a C:\Jenkins folder. to mean that your master is on Windows. If so, then that is the most likely cause of the difference between your case and mine.

          Nick Jones added a comment -

          markwaite, yes, master and all build agents are on Windows.

          Nick Jones added a comment - markwaite , yes, master and all build agents are on Windows.
          Mark Waite made changes -
          Summary Original: '%' in branch name of GitHub Organization Folders repository causes job failure New: '%' in branch name causes Windows multi-branch job failures
          Mark Waite made changes -
          Component/s New: workflow-multibranch-plugin [ 21465 ]

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

              Created:
              Updated: