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

"Merge before build" does not fetch updated merge target

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Not A Defect
    • Icon: Minor Minor
    • git-plugin
    • Ubuntu 14.04
      Jenkins 2.16
      Git plugin 3.0.1

      As part of our pull request workflow, we want Jenkins to try merging the pull request branch with the merge target.  We're using the "Stash pullrequest builder" plugin to poll the repo and provide the branch specifiers for both the pull request branch and the merge target to the Git plugin.

      In the configuration, we get (emphasizing important items):

      • "Branches to build" branch specifier: origin/pr/${pullRequestId}/from
      • "Additional behaviors", "Merge before build" has options:
        • Name of repository: origin
        • Branch to merge to: ${targetBranch}
        • Merge strategy: default
        • Fast-forward mode: --ff

      Unfortunately, while the Git plugin will fetch the item under "Branches to build", it does not fetch the "Branch to merge to", which means that it always merges with the wrong commit after the branch has moved in the upstream repo.

      To work around this, we're using "Wipe out repository and force clone", but it's a clumsy solution that won't scale up for larger repositories.

      One possible way to address the issue: "Merge before build" could automatically fetch the merge target

      Alternate possibility that might be valuable for other uses too: add a new "Additional behavior" that allows fetching specific refs.

      Please let me know if you need any additional information!

            Unassigned Unassigned
            gregoryfong_vg Gregory Fong
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: