Harbormaster restarts seem to work great, but aren't logged in the UI in a way users can look at them. See D8815.
Description
Description
Revisions and Commits
Revisions and Commits
Event Timeline
Comment Actions
Rough sketch of what I think the implementation will look like:
- There's no storage for Buildable transactions yet, so create HarbormasterBuildableTransaction, a new class in storage/. It can mostly be a copy/paste of HarbormasterBuildPlanTransaction and HarbormasterBuildStepTransaction. That is, this should subclass PhabricatorApplicationTransaction.
- Add a table for it. This can mostly be a copy/paste of the schema changes which add the above tables.
- (You don't need to add a comments table, I don't think making these things commentable is too useful.)
- Create a new Editor -- HarbormaterBuildableEditor -- like HarbormasterBuildStepEditor and HarbormasterBuildPlanEditor. This will subclass PhabricatorApplicationTransactionEditor.
- Create a new TransactionQuery -- HarbormasterBuildableTransactionQuery -- like HarbormasterBuildStepTransactionQuery.
- Add a constant to the new Transaction for TYPE_COMMAND or similar, to record "some user issued a command to this buildable".
Then the view code looks roughly like this:
$xactions = id(new HarbormasterBuildableTransactionQuery()) ->setViewer($viewer) ->withObjectPHIDs(array($buildable->getPHID())) ->execute(); $xaction_view = id(new PhabricatorApplicationTransactionView()) ->setUser($viewer) ->setObjectPHID($buildable->getPHID()) ->setTransactions($xactions);
...and you'll add a piece of code when the restart/stop/etc command issued like this:
$xactions = array(); $type_command = HarbormasterBuildableTransaction::TYPE_COMMAND; $xactions[] = id(new HarbormasterBuildableTransaction()) ->setTransactionType($type_command) ->setNewValue($the_command); $editor = id(new HarbormasterBuildableEditor()) ->setActor($viewer) ->setContentSourceFromRequest($request); $editor->applyTransactions($plan, $xactions);
Finally, implement methods in HarbormasterBuildableTransaction until the transactions render sensibly.