BMO/AutoLand

AutoLand Extension

Overview

Lukas Blakk has been working on enabling automatic landing of patches from Bugzilla to the Mozilla code repositories. She is approaching a stage where the feature can be tested in a staging area, so she needs some UI changes be implemented in the Bugzilla Tweaks Extension or in BMO directly.

Bugzilla Auto Landing

Details

Rather than use Bugzilla Tweaks at all, which we would like to slowly phase out as we add more features to BMO directly, we propose creating a BMO extension called AutoLand. This would allow us to incorporate the needed functionality directly to BMO with the need of add-ons or javascript. Also using an extension, we can create a separate database table allowing us to store data for use by the WebService API calls and other workflow status. This will alleviate the need for using the whiteboard which could be prone to error if the user does not format it correctly or if someone adds to the whiteboard that should not be allowed to.

Use Case:

  1. A user that has a patch that has completed review and wants to have the patch autolanded will check the AutoLand checkbox next to the specific patch in the attachments table.
  2. The current AutoLand polling server, using a WebService API call will look for bugs that have patches AutoLand checked on that are not yet marked as landed, will look for attachments that need processing.
  3. The AutoLand server will push the patches to try, and if successful, commit to mozilla-central if the autoland initiator has the proper permissions.
  4. The AutoLand server, once the process is completed, uses another WebService API call to BMO setting the patch as 'landed' so that it cannot be processed again.
  5. During each step of the process, try, hg commit, etc., the AutoLand server uses the WebService API of BMO to add comments to the bug report letting the user know the status of their patch(es).

[missing anything?]

Implementation

show_bug:

  • Add a new hook to the attachments table allowing for an additional column to be displayed containing the AutoLand checkbox for an attachment.
  • When a patch has been checked for AutoLand, disable the checkbox so it cannot be manipulated until the AutoLand server has finished processing the patch.
  • If there is an error with the Autoland process, the server sends a message to BMO and the checkbox becomes unchecked, allowing the user to resubmit if needed.
  • If all is successful, the checkbox remains checked and a new patch must be attached to start the process again.

WebService API

AutoLand.getBugs():

  • returns a list of bugs, each being a hash of data needed by the AutoLand polling server
  • [ { bug_id => $bug_id1, attachments => [ $attach_id1, $attach_id2 ] }, ... ]
  • anything else needed by the server?

AutoLand.landUpdate({ bug_id => $bug_id, attach_id => $attach_id, status => $status, message => $message }):

  • Let's BMO know if a patch has landed or not and BMO will update the auto_land table accordingly
  • $status will be a predetermined set of success/error codes.
  • $message will be added as a bug comment

Bug.comment({ ids => [$bug_id], comment => $comment }) (present):

  • Update the bug comments to let the user know of any status updates

Database Schema

auto_land:

  • id INTEGER AUTO_INCREMENT
  • attach_id INTEGER NOT NULL /* Foreign key to attachments.id */
  • who INTEGER NOT NULL /* Foreign key to profiles.userid. The BZ user who requested the autoland (not necessarily patch author) */
  • landed BOOLEAN DEFAULT 0 /* Set to true when the patch has landed */
  • landed_when DATETIME /* Timestamp when the patch landed */