-->

Pull Request Notifier for Bitbucket with jenkins

2019-05-22 11:26发布

问题:

With reference to this question : Trigger jenkins build on stash pull request

I tried applying Christian Galsterer's solution

You may have a look at https://christiangalsterer.wordpress.com/2015/04/23/continuous-integration-for-pull-requests-with-jenkins-and-stash/ where I describe the detailed steps how to setup Jenkins and Stash to trigger automatically the correct Jenkins build(s) when a pull request is created or updated.

It uses the Jenkins Git Plugin and the Pull Request Notifier for Stash add-on and selects the correct build using the notification feature of the Jenkins Git Plugin.

Everything works fine other than getting values of

PULL_REQUEST_URL=${PULL_REQUEST_URL}
PULL_REQUEST_ID=${PULL_REQUEST_ID}

It says "PR #null" in build description under jenkins and same in stash

"pullstash #19 A moment ago
<a href='null'>PR #null</a>"

Can someone please suggest what is missed here?

回答1:

You have to declare the string parameters PULL_REQUEST_URL and PULL_REQUEST_ID in your Jenkins job.



回答2:

As per Christian's comment on that blog post:

Starting with the Git Plugin 2.5 parameters send via the notification are not automatically passed as parameters to the job for security reasons.

In order to allow again to pass the parameter to the job an additional environment parameter needs to be set containing the name of the parameters to pass.

More details can be found at https://github.com/jenkinsci/git-plugin/commit/cb778dd7ee1c7a3f820ac1021be89e60d56ac057.