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

Should fetch origin/refs even if repository exists in work tree

XMLWordPrintable

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

      Use case: Using git-plugin to run jobs on incoming pull requests, when the git repo exists in working tree, git-plugin fails to merge the branches because of a missing reference to the base branch.

      Behavior: git-plugin throws GitException
      Expected behavior: merge successfully the pr branch and the base branch

      Suggested solution: fetch origin references and not only the tags

      Stack trace:
      > git rev-parse --is-inside-work-tree # timeout=10
      Fetching changes from the remote Git repository
      > git config remote.origin.url https://github.com/ros/bond_core.git # timeout=10
      Fetching upstream changes from https://github.com/ros/bond_core.git
      > git --version # timeout=10
      > git fetch --tags --progress https://github.com/ros/bond_core.git +refs/pull/:refs/remotes/origin/pr/
      > git rev-parse refs/remotes/origin/pr/31/merge^

      {commit} # timeout=10
      > git rev-parse refs/remotes/origin/origin/pr/31/merge^{commit}

      # timeout=10
      Merging Revision b0644a4eb62fde36776aae1a6ecd63a5a077838f (refs/remotes/origin/pr/31/merge) to origin/groovy-devel, UserMergeOptions

      {mergeRemote='origin', mergeTarget='groovy-devel', mergeStrategy='default', fastForwardMode='--ff'}

      > git rev-parse origin/groovy-devel^

      {commit} # timeout=10
      FATAL: Command "git rev-parse origin/groovy-devel^{commit}

      " returned status code 128:
      stdout: origin/groovy-devel^

      {commit}

      Workaround: wipe the workspace of the job

      Link to failing Jenkins job:
      http://build.ros.org/job/Ipr__bond_core__ubuntu_trusty_amd64/25/console

      This is my first issue on Jenkins please let me know if there is any missing information or if this is not the right way to describe an issue.
      Thanks!

      Edit: markewaite Sorry for the delay. For various reasons our buildfarm has an "old" version of Jenkins and some plugins. We're spinning up a new farm with the latest version of Jenkins and all plugins, I'll use that config to test and provide a reproducible example

            Unassigned Unassigned
            mikaelarguedas Mikael Arguedas
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: