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

Git Plugin fails to resolve tags containing a slash since 2.0.1

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • git-plugin
    • None

      Since updating from 2.0.1 to 2.0.3, a job which uses tags containing a slash as "branch" does not work anymore (rel/x.y.z-... in my case)

      I my case, a sepate job creates a release tag (refs/tags/rel/my-tag).

      The job that stopped to work tries to check out this given tag (using a parameter: so the branch field contains the value: rel/$version)

      Using git plugin 2.0.1, this works. Using git plugin 2.0.3 the checkout attempt results in "Couldn't find any revision to build. Verify the repository and branch configuration for this job."

      Downgrading to 2.0.1 solves the problem.

      The problem has already been discussed in JENKINS-14026, but the applied fix only works for slash-less tags

          [JENKINS-21952] Git Plugin fails to resolve tags containing a slash since 2.0.1

          Stephan Pauxberger added a comment - - edited

          The problem lies in DefaultBuildChooser, Commit ea5cad7e27. Before this change, the implementation always fell back to an unconditional call of:

          revisions.addAll(getHeadRevision(isPollCall, singleBranch, git, listener, data));

          I think this fallback should still apply. I will provide a pull request.

          Stephan Pauxberger added a comment - - edited The problem lies in DefaultBuildChooser, Commit ea5cad7e27. Before this change, the implementation always fell back to an unconditional call of: revisions.addAll(getHeadRevision(isPollCall, singleBranch, git, listener, data)); I think this fallback should still apply. I will provide a pull request.

          Stephan Pauxberger added a comment - Created Pull Request 205 ( https://github.com/jenkinsci/git-plugin/pull/205 ).

          I'm also receiving error while trying to build from tag using Jenkins git plugin (version 2.0.4):

          ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.
          

          Build from git branches works as expected.

          Note that ALL of my tags contain numbers and dots only (no slashes), for example:

          14.01
          14.01.01
          14.01.02
          14.02
          14.02.01
          14.02.02

          etc

          Environment details:
          Jenkins LTS: 1.532.2
          Git (used by Jenkins: 1.7.11)
          Jenkins Git client plugin: 1.6.4
          Jenkins Git plugin: 2.0.4

          Jenkins Git plugin downgrade to version 2.0.1 solves issue (i.e. I'm able to build from git tags with 2.0.1).

          Dejan Stojadinović added a comment - I'm also receiving error while trying to build from tag using Jenkins git plugin (version 2.0.4 ): ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job. Build from git branches works as expected. Note that ALL of my tags contain numbers and dots only (no slashes), for example: 14.01 14.01.01 14.01.02 14.02 14.02.01 14.02.02 etc Environment details: Jenkins LTS: 1.532.2 Git (used by Jenkins: 1.7.11) Jenkins Git client plugin: 1.6.4 Jenkins Git plugin: 2.0.4 Jenkins Git plugin downgrade to version 2.0.1 solves issue (i.e. I'm able to build from git tags with 2.0.1 ).

          Mark Waite added a comment -
          • Is the problem only on initial clone of the repository, or on later clones as well?
          • When you browse the workspace, are the tags you're seeing in .git/refs/tags ?
          • Can any of the tags in the repository be used as the "branch to build"?
          • Is the behavior the same for command line git and JGit?

          Mark Waite added a comment - Is the problem only on initial clone of the repository, or on later clones as well? When you browse the workspace, are the tags you're seeing in .git/refs/tags ? Can any of the tags in the repository be used as the "branch to build"? Is the behavior the same for command line git and JGit?

          Thanx for a quick response, markewaite; I'll provide in-detail answers in day or two.

          Dejan Stojadinović added a comment - Thanx for a quick response, markewaite ; I'll provide in-detail answers in day or two.

          Code changed in jenkins
          User: Stephan Pauxberger
          Path:
          src/main/java/hudson/plugins/git/util/DefaultBuildChooser.java
          http://jenkins-ci.org/commit/git-plugin/c7dae80b85c19acec2e52783cdc8335681d816e5
          Log:
          JENKINS-21952 Resolve tags with slashes

          If no revisions are found, try to use the branch as explicit reference.
          This could be a tag rel/my-tags or any other explicit reference like a
          gerrit changeset (refs/changes/xx/yy/z).

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephan Pauxberger Path: src/main/java/hudson/plugins/git/util/DefaultBuildChooser.java http://jenkins-ci.org/commit/git-plugin/c7dae80b85c19acec2e52783cdc8335681d816e5 Log: JENKINS-21952 Resolve tags with slashes If no revisions are found, try to use the branch as explicit reference. This could be a tag rel/my-tags or any other explicit reference like a gerrit changeset (refs/changes/xx/yy/z).

          Code changed in jenkins
          User: Mark Waite
          Path:
          src/main/java/hudson/plugins/git/util/DefaultBuildChooser.java
          http://jenkins-ci.org/commit/git-plugin/7b8955796e87c8d1a0974cb07a1cba82c5e15e11
          Log:
          Merge pull request #205 from pauxus/21952-tags-with-slashes

          JENKINS-21952 Resolve tags with slashes

          Compare: https://github.com/jenkinsci/git-plugin/compare/e6b41fb200f9...7b8955796e87

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Mark Waite Path: src/main/java/hudson/plugins/git/util/DefaultBuildChooser.java http://jenkins-ci.org/commit/git-plugin/7b8955796e87c8d1a0974cb07a1cba82c5e15e11 Log: Merge pull request #205 from pauxus/21952-tags-with-slashes JENKINS-21952 Resolve tags with slashes Compare: https://github.com/jenkinsci/git-plugin/compare/e6b41fb200f9...7b8955796e87

          Mark Waite added a comment -

          Fix should be visible in the next git-plugin after 2.0.4

          Mark Waite added a comment - Fix should be visible in the next git-plugin after 2.0.4

          Mark Waite added a comment -

          Fixed in git-plugin 2.1.0

          Mark Waite added a comment - Fixed in git-plugin 2.1.0

          markewaite Sorry for the late reply; just to confirm that upgrade to Jenkins Git plugin 2.1.0 and Jenkins Git client plugin 1.7.0 solved my issues (mentioned above).
          Thanx !

          Dejan Stojadinović added a comment - markewaite Sorry for the late reply; just to confirm that upgrade to Jenkins Git plugin 2.1.0 and Jenkins Git client plugin 1.7.0 solved my issues (mentioned above). Thanx !

            ndeloof Nicolas De Loof
            paux Stephan Pauxberger
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: