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

Unable to automatically discover and build git tags with Jenkins multibranch pipelines and the Git Plugin

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • git-plugin
    • None
    • * Jenkins v2.141
      * Basic Branch Build Strategies Plugin v1.0.1
      * Git plugin v3.9.1
      * Bitbucket Server v5.13.1
      * Webhook to Jenkins for Bitbucket Server v4.4.4
      * Windows Server 2012 R2

      I configured a multibranch pipeline job to discover and build branches and tags for my git repository hosted in Bitbucket Server. New branches and commits are discovered and built correctly but new tags remain undiscovered. I can force tag discovery if I initiate a manual scan in Jenkins or I click "Trigger Jenkins" in the Webhook to Jenkins for Bitbucket Server UI for my repository.

       

      My Jenkins Configuration

      My Webhook to Jenkins for Bitbucket Server Configuration

       

      Originally, I wanted to use the Bitbucket Branch Source Plugin rather than the Git Plugin but in that case JENKINS-51063 prevents tag discovery and build. Is there a similar issue with the Git Plugin?

          [JENKINS-53432] Unable to automatically discover and build git tags with Jenkins multibranch pipelines and the Git Plugin

          Mark Waite added a comment - - edited

          I believe this is already available if you install the Basic Branch Build Strategies Plugin as described in a jenkins.io blog post and in "Notes from the Lifeboat"

          Mark Waite added a comment - - edited I believe this is already available if you install the Basic Branch Build Strategies Plugin as described in a jenkins.io blog post and in " Notes from the Lifeboat "

          Ryan Taylor added a comment -

          I have the Basic Branch Build Strategies Plugin installed, and set it to discover tags, but it tags remain undiscovered. The mentioned post is using the Git*hub* Plugin, not the Git plugin. I have a support request out to Mohami (creators of the Webhook to Jenkins for Bitbucket Server) and they indicated it is an issue in the Git Plugin.

          I looked through git plugin source and unfortunately it has same issue [as JENKINS-51063]
          https://github.com/jenkinsci/git-plugin/blob/master/src/main/java/jenkins/plugins/git/GitSCMSource.java#L628
          it incorrectly creates instance GitBranchSCMHead for tags when fires SCMHeadEvent (this is event is used by MultiBranch pipelines to trigger jobs - Freestyle jobs have another invocation procedure). So I don't think it's possible to trigger new tags this way

          I'm not familiar enough with the plugin to make this assessment however.

          Ryan Taylor added a comment - I have the Basic Branch Build Strategies Plugin installed, and set it to discover tags, but it tags remain undiscovered. The mentioned post is using the Git*hub* Plugin, not the Git plugin. I have a support request out to Mohami (creators of the Webhook to Jenkins for Bitbucket Server) and they indicated it is an issue in the Git Plugin. I looked through git plugin source and unfortunately it has same issue [as JENKINS-51063] https://github.com/jenkinsci/git-plugin/blob/master/src/main/java/jenkins/plugins/git/GitSCMSource.java#L628 it incorrectly creates instance GitBranchSCMHead for tags when fires SCMHeadEvent (this is event is used by MultiBranch pipelines to trigger jobs - Freestyle jobs have another invocation procedure) . So I don't think it's possible to trigger new tags this way I'm not familiar enough with the plugin to make this assessment however.

          Mark Waite added a comment -

          Refer to JENKINS-47496 for more details on building tags with multibranch.

          Mark Waite added a comment - Refer to JENKINS-47496 for more details on building tags with multibranch.

          John Mellor added a comment -

          With the latest set of updates, multibranch is discovering all branches like it should, but skipping all builds not manually triggered.  Critical issue.

          John Mellor added a comment - With the latest set of updates, multibranch is discovering all branches like it should, but skipping all builds not manually triggered.  Critical issue.

          Mark Waite added a comment -

          alt_jmellor you should probably open a separate bug report that describes how to duplicate the problem you mentioned as:

          With the latest set of updates, multibranch is discovering all branches like it should, but skipping all builds not manually triggered. Critical issue.

          If the only mention of a critical issue is in a comment on another bug report, it is much less likely to receive attention.

          Mark Waite added a comment - alt_jmellor you should probably open a separate bug report that describes how to duplicate the problem you mentioned as: With the latest set of updates, multibranch is discovering all branches like it should, but skipping all builds not manually triggered. Critical issue. If the only mention of a critical issue is in a comment on another bug report, it is much less likely to receive attention.

          Lars Niestrad added a comment - - edited

          I got the same problem as iamrewt with the exact same setup. Jenkins does not discover the tags automatically received by the Bitbucket hook. I always have to do a manual or scheduled rescan of the whole multibranch pipeline in order to discover them. I also have the Basic Branch Build Strategies Plugin installed and properly configured. As Ryan already stated it seems there is an issue in the git plugin regarding how it handles the information about a new tag sent by the hook.

          Lars Niestrad added a comment - - edited I got the same problem as iamrewt with the exact same setup. Jenkins does not discover the tags automatically received by the Bitbucket hook. I always have to do a manual or scheduled rescan of the whole multibranch pipeline in order to discover them. I also have the Basic Branch Build Strategies Plugin installed and properly configured. As Ryan already stated it seems there is an issue in the git plugin regarding how it handles the information about a new tag sent by the hook.

          Amit Dar added a comment -

          any update regarding this issue?

          we are using gitlab branch source plugin, and tag is discovered but build is not activate. we are using the remote file plugin...

           

          Amit Dar added a comment - any update regarding this issue? we are using gitlab branch source plugin, and tag is discovered but build is not activate. we are using the remote file plugin...  

          Mark Waite added a comment -

          amidar no update. Pull requests are certainly welcomed with tests that show the problem and then implement a fix for the problem.

          Mark Waite added a comment - amidar no update. Pull requests are certainly welcomed with tests that show the problem and then implement a fix for the problem.

          Any new on this or workaround? It's really an stopper to use Bitbucket plugin for Jenkins... Thanks in advance

          Emilio González Montaña added a comment - Any new on this or workaround? It's really an stopper to use Bitbucket plugin for Jenkins... Thanks in advance

          Jesse added a comment -

          I just discovered this issue as well.  Bitbucket is sending a webhook when tags are created on a repository that has a multibranch pipeline in jenkins, however a scan is not getting triggered on the multibranch pipeline.

          When a code commit is pushed to the Bitbucket repository, the same webhook is fired to jenkins and the multibranch pipeline scans and builds as expected.

          In the multibranch pipeline events log, I see that Jenkins received the hook and it even says it processed # tags, however the multibranch pipeline does not list the new tags in the tags tab.  If i run a manual scan of the multibranch pipeline from jenkins then it will update the list of tags.

          Jesse added a comment - I just discovered this issue as well.  Bitbucket is sending a webhook when tags are created on a repository that has a multibranch pipeline in jenkins, however a scan is not getting triggered on the multibranch pipeline. When a code commit is pushed to the Bitbucket repository, the same webhook is fired to jenkins and the multibranch pipeline scans and builds as expected. In the multibranch pipeline events log, I see that Jenkins received the hook and it even says it processed # tags, however the multibranch pipeline does not list the new tags in the tags tab.  If i run a manual scan of the multibranch pipeline from jenkins then it will update the list of tags.

            Unassigned Unassigned
            iamrewt Ryan Taylor
            Votes:
            7 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated: