mohamicorp / stash-jenkins-postreceive-webhook

Webhook used to notify Jenkins when commits are made to Stash
Other
138 stars 98 forks source link

Manual trigger button #45

Closed melvyndekort closed 10 years ago

melvyndekort commented 10 years ago

There are circumstances where it's very handy to have a manual Jenkins trigger button available.

I'll explain a situation that we've come across. When you create a pull-request from branch X to branch Y, the latest version of the plugin triggers a build on Jenkins, all is well. However, when another developer would then commit something to branch Y, the build of the pull-request is out of date, since the target branch was modified. When you would then open the pull-request in the Stash pages, a new automerge is created in the background. At this moment no build is triggered since every open pull-request with target branch Y would have to be triggered. This would stress the Jenkins buildserver too much.

In our Stash setup we use the stash-jenkins-postreceive-webhook plugin combined with the stash-build-status-plugin. The latter one disables the Stash merge-button until a successful build of the automerge was performed. This will however also block the pull-request from being merged when branch Y was updated in the meanwhile.

A button to trigger a build manually would circumvent this problem.

mikesir87 commented 10 years ago

Sounds like fun and not too hard to plug in, as an endpoint already exists. Haven't had to add buttons to other parts of the UI, so this'll be fun to learn!

Where are you thinking this button should appear? On the pull request page? On the main repo page with the clone/fork/pull request buttons?

melvyndekort commented 10 years ago

I think too it would be a fun exercise. The most logical place would seem to me next to the merge button on the pull-request page.

mikesir87 commented 10 years ago

Ok. Just pushed a couple of commits that adds the button and triggers the build. Works for me in my environment. Go ahead and take a look and let me know how it works out for you or if you have any further feedback.

melvyndekort commented 10 years ago

Looks great, but I'm afraid I've found a small bug. When I have a repository on which I've configured no webhook to Jenkins, the button still appears. I think you should also check if the repository has the webhook enabled, don't you agree? But you picked up this issue very quickly, nice job!

mikesir87 commented 10 years ago

Haha... that would make sense, wouldn't it? I'll have to figure out how to make that condition. I wouldn't imagine it would take long. Good thing I've got a good tester! :+1:

mikesir87 commented 10 years ago

There we go. Just created the condition and tested it out. Was a little easier than I expected. Tested it out and it worked for me.

melvyndekort commented 10 years ago

Works! Great job Michael, seems like it's ready for general availability :+1: If you need any help in development, testing or anything else, just let me know!

BTW, issue can be closed :)

mikesir87 commented 10 years ago

Great! I'll go ahead and get it ready to go to the marketplace! If you get a chance, can you/your company/whoever go onto the plugin page and leave a rating? Always looking for a few positives when I can get them. :) If you need the link, it's in the README now.

melvyndekort commented 10 years ago

I've submitted a rating/review, but the link in the README ends up in a page not found... ;-)

mikesir87 commented 10 years ago

But the link works for me! Haha... it's because I'm logged in. I've got it fixed. And thanks for the great review! :)

Andddddd... issue closed! :+1:

crick231 commented 8 years ago

I dont see any button to trigger the build when pull request is created. I have latest version of webhook plugin installed, am I missing anything?