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

Git plugin 2.0 JGit implementation does not publish merge result

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • None
    • Jenkins 1.509.4, Git plugin 2.0, Git client plugin 1.4.6, Debian Linux 7.2 ("Wheezy"), JDK 1.7.0u45 x64

      If I use the jgit implementation in a job which should merge from multiple branches, the merge result is not pushed back to origin. Merge result is pushed if I use the command line implementation in the same job.

      Steps to duplicate the problem (with apologies for the number of steps)

      1. Create a bare git repo on the master node as Jenkins user
        1. rm -rf /tmp/changes.git /tmp/changes
        2. git init --bare /tmp/changes.git
        3. echo "#! /bin/sh" > /tmp/changes.git/hooks/post-receive
        4. echo "curl --silent http://127.0.0.1:8080/git/notifyCommit?url=/tmp/changes.git" >> /tmp/changes.git/hooks/post-receive
        5. chmod a+x /tmp/changes.git/hooks/post-receive
        6. cd /tmp
        7. git clone changes.git
        8. cd changes
        9. echo "Git plugin 2.0 no longer shows changes from merges" > README
        10. git add README
        11. git commit -m "Add README to describe this repository" README
        12. git push origin master
      2. Create a Jenkins merge job using that bare git repo
        1. Create a new free-style software project "merge-changes"
        2. Restrict where this project can be run
          1. Label Expression: master
        3. Git source code management settings
          1. Use jgit rather than default
          2. Repository URL: /tmp/changes.git
          3. Branches to build: */master*
        4. Additional behaviors: Merge before build
          1. Name of repository: origin
            1. (error on merge if this is blank - help says should use default, but didn't)
          2. Branch to merge to: master
        5. Poll SCM (for convenience with the git hook installed earlier)
          1. H * * * *
        6. Add post-build action: Git Publisher
          1. Git Publisher settings
            1. Merge results: Yes
            2. Branches:
              1. Branches to push: master
              2. Target remote name: origin
        7. Save the job
      3. Build Jenkins job
        1. curl --silent http://127.0.0.1:8080/job/merge-changes/build?delay=0sec
      4. Create new master-add-timestamp branch and commit from it
        1. git checkout -b master-add-timestamp
        2. date >> timestamp
        3. git add timestamp
        4. git commit -m "Add timestamp" timestamp
        5. git push origin master-add-timestamp
      5. Jenkins job runs
      6. Confirm master branch did not receive the merge result
        1. git checkout master
        2. git pull
        3. git log

            Unassigned Unassigned
            markewaite Mark Waite
            Votes:
            3 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: