stash-jenkins-postreceive-webhook icon indicating copy to clipboard operation
stash-jenkins-postreceive-webhook copied to clipboard

Have Jenkins build pull request merge products

Open jimCresswell opened this issue 10 years ago • 3 comments

Identify the SHA of the current head of a pull request merge product (refs/pull-requests/*/merge) and use that to trigger a build of the merge product in Jenkins.

Note that this might break reporting by the Jenkins StashNotifier plugin as that relies on the SHA to report, I imagine the reporting itself will happen correctly but the merge product SHA is not one of the commits listed in the Stash pull request UI. It would be an acceptable hack if we could somehow send the source branch SHA as a parameter and use that for reporting build results back to Stash.

jimCresswell avatar Apr 29 '14 07:04 jimCresswell

These would be awesome if that would be possible. I think this feature is crucial for using PRs together with Jenkins. Only by this you can make sure that the PR merge product is green on the one hand, but that on the other hand that you can use the Stash PR feature "Requires X Numbers of successful builds" before a PR can be approved.

See also the discussion at http://nerdwin15.com/2013/04/continuous-integration-with-stash-and-jenkins/#comment-1560212586

So +1 from my side to implement this.

christiangalsterer avatar Aug 28 '14 05:08 christiangalsterer

I found a way to get this running. For this the plugin is combined with the [Stash Build Status Plugin](https://bitbucket.org/bolyuba/stash-build-status-plugin/overview plugin). The Stash Jenkins plugin is used to notify Jenkins and the Stash Build Status plugin is used to assign the build status of the auto merge commit to the last commit of the changeset this PR is about. By this Stash has a build status for the PR based not on the checkin but on the auto merge result of between the source and target of the PR.

I will try to write up the necessary steps in the next 1-2 days.

christiangalsterer avatar Aug 30 '14 10:08 christiangalsterer

@christiangalsterer I would be very interested to know the necessary steps you used! +1

adou600 avatar Feb 24 '15 07:02 adou600