Willem Stuursma created JENKINS-13550:
-----------------------------------------

             Summary: Git "Tag to push" should trim whitespace
                 Key: JENKINS-13550
                 URL: https://issues.jenkins-ci.org/browse/JENKINS-13550
             Project: Jenkins
          Issue Type: Bug
          Components: git
            Reporter: Willem Stuursma
            Assignee: Nicolas De Loof
            Priority: Minor


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.

{code}
Pushing tag build-121  to repo origin
ERROR: Failed to push tag build-121  to origin
hudson.plugins.git.GitException: Command "git push 
[email protected]:/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
{code}

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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.jenkins-ci.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to