Closed juherr closed 9 years ago
I agree that if stash says the merge is not possible we could avoid running the build but I don't see much harm. The build will fail pretty much instantly and it gives you a nice audit log as you may have other actions hanging off jenkins. I can see how the optimisation might be useful - happy to take a PR for this which adds a check box to ignore non-mergable requests
Yes, feedback is great but, as I understand, when the target branch is changing, a new build will be run. So imagine the target is moving often, it is not feedbacks anymore but noise ;)
I can try a pr but I have to find how and where to find the mergeable (or not) information. Do you have an idea?
I understand your pain.
Re API - it probably comes back in the JSON response from stash; https://developer.atlassian.com/static/rest/stash/3.9.2/stash-rest.html#idp2741168 I haven't seen it there from memory. But wouldn't be hard to test. If you create a log recorder in jenkins set it to all level and set the logger name to stashpullrequestbuilder.stashpullrequestbuilder
you can see the JSON stash sends back for each request. Then just look for the request on a PR thats not mergeable.
If you need a super hacky work around you can just use the silence feature in the title of the PR then edit the title when the PR is ready... There is another issue here for a feature to only tigger a build when asked in a comment (via test this please
) which would be another solution assuming we can't get merge info from stash.
If you could do a PR for this would be super helpful!
Bingo! https://developer.atlassian.com/static/rest/stash/3.9.2/stash-rest.html#idp2785024 its a new API request required. Looks like we just need the canMerge & conflicted fields.
{
"canMerge": false,
"conflicted": false,
"vetoes": [
{
"summaryMessage": "You may not merge after 6pm on a Friday.",
"detailedMessage": "It is likely that your Blood Alcohol Content (BAC) exceeds the threshold for making sensible decisions regarding pull requests. Please try again on Monday."
}
]
}
Seems like we should have a checkbox option for each. As some may only want the PR to be built for successful merge (not conflicted). And others may want it to meet some other condition, like only build after it has the required number of approvers.
At the same time, if the build succeeds we might also want and option that does POST to this api to auto merge! :)
I might actually get some time on Monday to look into these as there a lot of new feature requests and it seems like a few more users. Plus this is something I'd also like to reduce the mailbox spam for myself :P
Coming in 1.1.0
Awesome :+1:
Version 1.1.0 Release. Should be in Jenkins Update Centre in a few hours.
The Stash GUI already give information about the potential merge: "This pull request can't be merged". In this case, the plugin shouldn't try to run a build because we can suppose it won't work.