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

Jenkins tag based build triggering works inconsistently

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • git-plugin
    • git version 2.1.4
      Jenkins ver. 2.7.4 (docker image)
      Git client plugin 2.0.0
      Git plugin 3.0.0

      Setup:
      Git SCM polling over https once a minute, tag based build triggering.
      Relevant config from DSL:

                  wrappers {
                      timestamps()
                  }
                  scm {
                      git {
                          remote {
                              url("https://gitrepo.com/path")
                            	refspec('+refs/tags/*:refs/remotes/origin/tags/*')
                          }
                          branches('*/tags/*-0.STG', '*/tags/*-1.PRD')
                          extensions {
                              relativeTargetDirectory('git-repo')
                              wipeOutWorkspace()
                              pruneBranches()
                          }
                      }
                  }
                  triggers {
                      /*scm('H/10 * * * *')*/
                      scm('* * * * *')
                  }
                  wrappers {
                      preBuildCleanup() 
                  }
      

      The goal is to build the latest tag that is pushed to git (annotated tags).
      The build should also happen when a tag is pushed that points to a commit that has already been built.

      There is only a master branch.

      This is mostly working okay, but after some tags are pushed that point to the same commit it stops to "notice" changes and polling log says "No changes".
      After that non of the tags that point to that commit trigger a build any more.
      Deleting the tag that point to the commit and that was last built successfully solves the problem and starts to trigger builds again.

      I did the following to reproduce the issue (I waited for the build to start before pushing the next tag):

      git tag -a -m "Testing." 2.0-0.STG "$(git rev-parse HEAD)"; git push --tags
      git tag -a -m "Testing." 2.1-0.STG "$(git rev-parse HEAD)"; git push --tags
      git tag -a -m "Testing." 2.2-0.STG "$(git rev-parse HEAD)"; git push --tags
      git tag -a -m "Testing." 2.3-0.STG "$(git rev-parse HEAD)"; git push --tags
      git tag -a -m "Testing." 2.4-0.STG "$(git rev-parse HEAD)"; git push --tags
      git tag -a -m "Testing." 2.5-0.STG "$(git rev-parse HEAD)"; git push --tags
      

      Builds were triggered from 2.0-0.STG to 2.3-0.STG.
      Then 2.4-0.STG did not trigger the build anymore.

      I'm attaching the poll log outputs for each build that was triggered and the first that was not.

      It is clearly visible that as long as the latest tag is the first in the "Starting with all the branches:" list the build is triggered, as soon as it for some reason isn't the build is not triggered, because it seems that non-tip filtering always selects the one which is the first in the list that points to the same commit.
      So as long as the latest tag is before the tags that have already been built for the same commit non-tip filtering does not remove it and the build is triggered, but as soon as it isn't the build is not triggered any more.

      Maybe the order has something to do with the content of the build.xml of the last build.

      Let me know if you need the content of the build.xml files.

      I would expect the tags to appear in the "Starting with all the branches:" list in reverse chronological order so that the latest tag is always preferred in the non-tip filtering phase.

            jbq jbq
            vpal Viktor Pal
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: