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

Git "Tag to push" should trim whitespace

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Component/s: git-plugin
    • Labels:
      None
    • Similar Issues:

      Description

      Using git plugin 1.1.17.

      If you accidentally leave in whitespace in the "Tag to push" field, git will create a tag with the whitespace replaced by an "". E.g. if you configure a tag like "build-${BUILD_NUMBER} " (note the whitespace at the end of the field), the created tag will then be "build-121" or the like.

      The tag will be created locally but pushing the tag will fail because it will try to push the tag without the "_", and this tag will not exist.

      Pushing tag build-121  to repo origin
      ERROR: Failed to push tag build-121  to origin
      hudson.plugins.git.GitException: Command "git push git-company@server.company.com:/srv/company.git build-121 " returned status code 128:
      stdout: 
      stderr: fatal: remote part of refspec is not a valid name in build-121 
      
      	at hudson.plugins.git.GitAPI.launchCommandIn(GitAPI.java:779)
      	at hudson.plugins.git.GitAPI.launchCommand(GitAPI.java:741)
      	at hudson.plugins.git.GitAPI.push(GitAPI.java:797)
      	at hudson.plugins.git.GitPublisher$3.invoke(GitPublisher.java:277)
      	at hudson.plugins.git.GitPublisher$3.invoke(GitPublisher.java:247)
      	at hudson.FilePath.act(FilePath.java:832)
      	at hudson.FilePath.act(FilePath.java:814)
      	at hudson.plugins.git.GitPublisher.perform(GitPublisher.java:247)
      	at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)
      	at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:705)
      	at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:680)
      	at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:658)
      	at hudson.model.Build$RunnerImpl.post2(Build.java:162)
      	at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:627)
      	at hudson.model.Run.run(Run.java:1446)
      	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
      	at hudson.model.ResourceController.execute(ResourceController.java:88)
      	at hudson.model.Executor.run(Executor.java:238)
      Build step 'Git Publisher' changed build result to FAILURE
      

      This error kind of pointed me in the wrong direction and it took some time to figure this out, it would be really great if the field could be trimmed, hopefully it will save some people some time if they have this same problem. Alternatively, you could give an error when leaving whitespace in the "Tag to push" field.

        Attachments

          Activity

          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Seiji Sogabe
          Path:
          src/main/java/hudson/plugins/git/GitPublisher.java
          http://jenkins-ci.org/commit/git-plugin/39f7ffc016f187ded38767f7e0fb941322eb567e
          Log:
          [FIXED JENKINS-13550] Git "Tag to push" should trim whitespace

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Seiji Sogabe Path: src/main/java/hudson/plugins/git/GitPublisher.java http://jenkins-ci.org/commit/git-plugin/39f7ffc016f187ded38767f7e0fb941322eb567e Log: [FIXED JENKINS-13550] Git "Tag to push" should trim whitespace
          Hide
          willemst Willem Stuursma added a comment -

          Thanks!

          Show
          willemst Willem Stuursma added a comment - Thanks!

            People

            • Assignee:
              ndeloof Nicolas De Loof
              Reporter:
              willemst Willem Stuursma
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: