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

No automatic builds for tags

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Minor
    • Resolution: Not A Defect
    • Labels:
      None
    • Environment:
      Jenkins 2.73.2, Git Plugin 3.6.0, Pipeline: Multibranch 2.16
    • Similar Issues:

      Description

      After upgrading to the Git Plugin 3.6.0 I activated the "Discover Tags" option in a Multibranch Pipeline Job. The tag is also discovered as expected, but no build is triggered.

       

      Checking tags... 
      Checking tag PNR-12345 
      ‘Jenkinsfile’ found 
      Met criteria 
      Changes detected: PNR-12345 (null → d56c6578f5f04403f4bd64bf2647f3dd0f36e826) 
      No automatic builds for PNR-12345
       Processed 1 tags
      

      I expected that a new build is triggered, when a new tag is found. How to achieve this?

       

        Attachments

          Issue Links

            Activity

            Hide
            gnomeza Mark F added a comment -

            Here is the workaround to add tag discovery for multibranch pipelines in JobDSL:

             multibranchPipelineJob('my_repo') {
                branchSources { branchSource { source { git {
                        remote(git_url)
                        credentialsId('my_credential_id')
                        traits {
                            gitBranchDiscovery()
                            gitTagDiscovery()  // be careful you don't create a build storm!
                            headWildcardFilter {
                                includes('my_branch1 my_branches* my_tags* )
                                excludes('')
                            }
                        }
                } } } }
                ...
            }
            
            Show
            gnomeza Mark F added a comment - Here is the workaround to add tag discovery for multibranch pipelines in JobDSL: multibranchPipelineJob( 'my_repo' ) { branchSources { branchSource { source { git { remote(git_url) credentialsId( 'my_credential_id' ) traits { gitBranchDiscovery() gitTagDiscovery() // be careful you don't create a build storm! headWildcardFilter { includes('my_branch1 my_branches* my_tags* ) excludes('') } } } } } } ... }
            Hide
            jayache80 Jay Ache added a comment - - edited

            I found that adding a Basic Branch Build Strategy to automatically build tags interfered with the rest of the multibranch pipeline builds automatically triggered by GitHub. They were working fine, then I added a Basic Branch Build Strategy to automatically build a tag, added a new tag, the new tag was automatically discovered and it attempted to build it (but failed with a NullPtrException; I had to manually schedule the tag build again before it successfully built, but that's an unrelated issue, probably because of this: https://issues.jenkins-ci.org/browse/JENKINS-50715). However, subsequent pushes to branches didn't re-trigger builds as expected. Simply removing the Basic Branch Build Strategy fixed it, and builds/pull-requests were again automatically built whenever pushes happened.

             

            I'll try Mark F's JobDSL workaround next.

            Show
            jayache80 Jay Ache added a comment - - edited I found that adding a Basic Branch Build Strategy to automatically build tags interfered with the rest of the multibranch pipeline builds automatically triggered by GitHub. They were working fine, then I added a Basic Branch Build Strategy to automatically build a tag, added a new tag, the new tag was automatically discovered and it attempted to build it (but failed with a NullPtrException; I had to manually schedule the tag build again before it successfully built, but that's an unrelated issue, probably because of this: https://issues.jenkins-ci.org/browse/JENKINS-50715 ). However, subsequent pushes to branches didn't re-trigger builds as expected. Simply removing the Basic Branch Build Strategy fixed it, and builds/pull-requests were again automatically built whenever pushes happened.   I'll try Mark F's JobDSL workaround next.
            Hide
            ss_vinoth22 vinoth SS added a comment -

            I found some issue on Build strategy plugin for tags, 

            if i specify Ignore tags newer than to 1 days, no automated builds are triggering, if i specify only 7 days builds are triggering, can we have that restriction to 1 day as well. so that automated builds will trigger only for tags which created less than 1 day.

             

            Show
            ss_vinoth22 vinoth SS added a comment - I found some issue on Build strategy plugin for tags,  if i specify Ignore tags newer than to 1 days, no automated builds are triggering, if i specify only 7 days builds are triggering, can we have that restriction to 1 day as well. so that automated builds will trigger only for tags which created less than 1 day.  
            Hide
            bitwiseman Liam Newman added a comment -

            vinoth SS
            Please open a new JIRA for that.

            Show
            bitwiseman Liam Newman added a comment - vinoth SS Please open a new JIRA for that.
            Hide
            ss_vinoth22 vinoth SS added a comment -

            Sure, thanks i have opened up the ticket : https://issues.jenkins-ci.org/browse/JENKINS-57772

            Show
            ss_vinoth22 vinoth SS added a comment - Sure, thanks i have opened up the ticket :  https://issues.jenkins-ci.org/browse/JENKINS-57772

              People

              • Assignee:
                markewaite Mark Waite
                Reporter:
                pmr Philipp Moeller
              • Votes:
                0 Vote for this issue
                Watchers:
                10 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: