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

git-plugin should support tags in multibranch pipeline configurations

    Details

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

      Description

      Currently the git plugin doesn't seem to support tags in multi-branch builds.  It looks like this is because the ref prefixes are hard-coded. See: https://github.com/jenkinsci/git-plugin/blob/master/src/main/java/jenkins/plugins/git/AbstractGitSCMSource.java#L417

      This is similar to JENKINS-34395 but for the git plugin.  I'm creating a  separate issue because the causes and the fixes appear to be unrelated.

        Attachments

          Issue Links

            Activity

            Hide
            stephenconnolly Stephen Connolly added a comment -

            The env.TAG_NAME will be non-null when building a tag

            Show
            stephenconnolly Stephen Connolly added a comment - The env.TAG_NAME will be non-null when building a tag
            Hide
            markewaite Mark Waite added a comment -

            Bill Hamilton if you need to determine the list of all tags which point at a specific SHA1, you can use the shell command:

            git tag --points-at HEAD

            The env.TAG_NAME which Stephen Connolly references should be more reliable than the points-at shell trick, since it is set inside the plugins, rather than being guessed from the condition of the repository.

            Show
            markewaite Mark Waite added a comment - Bill Hamilton if you need to determine the list of all tags which point at a specific SHA1, you can use the shell command: git tag --points-at HEAD The env.TAG_NAME which Stephen Connolly references should be more reliable than the points-at shell trick, since it is set inside the plugins, rather than being guessed from the condition of the repository.
            Hide
            hamiltb Bill Hamilton added a comment - - edited

            Stephen Connolly Mark Waite

            env.TAG_NAME doesnt exist in a tag build. I printed out all envars:

            @NonCPS
            def printParams() {
            env.getEnvironment().each { name, value -> println "$name : $value" }
            }
            printParams()

            and TAG_NAME isnt there.

            Show
            hamiltb Bill Hamilton added a comment - - edited Stephen Connolly Mark Waite env.TAG_NAME doesnt exist in a tag build. I printed out all envars: @NonCPS def printParams() { env.getEnvironment().each { name, value -> println "$name : $value" } } printParams() and TAG_NAME isnt there.
            Hide
            stephenconnolly Stephen Connolly added a comment -

            What version of Branch API? TAG_NAME was added in 2.0.11

            Show
            stephenconnolly Stephen Connolly added a comment - What version of Branch API? TAG_NAME was added in 2.0.11
            Hide
            hamiltb Bill Hamilton added a comment -

            Yep, works good now, thanks!

            Show
            hamiltb Bill Hamilton added a comment - Yep, works good now, thanks!

              People

              • Assignee:
                stephenconnolly Stephen Connolly
                Reporter:
                kbrowder Kevin Browder
              • Votes:
                3 Vote for this issue
                Watchers:
                11 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: