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

InvalidTagNameException with version 1.0.4 of git client

    Details

    • Similar Issues:

      Description

      I just upgraded our git-client-plugin from 1.0.2 to 1.0.4 and now get an InvalidTagNameException. We were running Jenkins 1.505.

      The exception implies I've created a tag, which I certainly haven't, so I'm not sure how the issue is occurring. I'm assuming the issue is because the tag it believes it is receiving contains spaces.

      Here's the stacktrace:

      Using strategy: Default
      Last Built Revision: Revision b6db3c79b4f208e6989e4f10f00f564d189b7590 (origin/develop)
      Fetching changes from 1 remote Git repository
      Commencing build of Revision 8862b04b711a283d4e53962cc60e9b4203807d3a (origin/develop)
      Checking out Revision 8862b04b711a283d4e53962cc60e9b4203807d3a (origin/develop)
      FATAL: org.eclipse.jgit.api.errors.InvalidTagNameException: tag name jenkins-WOW - Dev-872 is invalid
      hudson.plugins.git.GitException: org.eclipse.jgit.api.errors.InvalidTagNameException: tag name jenkins-WOW - Dev-872 is invalid
      at org.jenkinsci.plugins.gitclient.JGitAPIImpl.tag(JGitAPIImpl.java:179)
      at hudson.plugins.git.GitAPI.tag(GitAPI.java:220)
      at hudson.plugins.git.GitSCM$4.invoke(GitSCM.java:1239)
      at hudson.plugins.git.GitSCM$4.invoke(GitSCM.java:1196)
      at hudson.FilePath.act(FilePath.java:865)
      at hudson.FilePath.act(FilePath.java:838)
      at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1196)
      at hudson.model.AbstractProject.checkout(AbstractProject.java:1353)
      at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:683)
      at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
      at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:588)
      at hudson.model.Run.execute(Run.java:1567)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
      at hudson.model.ResourceController.execute(ResourceController.java:88)
      at hudson.model.Executor.run(Executor.java:237)
      Caused by: org.eclipse.jgit.api.errors.InvalidTagNameException: tag name jenkins-WOW - Dev-872 is invalid
      at org.eclipse.jgit.api.TagCommand.processOptions(TagCommand.java:198)
      at org.eclipse.jgit.api.TagCommand.call(TagCommand.java:112)
      at org.jenkinsci.plugins.gitclient.JGitAPIImpl.tag(JGitAPIImpl.java:175)
      ... 14 more

        Attachments

          Activity

          Hide
          ndeloof Nicolas De Loof added a comment -

          JGit reject tags with whitespaces, as a preventive check
          as build tag is "jenkins-" + JOB_NAME + "-" + BUILD-NUMBER and JOB_NAME allows such whitespaces JGit introduce this bug.

          workaround is to configure git (advanced section) to NOT tag builds, and/or run jenkins with -Dorg.jenkinsci.plugins.gitclient.Git.useCLI=true

          possible fix : post-process tag name to avoid whitespace and other JGit unsupported characters

          Show
          ndeloof Nicolas De Loof added a comment - JGit reject tags with whitespaces, as a preventive check as build tag is "jenkins-" + JOB_NAME + "-" + BUILD-NUMBER and JOB_NAME allows such whitespaces JGit introduce this bug. workaround is to configure git (advanced section) to NOT tag builds, and/or run jenkins with -Dorg.jenkinsci.plugins.gitclient.Git.useCLI=true possible fix : post-process tag name to avoid whitespace and other JGit unsupported characters
          Hide
          egore911 Christoph B added a comment -

          This is pretty severe to me. Our complete build system stopped running because all of our 250 projects are prefixed by a text and followed by a space. Please repair this.

          Show
          egore911 Christoph B added a comment - This is pretty severe to me. Our complete build system stopped running because all of our 250 projects are prefixed by a text and followed by a space. Please repair this.
          Hide
          hawky4s Christian Lipphardt added a comment - - edited

          Same here. Please fix it! (We can live with the fix to disable the internal tag for the moment tho)

          Show
          hawky4s Christian Lipphardt added a comment - - edited Same here. Please fix it! (We can live with the fix to disable the internal tag for the moment tho)
          Hide
          egore911 Christoph B added a comment -

          I'm not going to disable the internal tagging temporarily by changing the configuration of 250 projects

          Show
          egore911 Christoph B added a comment - I'm not going to disable the internal tagging temporarily by changing the configuration of 250 projects
          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/GitTagAction.java
          http://jenkins-ci.org/commit/git-plugin/b0a6db04e3afa05ec054757e076090e51be91755
          Log:
          [FIXED JENKINS-17195] avoid whitespace in tag name
          (enforced by JGit)

          Compare: https://github.com/jenkinsci/git-plugin/compare/8fb5de484064...b0a6db04e3af


          You received this message because you are subscribed to the Google Groups "Jenkins Commits" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-commits+unsubscribe@googlegroups.com.
          For more options, visit https://groups.google.com/groups/opt_out.

          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/GitTagAction.java http://jenkins-ci.org/commit/git-plugin/b0a6db04e3afa05ec054757e076090e51be91755 Log: [FIXED JENKINS-17195] avoid whitespace in tag name (enforced by JGit) Compare: https://github.com/jenkinsci/git-plugin/compare/8fb5de484064...b0a6db04e3af – You received this message because you are subscribed to the Google Groups "Jenkins Commits" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-commits+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out .
          Hide
          dvenable David Venable added a comment - - edited

          The previous commit does not fix this issue on my server. The following commit has fixed the issue on my server.
          https://github.com/dlvenable/git-plugin/commit/d5af3de2657de6b94bb810c7f69cd19720497911

          I can create a pull request if you'd like.

          Show
          dvenable David Venable added a comment - - edited The previous commit does not fix this issue on my server. The following commit has fixed the issue on my server. https://github.com/dlvenable/git-plugin/commit/d5af3de2657de6b94bb810c7f69cd19720497911 I can create a pull request if you'd like.
          Hide
          darthtanner David Tanner added a comment -

          GitTagAction wasn't the culprit if you look at the stack trace. The error was created by line 1090 in GitSCM. Please pull my request, or fix that line and build 1.0.5 ASAP.

          Show
          darthtanner David Tanner added a comment - GitTagAction wasn't the culprit if you look at the stack trace. The error was created by line 1090 in GitSCM. Please pull my request, or fix that line and build 1.0.5 ASAP.
          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/GitSCM.java
          http://jenkins-ci.org/commit/git-plugin/68eea05dccac95bede80bdbe0ff558ac767b207f
          Log:
          Merge pull request #141 from dlvenable/whitespace-fix

          Replace whitespace with underscore - JENKINS-17195

          Compare: https://github.com/jenkinsci/git-plugin/compare/b0a6db04e3af...68eea05dccac


          You received this message because you are subscribed to the Google Groups "Jenkins Commits" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-commits+unsubscribe@googlegroups.com.
          For more options, visit https://groups.google.com/groups/opt_out.

          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/GitSCM.java http://jenkins-ci.org/commit/git-plugin/68eea05dccac95bede80bdbe0ff558ac767b207f Log: Merge pull request #141 from dlvenable/whitespace-fix Replace whitespace with underscore - JENKINS-17195 Compare: https://github.com/jenkinsci/git-plugin/compare/b0a6db04e3af...68eea05dccac – You received this message because you are subscribed to the Google Groups "Jenkins Commits" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-commits+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out .
          Hide
          mddubs Matt Williamson added a comment -

          This is a major issue for us as well. Selecting "Skip Internal Tag" doesn't work for us either, the post-build still fails with InvalidTagNameException when the branch is supposed to be merged into master.

          Sounds like the issue has been identified and fixed, but how will we know when the update will be available through yum?

          Show
          mddubs Matt Williamson added a comment - This is a major issue for us as well. Selecting "Skip Internal Tag" doesn't work for us either, the post-build still fails with InvalidTagNameException when the branch is supposed to be merged into master. Sounds like the issue has been identified and fixed, but how will we know when the update will be available through yum?
          Hide
          darthtanner David Tanner added a comment -

          Also found the issue in one other location inside GitPublisher. Submitted pull request.
          https://github.com/jenkinsci/git-plugin/pull/142

          Show
          darthtanner David Tanner added a comment - Also found the issue in one other location inside GitPublisher. Submitted pull request. https://github.com/jenkinsci/git-plugin/pull/142
          Hide
          markewaite Mark Waite added a comment -

          Since git-client-plugin 1.0.5 reverted to using the git CLI instead of using JGit as its default, I think this bug is fixed by git-client-plugin 1.0.5. Can you check that the issue is resolved by installing git-client-plugin 1.0.5?

          Show
          markewaite Mark Waite added a comment - Since git-client-plugin 1.0.5 reverted to using the git CLI instead of using JGit as its default, I think this bug is fixed by git-client-plugin 1.0.5. Can you check that the issue is resolved by installing git-client-plugin 1.0.5?
          Hide
          mddubs Matt Williamson added a comment -

          I'm running "Jenkins GIT client plugin" 1.0.4, but it doesn't show any updates available.

          Show
          mddubs Matt Williamson added a comment - I'm running "Jenkins GIT client plugin" 1.0.4, but it doesn't show any updates available.
          Hide
          markewaite Mark Waite added a comment -

          Go to the "Advanced" tab in the "Manage Plugins" section and you'll see an "Update Now" button in the bottom right corner. Above that "Update Now" button it will show the last time it polled for updates. If you press the "Update Now", it will poll immediately, and should then show the 1.0.5 plugin is available.

          Show
          markewaite Mark Waite added a comment - Go to the "Advanced" tab in the "Manage Plugins" section and you'll see an "Update Now" button in the bottom right corner. Above that "Update Now" button it will show the last time it polled for updates. If you press the "Update Now", it will poll immediately, and should then show the 1.0.5 plugin is available.
          Hide
          mddubs Matt Williamson added a comment -

          Great, looks like that fixed all our issues! For others...

          Manage Jenkins -> Manage Plugins -> Advanced Tab -> Check now button (bottom right corner)

          Manage Jenkins -> Manage Plugins -> Updates Tab -> Install all (specifically Jenkins GIT Client Plugin 1.0.5)

          Thank you!!

          Show
          mddubs Matt Williamson added a comment - Great, looks like that fixed all our issues! For others... Manage Jenkins -> Manage Plugins -> Advanced Tab -> Check now button (bottom right corner) Manage Jenkins -> Manage Plugins -> Updates Tab -> Install all (specifically Jenkins GIT Client Plugin 1.0.5) Thank you!!
          Hide
          markewaite Mark Waite added a comment -

          git-client-plugin 1.0.5 resolved this by switching back to the CLI as the default git implementation.

          Show
          markewaite Mark Waite added a comment - git-client-plugin 1.0.5 resolved this by switching back to the CLI as the default git implementation.

            People

            • Assignee:
              ndeloof Nicolas De Loof
              Reporter:
              edhgoose Edward Hartwell Goose
            • Votes:
              7 Vote for this issue
              Watchers:
              14 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: