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

Build Parameter variable in branch name causes polling to detect false changes in GIT

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • git-plugin
    • None
    • Jenkins 1.537
      Jenkins GIT Plugin 2.0
      Jenkins Multiple SCM Plugin 0.2

      Create a Job with a parameter:
      branch

      In GIT configuration set branch to:
      ${branch}
      or
      */${branch}

      This causes polling to keep detecting changes, even when there are none.

      Everything is fine when I hardcode branch name like so:
      */master

          [JENKINS-20427] Build Parameter variable in branch name causes polling to detect false changes in GIT

          So, I'm updating the Jenkins config like this:
          http://imgur.com/0H945kK

          The polling log before the change (extracted from a build, so ends with "changes found", but doesn't have to):
          http://pastebin.com/3Mv3HUQd

          The polling log after the change:
          http://pastebin.com/igztfdwu
          ...and then it starts to rebuild the same branch 495 it has just built before (not 1205).

          So, apparently, the behavior is very different depending on whether you specify BranchSpec directly as "*" or via a variable that should have the value of "*"

          Konstantin Yegupov added a comment - So, I'm updating the Jenkins config like this: http://imgur.com/0H945kK The polling log before the change (extracted from a build, so ends with "changes found", but doesn't have to): http://pastebin.com/3Mv3HUQd The polling log after the change: http://pastebin.com/igztfdwu ...and then it starts to rebuild the same branch 495 it has just built before (not 1205). So, apparently, the behavior is very different depending on whether you specify BranchSpec directly as "* " or via a variable that should have the value of " *"

          (bold unintended, should have been double asterisks)

          Konstantin Yegupov added a comment - (bold unintended, should have been double asterisks)

          @Nicolas De Loof Any updates on this? This is is a major issue for us as sometimes builds fail because of network issue and when we try to rerun, the job picks up some random branch!

          Puneeth Nanjundaswamy added a comment - @Nicolas De Loof Any updates on this? This is is a major issue for us as sometimes builds fail because of network issue and when we try to rerun, the job picks up some random branch!

          Mark Waite added a comment -

          puneeth_n, ndeloof is no longer a maintainer of the git plugin. I was unable to duplicate the problem in my most recent attempt. Can you provide step by step instructions which show the failure on an "out of the box" Jenkins installation? Even better is to provide those step by step instructions and a docker image (like a bug verification job as a pull request to my lts-with-plugins docker instance).

          Every time I need to guess what a user is doing it is more time that I could have spent helping in other ways (like fixing other bugs, reviewing proposals, etc.)

          Mark Waite added a comment - puneeth_n , ndeloof is no longer a maintainer of the git plugin. I was unable to duplicate the problem in my most recent attempt. Can you provide step by step instructions which show the failure on an "out of the box" Jenkins installation? Even better is to provide those step by step instructions and a docker image (like a bug verification job as a pull request to my lts-with-plugins docker instance ). Every time I need to guess what a user is doing it is more time that I could have spent helping in other ways (like fixing other bugs, reviewing proposals, etc.)

          markewaite Thanks for the response. I have created a seperate JIRA ticket with all details. Here is the link: https://issues.jenkins-ci.org/browse/JENKINS-38406

          Let me know in case of more info

          Puneeth Nanjundaswamy added a comment - markewaite Thanks for the response. I have created a seperate JIRA ticket with all details. Here is the link: https://issues.jenkins-ci.org/browse/JENKINS-38406 Let me know in case of more info

          Stephen Rufle added a comment -

          I have seen this same issue with the TFS plugin used in Jenkins Multiple SCM plugin 0.5

          Stephen Rufle added a comment - I have seen this same issue with the TFS plugin used in Jenkins Multiple SCM plugin 0.5

          Alex Taylor added a comment -

          markewaite- I was finally able to reproduce this issue 100% if you have access to bitbucket.

          1. Have Bitbucket repository with at least 10 branches

          2. Create a freestyle job and configure it to use the git plugin but connect to a Bitbucket repository at `$BITBUCKET_URL/git/$PROJECT/$REPO.git`

          3. Add a parameter called BRANCH and has the default value of **

          4. Use that parameter in the `Branches to build` section

          5. Add a poll for changes of `* * * * *` so that it will build every minute

          6. Add a shell step of something like "echo hello"

          7. Run one build

           

          This will then launch a new build for every branch and then once that is done you will see it build every minute seeing changes.

           

          Let me know if that does not work for you because it has worked 2x for me so far.

          Alex Taylor added a comment - markewaite - I was finally able to reproduce this issue 100% if you have access to bitbucket. 1. Have Bitbucket repository with at least 10 branches 2. Create a freestyle job and configure it to use the git plugin but connect to a Bitbucket repository at `$BITBUCKET_URL/git/$PROJECT/$REPO.git` 3. Add a parameter called BRANCH and has the default value of ** 4. Use that parameter in the `Branches to build` section 5. Add a poll for changes of `* * * * *` so that it will build every minute 6. Add a shell step of something like "echo hello" 7. Run one build   This will then launch a new build for every branch and then once that is done you will see it build every minute seeing changes.   Let me know if that does not work for you because it has worked 2x for me so far.

          Alex Taylor added a comment -

          See my last comment since I think it is still an issue

          Alex Taylor added a comment - See my last comment since I think it is still an issue

          This is a major issue for people using a cloud build and has been open since 2013.

           

          Is it not possible to use the same solution for polling without wild cards as it is with wild cards?

          Michael Krussel added a comment - This is a major issue for people using a cloud build and has been open since 2013.   Is it not possible to use the same solution for polling without wild cards as it is with wild cards?

          Mark Waite added a comment -

          mkrussel it is not possible to use the same solution without wild cards as with wild cards as far as I know. Pull requests with automated tests that show the problem and include a fix are certainly welcomed.

          Mark Waite added a comment - mkrussel it is not possible to use the same solution without wild cards as with wild cards as far as I know. Pull requests with automated tests that show the problem and include a fix are certainly welcomed.

            Unassigned Unassigned
            m_a_r_k_y Mark Espiritu
            Votes:
            12 Vote for this issue
            Watchers:
            25 Start watching this issue

              Created:
              Updated: