Our current workflow involves using Pull Requests for Code Reviews of commits that are going in to our main line. The expectation is that the developer has compiled and tested the code locally before creating a Pull Request. I would like to make this expectation explicit by adding a small checkbox to the Pull Request creation page, asking the user to confirm that they have completed testing. Is this possible with a plugin or some other way?
You can plug into that page with a <form-fragment> plugin. This kind of plugin is something we thought we could improve on, so we never actually documented it, but it's there and I don't really see us getting rid of it anytime soon. Given the location isn't documented though, I can't promise we wouldn't remove that plugin location in a minor release.
The location you'd hook into is "bitbucket.page.createPullRequest", and you can trace back the <form-fragment> element in https://bitbucket.org/atlassian/stash-auto-unapprove-plugin/src/26996bfcd6d1acc055487241cbfa4fc85503670d/src/main/resources/atlassian-plugin.xml?at=master&fileviewer=file-view-default to see an example of how FormFragments can be used (note the context available will be different for the createPullRequest location than what the auto-unapprove plugin is using). essentially you are pretending that you are adding fields to the form to be submitted along with the form and handled by your plugin. But actually, you could just render whatever notice you want, and ignore any input validation / handling.
There's no more straightforward plugin point on that page, unfortunately.
I agree with Gabrielle... checkboxes that you must check, just become an, err, box-checking exercise... they become part of muscle memory so soon have no value at all.
Another way of accomplishing something similar is auto-adding a task to the PR - https://scriptrunner.adaptavist.com/latest/bitbucket/StashEventHandlers.html#_add_tasks_to_new_pull_requests . Then you have a merge check that prevents merge if there are uncompleted tasks.
But that's interesting about form fragments... sounds useful.
This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.Read more
Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda ...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs