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

          Mark Espiritu created issue -

          Mark Espiritu added a comment -

          Not sure if related to JENKINS-19569.

          Mark Espiritu added a comment - Not sure if related to JENKINS-19569 .

          Lan Wu added a comment -

          This is broken for us too when we upgraded from Git 1.4 to 2.0. I think it's related to this fix:
          https://issues.jenkins-ci.org/browse/JENKINS-7411

          Our parameterized build was working fine before.

          We had to go back to 1.4 to make things work.

          I'd suggest that this is not a minor bug, should be much higher.

          Lan Wu added a comment - This is broken for us too when we upgraded from Git 1.4 to 2.0. I think it's related to this fix: https://issues.jenkins-ci.org/browse/JENKINS-7411 Our parameterized build was working fine before. We had to go back to 1.4 to make things work. I'd suggest that this is not a minor bug, should be much higher.

          Mark Waite added a comment -

          Based on the testing of JENKINS-20969, this is fixed in git-client-plugin 1.6.2 and git-plugin 2.0.1

          Mark Waite added a comment - Based on the testing of JENKINS-20969 , this is fixed in git-client-plugin 1.6.2 and git-plugin 2.0.1
          Mark Waite made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]

          Maciej Matys added a comment - - edited

          It still doesn't work if you specify ** or leave blank job ${branch} parameter

          Maciej Matys added a comment - - edited It still doesn't work if you specify ** or leave blank job ${branch} parameter

          Mark Waite added a comment -

          I'll need more information about your configuration (upload a copy of the job definition) and a copy of the git polling log in order to understand why it doesn't work in your case and does work in other cases. Can you upload that information?

          Mark Waite added a comment - I'll need more information about your configuration (upload a copy of the job definition) and a copy of the git polling log in order to understand why it doesn't work in your case and does work in other cases. Can you upload that information?

          Maciej Matys added a comment - - edited

          Mark,
          No problem I can upload my config tell me how do it and from where get it, generally speaking it like JENKINS-20969 I have a build parameter (string parameter) - branch name to build , which is passed to the git "Branches to build" setting. When this parameter is set to *, **, or is empty, the code checkout in last build gets built again and again instead of an updated branches. I have a trigger to poll scm.
          What I want from this job is to monitor changes in all branches and also to be run against specified branch defined by build parameter manually. Moreover then this job is trigged by upstream job or manually with branch to build parameter set to * or ** or left blank I want to rebuild all branches.

          Maciej Matys added a comment - - edited Mark, No problem I can upload my config tell me how do it and from where get it, generally speaking it like JENKINS-20969 I have a build parameter (string parameter) - branch name to build , which is passed to the git "Branches to build" setting. When this parameter is set to *, **, or is empty, the code checkout in last build gets built again and again instead of an updated branches. I have a trigger to poll scm. What I want from this job is to monitor changes in all branches and also to be run against specified branch defined by build parameter manually. Moreover then this job is trigged by upstream job or manually with branch to build parameter set to * or ** or left blank I want to rebuild all branches.

          Mark Waite added a comment -

          The config file can be downloaded to your web browser by appending /config.xml to the end of the URL of your Jenkins job. For example, I have a job named "git-client-plugin-multi". I download the job configuration file from http://localhost:8080/git-client-plugin-multi/config.xml . Once you've downloaded, then you can use the "More Actions" -> "Attach Files" operation on the bug report to attach a file.

          I believe the bug that a branch name parameter is not correctly handled by polling has already been reported, and is not yet fixed.

          I believe that your intended use model will mostly work, except for the assumption that if the build parameter is the wild card it should rebuild all branches. I think that there is no way with the git plugin to force multiple builds of unchanged branches if they've been built before. I may be wrong on that, but I've not found a way to force a rebuild of all branches when the branches had not changed since the last time they were built.

          Mark Waite added a comment - The config file can be downloaded to your web browser by appending /config.xml to the end of the URL of your Jenkins job. For example, I have a job named "git-client-plugin-multi". I download the job configuration file from http://localhost:8080/git-client-plugin-multi/config.xml . Once you've downloaded, then you can use the "More Actions" -> "Attach Files" operation on the bug report to attach a file. I believe the bug that a branch name parameter is not correctly handled by polling has already been reported, and is not yet fixed. I believe that your intended use model will mostly work, except for the assumption that if the build parameter is the wild card it should rebuild all branches. I think that there is no way with the git plugin to force multiple builds of unchanged branches if they've been built before. I may be wrong on that, but I've not found a way to force a rebuild of all branches when the branches had not changed since the last time they were built.

          Jason Miller added a comment -

          I don't think this is fixed, or else there's been a regression (Jenkins 1.565).

          If I have a simple build that uses a BRANCH parameter that defaults to 'master', it will always trigger when notified to look for changes by Stash (via the /git/notifyCommit api), even if there's no changes.

          Git polling log looks like this:

          Started on Jun 23, 2014 2:01:35 PM
          Using strategy: Default
          [poll] Last Built Revision: Revision f22fe57691485df88098480c2e56c4e51a68ad67 (origin/master)
          using GIT_SSH to set credentials 
           > git ls-remote -h ssh://git@stash.domain.com/project/repository.git ${BRANCH}
          Done. Took 0.45 sec
          Changes found
          

          We're not using wildcards, it's just a simple string parameter with a default setting.

          Versions:
          Jenkins 1.565
          Git client plugin 1.9.1
          Git plugin 2.2.1

          Jason Miller added a comment - I don't think this is fixed, or else there's been a regression (Jenkins 1.565). If I have a simple build that uses a BRANCH parameter that defaults to 'master', it will always trigger when notified to look for changes by Stash (via the /git/notifyCommit api), even if there's no changes. Git polling log looks like this: Started on Jun 23, 2014 2:01:35 PM Using strategy: Default [poll] Last Built Revision: Revision f22fe57691485df88098480c2e56c4e51a68ad67 (origin/master) using GIT_SSH to set credentials > git ls-remote -h ssh://git@stash.domain.com/project/repository.git ${BRANCH} Done. Took 0.45 sec Changes found We're not using wildcards, it's just a simple string parameter with a default setting. Versions: Jenkins 1.565 Git client plugin 1.9.1 Git plugin 2.2.1

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

              Created:
              Updated: