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

When the pre-build merge option is used, build record indicates incorrect commit ID

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • git-plugin
    • None

      When the said option is used, the BuildData object associated with the build incorrectly indicates a commit before a merge, not the commit as a result of the merge, which was actually built.

          [JENKINS-10764] When the pre-build merge option is used, build record indicates incorrect commit ID

          Example log indicating the problem. In this log, 01f4f7b55b5c60160e1c45f1dacb84bb5324f159 is chosen for the revision to build, then it get smerged with 01f4f7b55b5c60160e1c45f1dacb84bb5324f159 because of the pre-build merge option, and the merge produced a0e1a0913ace04a5ae96f8b7721ea70ed5b560dd.

          In this case, BuildData should record a0e1a0913ace04a5ae96f8b7721ea70ed5b560dd, not 01f4f7b55b5c60160e1c45f1dacb84bb5324f159.

          Started by user anonymous
          Checkout:workspace / /home/kohsuke/ws/experiments/jenkins-as-git-gate-keeper/demo/jobs/gate-keeper-build/workspace - hudson.remoting.LocalChannel@2a4e37fb
          Using strategy: Default
          Last Built Revision: Revision 01f4f7b55b5c60160e1c45f1dacb84bb5324f159 (gate/HEAD, gate/master)
          Checkout:workspace / /home/kohsuke/ws/experiments/jenkins-as-git-gate-keeper/demo/jobs/gate-keeper-build/workspace - hudson.remoting.LocalChannel@2a4e37fb
          Fetching changes from [org.eclipse.jgit.transport.RemoteConfig@257b3135, org.eclipse.jgit.transport.RemoteConfig@3adba1cc] remote Git repositories
          Fetching upstream changes from /home/kohsuke/ws/experiments/jenkins-as-git-gate-keeper/gate.git
          Fetching upstream changes from /home/kohsuke/ws/experiments/jenkins-as-git-gate-keeper/master.git
          Seen branch in repository gate/HEAD
          Seen branch in repository gate/master
          Seen branch in repository master/master
          Seen branch in repository origin/master
          Commencing build of Revision 01f4f7b55b5c60160e1c45f1dacb84bb5324f159 (gate/HEAD, gate/master)
          Merging Revision 01f4f7b55b5c60160e1c45f1dacb84bb5324f159 (gate/HEAD, gate/master) onto master
          Warning : There are multiple branch changesets here
          Seen branch in repository gate/HEAD
          Seen branch in repository gate/master
          Seen branch in repository master/master
          Seen branch in repository origin/master
          [workspace] $ /bin/sh -xe /tmp/hudson8934214270600662692.sh
          + git rev-parse HEAD
          a0e1a0913ace04a5ae96f8b7721ea70ed5b560dd
          + ls -la
          total 16
          drwxr-xr-x 3 kohsuke kohsuke 4096 2011-08-18 18:09 .
          drwxr-xr-x 4 kohsuke kohsuke 4096 2011-08-18 19:37 ..
          -rw-r--r-- 1 kohsuke kohsuke    0 2011-08-18 18:03 a
          -rw-r--r-- 1 kohsuke kohsuke    0 2011-08-18 18:09 b
          drwxr-xr-x 8 kohsuke kohsuke 4096 2011-08-18 19:37 .git
          -rwxr-xr-x 1 kohsuke kohsuke   96 2011-08-18 18:00 test.sh
          -rw-r--r-- 1 kohsuke kohsuke    0 2011-08-18 18:09 x
          + echo gate/HEAD
          gate/HEAD
          Pushing result jenkins-gate-keeper-build-7-SUCCESS to master branch of origin repository
          Pushing HEAD to branch master at repo origin
          Finished: SUCCESS
          

          Kohsuke Kawaguchi added a comment - Example log indicating the problem. In this log, 01f4f7b55b5c60160e1c45f1dacb84bb5324f159 is chosen for the revision to build, then it get smerged with 01f4f7b55b5c60160e1c45f1dacb84bb5324f159 because of the pre-build merge option, and the merge produced a0e1a0913ace04a5ae96f8b7721ea70ed5b560dd. In this case, BuildData should record a0e1a0913ace04a5ae96f8b7721ea70ed5b560dd, not 01f4f7b55b5c60160e1c45f1dacb84bb5324f159. Started by user anonymous Checkout:workspace / /home/kohsuke/ws/experiments/jenkins-as-git-gate-keeper/demo/jobs/gate-keeper-build/workspace - hudson.remoting.LocalChannel@2a4e37fb Using strategy: Default Last Built Revision: Revision 01f4f7b55b5c60160e1c45f1dacb84bb5324f159 (gate/HEAD, gate/master) Checkout:workspace / /home/kohsuke/ws/experiments/jenkins-as-git-gate-keeper/demo/jobs/gate-keeper-build/workspace - hudson.remoting.LocalChannel@2a4e37fb Fetching changes from [org.eclipse.jgit.transport.RemoteConfig@257b3135, org.eclipse.jgit.transport.RemoteConfig@3adba1cc] remote Git repositories Fetching upstream changes from /home/kohsuke/ws/experiments/jenkins-as-git-gate-keeper/gate.git Fetching upstream changes from /home/kohsuke/ws/experiments/jenkins-as-git-gate-keeper/master.git Seen branch in repository gate/HEAD Seen branch in repository gate/master Seen branch in repository master/master Seen branch in repository origin/master Commencing build of Revision 01f4f7b55b5c60160e1c45f1dacb84bb5324f159 (gate/HEAD, gate/master) Merging Revision 01f4f7b55b5c60160e1c45f1dacb84bb5324f159 (gate/HEAD, gate/master) onto master Warning : There are multiple branch changesets here Seen branch in repository gate/HEAD Seen branch in repository gate/master Seen branch in repository master/master Seen branch in repository origin/master [workspace] $ /bin/sh -xe /tmp/hudson8934214270600662692.sh + git rev-parse HEAD a0e1a0913ace04a5ae96f8b7721ea70ed5b560dd + ls -la total 16 drwxr-xr-x 3 kohsuke kohsuke 4096 2011-08-18 18:09 . drwxr-xr-x 4 kohsuke kohsuke 4096 2011-08-18 19:37 .. -rw-r--r-- 1 kohsuke kohsuke 0 2011-08-18 18:03 a -rw-r--r-- 1 kohsuke kohsuke 0 2011-08-18 18:09 b drwxr-xr-x 8 kohsuke kohsuke 4096 2011-08-18 19:37 .git -rwxr-xr-x 1 kohsuke kohsuke 96 2011-08-18 18:00 test.sh -rw-r--r-- 1 kohsuke kohsuke 0 2011-08-18 18:09 x + echo gate/HEAD gate/HEAD Pushing result jenkins-gate-keeper-build-7-SUCCESS to master branch of origin repository Pushing HEAD to branch master at repo origin Finished: SUCCESS

          kingargyle added a comment -

          I'm seeing this issue as well. What we are trying to do is this.

          1. merge a branch of origin onto master from a central repository.

          So basically, checkout the central master, and then merge the origin repo onto it in the workspace. If there are build failures we expect things to fail.

          We are seeing the issue described here, as it always appears to be merging the last build revision and not the branch specified in the branch to build setting.

          kingargyle added a comment - I'm seeing this issue as well. What we are trying to do is this. 1. merge a branch of origin onto master from a central repository. So basically, checkout the central master, and then merge the origin repo onto it in the workspace. If there are build failures we expect things to fail. We are seeing the issue described here, as it always appears to be merging the last build revision and not the branch specified in the branch to build setting.

            Unassigned Unassigned
            kohsuke Kohsuke Kawaguchi
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: