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

Git SCM-polling uses wrong parameter values for a parametrized branchspec

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • git-plugin
    • None
    • git-plugin 2.3.5

    Description

      This is a follow-up to JENKINS-14276. I'm creating this to better track the issues I fixed in my original pull-request [1], which I will update accordingly.

      To reproduce:

      • A parametrized build with parameter BRANCH_TO_BUILD, with default value "branch1"
      • Git SCM with branch specifier "${BRANCH_TO_BUILD}"
      • SCM polling enabled
      • Previous manual job launch with BRANCH_TO_BUILD=branch2

      Expected:

      • When polling, BRANCH_TO_BUILD is set to branch1 (default value), so only updates to branch1 trigger a build.

      Actual:

      • When polling, BRANCH_TO_BUILD is set to branch2 (value from last execution).

      [1] https://github.com/jenkinsci/git-plugin/pull/293

      Attachments

        Issue Links

          Activity

            I updated my original pull-request to fix only this.

            https://github.com/jenkinsci/git-plugin/pull/293

            jblanchard Jean Blanchard added a comment - I updated my original pull-request to fix only this. https://github.com/jenkinsci/git-plugin/pull/293

            Hi Jean

            I had some issues and was wondering about other scenarios that could be affected by this.

            Like if you wanted to build one branch (with polling) and the actual branch parameter used for checking was another branch (like master) so that all changes to master triggered rebuilds..when you just wanted that on a parameterized branch.

            would see as detected changes when there weren't any on the desired branch?

            just wondering.

            -kevin

            knormoyle Kevin Normoyle added a comment - Hi Jean I had some issues and was wondering about other scenarios that could be affected by this. Like if you wanted to build one branch (with polling) and the actual branch parameter used for checking was another branch (like master) so that all changes to master triggered rebuilds..when you just wanted that on a parameterized branch. would see as detected changes when there weren't any on the desired branch? just wondering. -kevin

            Code changed in jenkins
            User: Jean Blanchard
            Path:
            src/main/java/hudson/plugins/git/GitSCM.java
            src/main/java/hudson/plugins/git/util/GitUtils.java
            src/test/java/hudson/plugins/git/GitSCMTest.java
            http://jenkins-ci.org/commit/git-plugin/d56fbee601d5c46d35fc5c05601ead12d66fba10
            Log:
            JENKINS-27349 Polling for parametrized branchspec should resolve to default param values

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jean Blanchard Path: src/main/java/hudson/plugins/git/GitSCM.java src/main/java/hudson/plugins/git/util/GitUtils.java src/test/java/hudson/plugins/git/GitSCMTest.java http://jenkins-ci.org/commit/git-plugin/d56fbee601d5c46d35fc5c05601ead12d66fba10 Log: JENKINS-27349 Polling for parametrized branchspec should resolve to default param values

            Code changed in jenkins
            User: Nicolas De loof
            Path:
            src/main/java/hudson/plugins/git/GitSCM.java
            src/main/java/hudson/plugins/git/util/GitUtils.java
            src/test/java/hudson/plugins/git/GitSCMTest.java
            http://jenkins-ci.org/commit/git-plugin/30766fe249c2512872c52ad96ceab1356510eba2
            Log:
            Merge pull request #293 from jeanblanchard/fix-notify

            JENKINS-27349 Fix polling for parametrized branchspec

            Compare: https://github.com/jenkinsci/git-plugin/compare/7af820e61615...30766fe249c2

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Nicolas De loof Path: src/main/java/hudson/plugins/git/GitSCM.java src/main/java/hudson/plugins/git/util/GitUtils.java src/test/java/hudson/plugins/git/GitSCMTest.java http://jenkins-ci.org/commit/git-plugin/30766fe249c2512872c52ad96ceab1356510eba2 Log: Merge pull request #293 from jeanblanchard/fix-notify JENKINS-27349 Fix polling for parametrized branchspec Compare: https://github.com/jenkinsci/git-plugin/compare/7af820e61615...30766fe249c2
            markewaite Mark Waite added a comment -

            Verified it is working as intended in the 2.3.6 SNAPSHOT build from 6 May 2015. Should be included in the 2.3.6 final build when that is released.

            markewaite Mark Waite added a comment - Verified it is working as intended in the 2.3.6 SNAPSHOT build from 6 May 2015. Should be included in the 2.3.6 final build when that is released.
            markewaite Mark Waite added a comment -

            The git plugin and git client plugin are being tested in hopes of releasing new versions before the end of June. If you're willing to assist with the testing, please download and install a pre-release build of the git client plugin and the git plugin. Problems detected in the pre-release should be e-mailed to MarkEWaite and ndeloof.

            I wrote some test ideas if you would like suggestions of areas that need testing. The git plugin supports many different use cases and its automated tests only evaluate a very few of those use cases.

            markewaite Mark Waite added a comment - The git plugin and git client plugin are being tested in hopes of releasing new versions before the end of June. If you're willing to assist with the testing, please download and install a pre-release build of the git client plugin and the git plugin . Problems detected in the pre-release should be e-mailed to MarkEWaite and ndeloof . I wrote some test ideas if you would like suggestions of areas that need testing. The git plugin supports many different use cases and its automated tests only evaluate a very few of those use cases.
            pmv pmv added a comment -

            Is there any way this pre-release could be updated to include the fix for JENKINS-27352? I installed the pre-release last week, but had to back it out. We're back to running a patched version that includes all of Jean's fixes.

            pmv pmv added a comment - Is there any way this pre-release could be updated to include the fix for JENKINS-27352 ? I installed the pre-release last week, but had to back it out. We're back to running a patched version that includes all of Jean's fixes.
            markewaite Mark Waite added a comment -

            I attempted to apply just the test from the pull request. I needed to resolve some merge conflicts, and still need to more deeply read and understand the code before it can be accepted into the master branch.

            If I provide you a custom build which includes that change and the rest of the current 2.3.6 changes, would you help test it?

            markewaite Mark Waite added a comment - I attempted to apply just the test from the pull request. I needed to resolve some merge conflicts, and still need to more deeply read and understand the code before it can be accepted into the master branch. If I provide you a custom build which includes that change and the rest of the current 2.3.6 changes, would you help test it?
            nicolas_applidium Nicolas Braun added a comment -

            If you provide me directly with the built plugin (don't know how to do it from sources, I admit I never looked at it) I can help test #27352 ans this one

            nicolas_applidium Nicolas Braun added a comment - If you provide me directly with the built plugin (don't know how to do it from sources, I admit I never looked at it) I can help test #27352 ans this one
            markewaite Mark Waite added a comment -

            A build of the git plugin which includes the latest changes of the 2.3.6 pre-release and pull request 309 is available.

            That build does not include pull request 308

            markewaite Mark Waite added a comment - A build of the git plugin which includes the latest changes of the 2.3.6 pre-release and pull request 309 is available. That build does not include pull request 308
            pmv pmv added a comment -

            Thanks Mark. 308 doesn't look too dangerous, but we default our parameter to '**' instead of leaving it blank, so I believe we'll work fine without it. I'll give your new build a try.

            pmv pmv added a comment - Thanks Mark. 308 doesn't look too dangerous, but we default our parameter to '**' instead of leaving it blank, so I believe we'll work fine without it. I'll give your new build a try.
            pmv pmv added a comment -

            So far so good. We do a lot of builds per day, so I consider this tested for our use cases. Our git config across jobs is pretty homogeneous, though, so I can't claim all features of the plugin have been tested (I'm sure there are plenty we don't use). Thanks again for the new build.

            pmv pmv added a comment - So far so good. We do a lot of builds per day, so I consider this tested for our use cases. Our git config across jobs is pretty homogeneous, though, so I can't claim all features of the plugin have been tested (I'm sure there are plenty we don't use). Thanks again for the new build.
            markewaite Mark Waite added a comment -

            Thanks for the test results. Very much appreciated!

            markewaite Mark Waite added a comment - Thanks for the test results. Very much appreciated!
            nicolas_applidium Nicolas Braun added a comment -

            I ran som test too and so far the behavior is correct

            nicolas_applidium Nicolas Braun added a comment - I ran som test too and so far the behavior is correct
            markewaite Mark Waite added a comment -

            I ran some verification tests switching between 2.3.5 (buggy) and the next pre-release. It was well behaved in all the cases I tested.

            0. Create a bare git repository /var/lib/git/mwaite/bugs/JENKINS-27349.git
            0. Commit a master branch to that repository
            0. Commit a branch named "default-branch" to that repository
            1. Create a freestyle job, "JENKINS-27349"
            2. Add string parameter BRANCH_TO_BUILD with "default-branch" as default
            3. Define git repository to use the bare repository
            4. Build the job with BRANCH_TO_BUILD "master"
            1. Confirm the master branch built as expected
            5. Commit a change to the default-branch
            6. Use the "poll now" button to poll the repository for that job
            1. Confirm that the build did not happen even though there was a
            change on default-branch which the poll should have detected (bug)
            7. Configure a post-receive hook on the repository
            8. Commit a change to the default-branch
            1. Confirm that the job polled
            2. Confirm that the poll did not trigger the default-branch even
            though that is the default value (bug)

            markewaite Mark Waite added a comment - I ran some verification tests switching between 2.3.5 (buggy) and the next pre-release. It was well behaved in all the cases I tested. 0. Create a bare git repository /var/lib/git/mwaite/bugs/ JENKINS-27349 .git 0. Commit a master branch to that repository 0. Commit a branch named "default-branch" to that repository 1. Create a freestyle job, " JENKINS-27349 " 2. Add string parameter BRANCH_TO_BUILD with "default-branch" as default 3. Define git repository to use the bare repository 4. Build the job with BRANCH_TO_BUILD "master" 1. Confirm the master branch built as expected 5. Commit a change to the default-branch 6. Use the "poll now" button to poll the repository for that job 1. Confirm that the build did not happen even though there was a change on default-branch which the poll should have detected (bug) 7. Configure a post-receive hook on the repository 8. Commit a change to the default-branch 1. Confirm that the job polled 2. Confirm that the poll did not trigger the default-branch even though that is the default value (bug)

            People

              ndeloof Nicolas De Loof
              jblanchard Jean Blanchard
              Votes:
              2 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: