Closed rtsai123 closed 7 years ago
Is this a problem with the lazy merge being done by stash?
Thanks for responding! Yes its seems like it is a problem with the lazy merge. I've also seen weird issue where build gets triggered but it doesn't have the lastest commit. Even though the commit sha is the latest the actual commit doesn't have the latest update.
here is what I have set in RefSpec +refs/pull-requests/:refs/remotes/origin/pr/ Branch Specifier (blank for 'any') origin/pr/${pullRequestId}/from
@rtsai123 The reason why you didn't get the latest commit was because bitbucket didn't have enough time to do the merge so the /merge ref was outdated.
I had this issue aswell, and since there was no workaround i fetched /from instead and did the merge locally in each job. Since the pullrequest builder has the source sha and destination sha i put something similar to this at the start of each build
git merge $destinationCommitHash
If you have downstream jobs that are not triggered by this plugin you can simply add a if condition on this command to check if the parameters are available
if [ ! -z "$destinationCommitHash" ]; then
git merge $destinationCommitHash
fi
Before this workaround every 10-15th build failed because of that race condition which was simply unacceptable. This might be a ugly workaround but at least it works. Have since built over 400 jobs that merges with the target branch without any issues.
This has now been fixed either using @johan-bjareholt suggestion above, the old way of doing the merge locally on the jenkins box (updated readme) OR reading this https://answers.atlassian.com/questions/239988/change-pull-request-refs-after-commit-instead-of-after-approval-or-workaround and testing with setting Build only if Stash reports no conflicts
to on, then it forces an update of the branch. This is the best option for most people so Build only if Stash reports no conflicts
now defaults to on from 1.7.1
Hi I am seeing a weird issue where the incorrect SHA is populated when getting commit for the latest PR.
In this example the SHA is incorrect which caused the build to fail.
Building in workspace /var/lib/jenkins/jobs/MYREPO/workspace
If I comment the PR with "Test this please" then the correct SHA gets populated.
Building in workspace /var/lib/jenkins/jobs/MYREPO/workspace
Has anyone seen this? Could this be a bug or something I'm missing? Thanks, Rob