• Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • git-plugin
    • git-client 1.2.0
      git 1.5.0

      Git polling depends on ‘last built’ revision. If the Jenkins job is triggered manually on different branch (detached head), the polling may result in No changes.

      WE have a Job which polls for changes every 5 mins. The branch is mentioned using a Parametrized plugin. Like,

      String parameter:
      name: GIT_COMMIT_TAG
      default: master

      The polling works fine. But when I run the job manually and set GIT_COMMIT_TAG to different value (which is detached head) the subsequent polling says "No changes" to build. The polling log says,

      Started on Feb 25, 2014 12:00:20 AM
      Using strategy: Default
      [poll] Last Built Revision: Revision 48c7cfd0bfd024abcf4e93142a78a019db0279aa (detached)
      Fetching changes from the remote Git repositories
      Fetching upstream changes from origin
      Polling for changes in
      Done. Took 1.9 sec
      No changes

      Git polling in this case will only start working after manual trigger of target branch 'master'

          [JENKINS-21980] Git polling fails after detached head

          Mark Waite added a comment -

          As far as I can tell, this is resolved with git plugin 2.4.0 and git client plugin 1.18.0. Steps I took included:

          1. Define new job, JENKINS-21980-polling-parameterized
          2. Job is parameterized with a choice parameter BRANCH_TO_BUILD, allowed values "master", "master-add-file-perm-test", etc.
          3. Git as the version control system, polling once a minute to git://mark-pc1.markwaite.net/git/mwaite/jenkins/git-client-plugin.git/ (a copy of https://github.com/MarkEWaite/git-client-plugin.git)
          4. Branch to build "${BRANCH_TO_BUILD}"
          5. Poll once a minute ("* * * * *" - ignore warning about too frequent polling)
          6. XShell command as job step "git log -n 1" so the branch is visible
          7. Build interactively once using a non-master branch, confirm the non-master is built
          8. Wait for 1 minute and confirm that polling detects master has not been built, and builds it

          Mark Waite added a comment - As far as I can tell, this is resolved with git plugin 2.4.0 and git client plugin 1.18.0. Steps I took included: Define new job, JENKINS-21980 -polling-parameterized Job is parameterized with a choice parameter BRANCH_TO_BUILD, allowed values "master", "master-add-file-perm-test", etc. Git as the version control system, polling once a minute to git://mark-pc1.markwaite.net/git/mwaite/jenkins/git-client-plugin.git/ (a copy of https://github.com/MarkEWaite/git-client-plugin.git ) Branch to build "${BRANCH_TO_BUILD}" Poll once a minute ("* * * * *" - ignore warning about too frequent polling) XShell command as job step "git log -n 1" so the branch is visible Build interactively once using a non-master branch, confirm the non-master is built Wait for 1 minute and confirm that polling detects master has not been built, and builds it

            markewaite Mark Waite
            dilipm79 Dilip Mahadevappa
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: