I have a Jenkins project where I want to merge in the latest origin/master into the feature branch before the build. A pull request is made through BitBucket to kick off the process.
I'm using the Git Plugin and under source code management, the repository URL is what I would use as a git clone for the project.
For branches to build, I'm using **/pull-requests/**
to ensure the only branches built are the ones attempting to merge into master.
Under additional behaviors, I have Merge Before Build and the values are as follows:
Name of repository: origin
Branch to merge to: master
merge strategy: recursive
fast-forward mode: --ff
This didn't work. When I tried it, the build was still unstable based on pmd issues already merged into master from another feature branch.
EDIT
I've also tried using git commands according to this answer in both the Prepare an enviroment for the run and Under Build Enviroment -> Execute shell script on remote host using ssh. Both times it didn't work, but maybe I implemented it wrong?