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

Git Plugin fails to resolve tags containing a slash since 2.0.1

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Fixed
    • git-plugin
    • None

    Description

      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

      Attachments

        Issue Links

          Activity

            paux Stephan Pauxberger created issue -
            markewaite Mark Waite added a comment -

            Could you double check that the other bug you reference is the bug you intended to reference? JENKINS-14206 seems unrelated to the git plugin.

            markewaite Mark Waite added a comment - Could you double check that the other bug you reference is the bug you intended to reference? JENKINS-14206 seems unrelated to the git plugin.
            paux Stephan Pauxberger made changes -
            Field Original Value New Value
            Description Since updating from 2.0.1 to 2.0.3, a job which uses tags containing a slash as "branch" do not work anymore (rel/x.y.z-... in my case)

            Build 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-14206], but the applied fix only works for slash-less tags


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

            Build 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


            Sorry, Typo. Corrected.

            paux Stephan Pauxberger added a comment - Sorry, Typo. Corrected.
            paux Stephan Pauxberger made changes -
            Description Since updating from 2.0.1 to 2.0.3, a job which uses tags containing a slash as "branch" do not work anymore (rel/x.y.z-... in my case)

            Build 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


            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)

            Build 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


            markewaite Mark Waite added a comment -

            Can you describe how the tags are used?

            Are you using the tags as the branch to checkout, or are you applying tags as part of the build process, or something completely different?

            markewaite Mark Waite added a comment - Can you describe how the tags are used? Are you using the tags as the branch to checkout, or are you applying tags as part of the build process, or something completely different?
            paux Stephan Pauxberger made changes -
            Description 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)

            Build 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


            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


            updated the description. I try to check out a deep tag (containing a slash) created by another job.

            paux Stephan Pauxberger added a comment - updated the description. I try to check out a deep tag (containing a slash) created by another job.
            markewaite Mark Waite added a comment -

            Thanks. When you reverted back to git-plugin 2.0.1, did you also revert to an earlier version of git-client-plugin, or did you remain with the current release of git-client-plugin (1.6.3)?

            I ask because I'm concerned that the root of the issue might be in git-client-plugin rather than git-plugin. If you only reverted the git-plugin and that was enough to resolve the issue, then the problem is most likely in the git-plugin, not in git-client-plugin.

            markewaite Mark Waite added a comment - Thanks. When you reverted back to git-plugin 2.0.1, did you also revert to an earlier version of git-client-plugin, or did you remain with the current release of git-client-plugin (1.6.3)? I ask because I'm concerned that the root of the issue might be in git-client-plugin rather than git-plugin. If you only reverted the git-plugin and that was enough to resolve the issue, then the problem is most likely in the git-plugin, not in git-client-plugin.

            I did only revert git-plugin, git-client-plugin is current version.

            paux Stephan Pauxberger added a comment - I did only revert git-plugin, git-client-plugin is current version.
            paux 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.

            paux 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.
            paux Stephan Pauxberger added a comment - Created Pull Request 205 ( https://github.com/jenkinsci/git-plugin/pull/205 ).
            markewaite Mark Waite made changes -
            Link This issue is duplicated by JENKINS-21978 [ JENKINS-21978 ]

            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).

            dejan2609 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 ).
            markewaite 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?
            markewaite 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.

            dejan2609 Dejan Stojadinović added a comment - Thanx for a quick response, markewaite ; I'll provide in-detail answers in day or two.
            penguin_brian Brian May made changes -
            Link This issue is duplicated by JENKINS-22186 [ JENKINS-22186 ]

            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_issue_link 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_issue_link 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
            markewaite Mark Waite added a comment -

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

            markewaite Mark Waite added a comment - Fix should be visible in the next git-plugin after 2.0.4
            markewaite Mark Waite made changes -
            Resolution Fixed [ 1 ]
            Status Open [ 1 ] Resolved [ 5 ]
            markewaite Mark Waite added a comment -

            Fixed in git-plugin 2.1.0

            markewaite Mark Waite added a comment - Fixed in git-plugin 2.1.0
            markewaite Mark Waite made changes -
            Status Resolved [ 5 ] Closed [ 6 ]

            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 !

            dejan2609 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 !
            rtyler R. Tyler Croy made changes -
            Workflow JNJira [ 154029 ] JNJira + In-Review [ 207451 ]

            People

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

              Dates

                Created:
                Updated:
                Resolved: