nemccarthy / stash-pullrequest-builder-plugin

A Jenkins plugin for Building Stash Pull Requests
https://wiki.jenkins-ci.org/display/JENKINS/Stash+pullrequest+builder+plugin
Other
64 stars 130 forks source link

Trigger build only if Git target branch to merge matches target branch in PR #4

Closed christiangalsterer closed 9 years ago

christiangalsterer commented 9 years ago

It would be great if the plugin could only trigger the build if in the Git configuration the "Merge before build" feature is enabled and the target branch matches the PR target branch. There is a detailed discussion in https://github.com/Nerdwin15/stash-jenkins-postreceive-webhook/issues/83#issuecomment-54965939 and https://github.com/Nerdwin15/stash-jenkins-postreceive-webhook/issues/83#issuecomment-56066717 about the reasonings and use cases behind this request.

nemccarthy commented 9 years ago

Sorry not sure I fully understand the issue. Are builds being triggered when something other than the target branch is changing? If you have Rebuild if destination branch changes? ticked do builds not get kicked off or get kicked off for other branches unrelated to the target?

christiangalsterer commented 9 years ago

This is actually an enhancement request. The current version works as designed but it would be nice to get this extension implemented as is required in environment where multiple artifact version are maintained which require different Jenkins jobs (e.g. different configurations). Currently this is not possible as the target branch name is simply passed as parameter. The idea is that the plugin should check the git configuration only trigger the build if the git merge target branch and then PR branch are the same. More details on the use cases can be found in the links on the previous comment There was some code already doing this in another plugin (I think Github or Gitlab) which may serve as a blueprint. Please let me know if you need more information.

nemccarthy commented 9 years ago

Thanks for clarifying. Makes sense. I'll try to find some time in the next few weeks. We could simply add another field to this trigger with a branch filter, that would be pretty simple fix. Something more advanced would be to pull configs from the git plugin. What would be better? I'll find some time to do this in the next few weeks. As always happy to take any PRs :)

laurentverbruggen commented 9 years ago

Implemented in PR #21

nemccarthy commented 9 years ago

Thanks @laurentverbruggen

Released as v1.3.0, should be there in a few hrs