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

Trailing space in Git branch name causes build failures

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      While setting up a new job, I C&P my Git branch name into the "Branch Specifier" under SCM. I didn't realize it, but there was a trailing space in the branch name. This caused the build to fail with:

      Started by user ryan.shoemaker
      Building in workspace /opt/jenkins/jobs/MyJob/workspace
      Checkout:workspace / /opt/jenkins/jobs/MyJob/workspace - hudson.remoting.LocalChannel@6c616408
      Using strategy: Default
      Wiping out workspace first.
      Cloning the remote Git repository
      Cloning repository origin
      Fetching upstream changes from ssh://ryan.shoemaker@mygitserver.com/git/MyModule
      ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.

      When I removed the trailing space from the branch name, everything built fine.

        Attachments

          Activity

          Hide
          thesam Samuel Moritz added a comment -

          I can reproduce this with Jenkins 1.494 and Jenkins GIT plugin 1.1.26.

          Show
          thesam Samuel Moritz added a comment - I can reproduce this with Jenkins 1.494 and Jenkins GIT plugin 1.1.26.
          Hide
          thesam Samuel Moritz added a comment -
          Show
          thesam Samuel Moritz added a comment - Pull request at https://github.com/jenkinsci/git-plugin/pull/115
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Samuel Moritz
          Path:
          src/main/java/hudson/plugins/git/BranchSpec.java
          src/test/java/hudson/plugins/git/TestBranchSpec.java
          http://jenkins-ci.org/commit/git-plugin/7a1e61eb2f08b2ed4aebb31e3cee272cf8a54ee6
          Log:
          [FIXES JENKINS-15235]

          • Trim branch name before storing it, since a valid branch name does
            not begin or end with whitespace.
          • Use same code for setting name in constructor and in setName().
            Previously, there were no check for valid values in setName().
          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Samuel Moritz Path: src/main/java/hudson/plugins/git/BranchSpec.java src/test/java/hudson/plugins/git/TestBranchSpec.java http://jenkins-ci.org/commit/git-plugin/7a1e61eb2f08b2ed4aebb31e3cee272cf8a54ee6 Log: [FIXES JENKINS-15235] Trim branch name before storing it, since a valid branch name does not begin or end with whitespace. Use same code for setting name in constructor and in setName(). Previously, there were no check for valid values in setName().
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Nicolas De loof
          Path:
          src/main/java/hudson/plugins/git/BranchSpec.java
          src/test/java/hudson/plugins/git/TestBranchSpec.java
          http://jenkins-ci.org/commit/git-plugin/442eecdd44365a3d3420578db3c9e8325c7aec8e
          Log:
          Merge pull request #115 from thesam/jenkins15235

          [FIXES JENKINS-15235] Add whitespace trimming of branch name.

          Compare: https://github.com/jenkinsci/git-plugin/compare/707a99181369...442eecdd4436

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Nicolas De loof Path: src/main/java/hudson/plugins/git/BranchSpec.java src/test/java/hudson/plugins/git/TestBranchSpec.java http://jenkins-ci.org/commit/git-plugin/442eecdd44365a3d3420578db3c9e8325c7aec8e Log: Merge pull request #115 from thesam/jenkins15235 [FIXES JENKINS-15235] Add whitespace trimming of branch name. Compare: https://github.com/jenkinsci/git-plugin/compare/707a99181369...442eecdd4436
          Hide
          thesam Samuel Moritz added a comment -

          D'oh! I entered "FIXES" instead of "FIXED", so this was not resolved automatically.

          Show
          thesam Samuel Moritz added a comment - D'oh! I entered "FIXES" instead of "FIXED", so this was not resolved automatically.
          Hide
          aflat aflat added a comment -

          Looks like a regression, this popped up again. Should I create a new bug, or shoudl this one be re-opened?

          git plugin: 2.4.4
          git client plugin: 1.19.6
          jenkins: 2.6

          Show
          aflat aflat added a comment - Looks like a regression, this popped up again. Should I create a new bug, or shoudl this one be re-opened? git plugin: 2.4.4 git client plugin: 1.19.6 jenkins: 2.6

            People

            • Assignee:
              ndeloof Nicolas De Loof
              Reporter:
              ryanshoemaker ryan shoemaker
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: